コード例 #1
0
ファイル: GatewayFactory.php プロジェクト: Raxer971/challenge
 /**
  * @param Gateway     $gateway
  * @param ArrayObject $config
  */
 protected function buildActions(Gateway $gateway, ArrayObject $config)
 {
     foreach ($config as $name => $value) {
         if (0 === strpos($name, 'payum.action')) {
             $prepend = in_array($name, $config['payum.prepend_actions']);
             if (is_callable($value)) {
                 $gateway->addAction(call_user_func_array($value, array($config)), $prepend);
             } else {
                 $gateway->addAction($value, $prepend);
             }
         }
     }
 }
コード例 #2
0
ファイル: CoreGatewayFactory.php プロジェクト: eamador/Payum
 /**
  * @param Gateway     $gateway
  * @param ArrayObject $config
  */
 protected function buildActions(Gateway $gateway, ArrayObject $config)
 {
     foreach ($config as $name => $value) {
         if (0 === strpos($name, 'payum.action')) {
             $prepend = in_array($name, $config['payum.prepend_actions']);
             $gateway->addAction($value, $prepend);
         }
     }
 }
コード例 #3
0
ファイル: GatewayTest.php プロジェクト: eamador/Payum
 /**
  * @test
  */
 public function shouldPopulateContextWithPreviousOnesOnSubExecutes()
 {
     $gateway = new Gateway();
     $firstRequest = new \stdClass();
     $secondRequest = new \stdClass();
     $firstAction = new RequireOtherRequestAction();
     $firstAction->setSupportedRequest($firstRequest);
     $firstAction->setRequiredRequest($secondRequest);
     $gateway->addAction($firstAction);
     $actionMock = $this->createActionMock();
     $actionMock->expects($this->any())->method('supports')->willReturnCallback(function ($request) use($secondRequest) {
         return $secondRequest === $request;
     });
     $gateway->addAction($actionMock);
     $testCase = $this;
     $extensionMock = $this->createExtensionMock();
     $extensionMock->expects($this->at(0))->method('onPreExecute')->willReturnCallback(function (Context $context) use($testCase, $firstRequest) {
         $testCase->assertSame($firstRequest, $context->getRequest());
         $testCase->assertEmpty($context->getPrevious());
     });
     $extensionMock->expects($this->at(1))->method('onPreExecute')->willReturnCallback(function (Context $context) use($testCase, $secondRequest) {
         $testCase->assertSame($secondRequest, $context->getRequest());
         $testCase->assertCount(1, $context->getPrevious());
         $this->assertContainsOnly('Payum\\Core\\Extension\\Context', $context->getPrevious());
     });
     $gateway->addExtension($extensionMock);
     $gateway->execute($firstRequest);
 }