Exemplo n.º 1
0
 /**
  * @test
  *
  * @expectedException \Payum\Core\Exception\InvalidArgumentException
  * @expectedExceptionMessage Storage for given class "stdClass" does not exist.
  */
 public function alwaysThrowOnGetStorageForObject()
 {
     $registry = new DynamicRegistry($this->createStorageMock(), $this->createGatewayFactoryRegistryMock());
     $registry->setBackwardCompatibility(false);
     $registry->getStorage(new \stdClass());
 }
    /**
     * @test
     */
    public function shouldCallStaticRegistryOnGetStorage()
    {
        $staticRegistryMock = $this->createRegistryMock();
        $staticRegistryMock
            ->expects($this->once())
            ->method('getStorage')
            ->with('theName')
            ->willReturn('theStorage')
        ;

        $registry = new DynamicRegistry(
            $this->createStorageMock(),
            $staticRegistryMock
        );

        $this->assertEquals('theStorage', $registry->getStorage('theName'));
    }