コード例 #1
0
    /**
     * @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'));
    }
コード例 #2
0
ファイル: DynamicRegistryTest.php プロジェクト: payum/core
 /**
  * @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());
 }
コード例 #3
0
ファイル: PayumBuilder.php プロジェクト: payum/core
 /**
  * @param array $gateways
  * @param array $storages
  * @param array $gatewayFactories
  *
  * @return RegistryInterface
  */
 protected function buildRegistry(array $gateways = [], array $storages = [], array $gatewayFactories = [])
 {
     $registry = new SimpleRegistry($gateways, $storages, $gatewayFactories);
     $registry->setAddStorageExtensions(false);
     if ($this->gatewayConfigStorage) {
         $dynamicRegistry = new DynamicRegistry($this->gatewayConfigStorage, $registry);
         $dynamicRegistry->setBackwardCompatibility(false);
         $registry = new FallbackRegistry($dynamicRegistry, $registry);
     }
     if ($this->mainRegistry) {
         $registry = new FallbackRegistry($this->mainRegistry, $registry);
     }
     return $registry;
 }