コード例 #1
0
ファイル: builder.php プロジェクト: great-minds/sales
 protected function buildRegistry(array $gateways = [], array $storages = [], array $gatewayFactories = [])
 {
     $fallbackRegistry = new SimpleRegistry($gateways, $storages, $gatewayFactories);
     $fallbackRegistry->setAddStorageExtensions(false);
     if ($this->gatewayConfigStorage) {
         $fallbackRegistry = new ComSalesPayumRegistryDynamic_registry($this->gatewayConfigStorage, $fallbackRegistry);
     }
     if ($this->mainRegistry) {
         $registry = new FallbackRegistry($this->mainRegistry, $fallbackRegistry);
     } else {
         $registry = $fallbackRegistry;
     }
     return $registry;
 }
コード例 #2
0
 /**
  * @test
  */
 public function shouldNotInitializeStorageExtensionsOnGetGatewaysIfNotGenericGateway()
 {
     $storageOneMock = $this->getMock('Payum\\Core\\Storage\\StorageInterface');
     $gatewayFooMock = $this->getMock('Payum\\Core\\GatewayInterface');
     $gatewayBarMock = $this->getMock('Payum\\Core\\Gateway');
     $registry = new SimpleRegistry(array('foo' => $gatewayFooMock, 'bar' => $gatewayBarMock), array('fooClass' => $storageOneMock));
     $registry->getGateways();
 }
コード例 #3
0
 /**
  * @test
  */
 public function shouldInitializeStorageExtensionsOnGetPayments()
 {
     $storageOneMock = $this->getMock('Payum\\Core\\Storage\\StorageInterface');
     $paymentFooMock = $this->getMock('Payum\\Core\\PaymentInterface');
     $paymentFooMock->expects($this->once())->method('addExtension');
     $paymentBarMock = $this->getMock('Payum\\Core\\PaymentInterface');
     $paymentBarMock->expects($this->once())->method('addExtension');
     $registry = new SimpleRegistry(array('foo' => $paymentFooMock, 'bar' => $paymentBarMock), array('fooClass' => $storageOneMock), 'foo');
     $registry->getPayments();
     $registry->getPayments();
 }
コード例 #4
0
    /**
     * @test
     */
    public function shouldNotInitializeStorageExtensionsOnGetPaymentsIfNotGenericPayment()
    {
        $storageOneMock = $this->getMock('Payum\Core\Storage\StorageInterface');

        $paymentFooMock = $this->getMock('Payum\Core\PaymentInterface');

        $paymentBarMock = $this->getMock('Payum\Core\Payment');

        $registry = new SimpleRegistry(
            array('foo' => $paymentFooMock, 'bar' => $paymentBarMock),
            array(
                'fooClass' => $storageOneMock,
            )
        );

        $registry->getPayments();
    }
コード例 #5
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;
 }