コード例 #1
0
ファイル: GatewayFactory.php プロジェクト: Raxer971/challenge
 /**
  * @param Gateway     $gateway
  * @param ArrayObject $config
  */
 protected function buildApis(Gateway $gateway, ArrayObject $config)
 {
     foreach ($config as $name => $value) {
         if (0 === strpos($name, 'payum.api')) {
             $prepend = in_array($name, $config['payum.prepend_apis']);
             if (is_callable($value)) {
                 $gateway->addApi(call_user_func_array($value, array($config)), $prepend);
             } else {
                 $gateway->addApi($value, $prepend);
             }
         }
     }
 }
コード例 #2
0
ファイル: CoreGatewayFactory.php プロジェクト: eamador/Payum
 /**
  * @param Gateway     $gateway
  * @param ArrayObject $config
  */
 protected function buildApis(Gateway $gateway, ArrayObject $config)
 {
     foreach ($config as $name => $value) {
         if (0 === strpos($name, 'payum.api')) {
             $prepend = in_array($name, $config['payum.prepend_apis']);
             $gateway->addApi($value, $prepend);
         }
     }
 }
コード例 #3
0
ファイル: GatewayTest.php プロジェクト: eamador/Payum
 /**
  * @test
  *
  * @expectedException \Payum\Core\Exception\LogicException
  * @expectedExceptionMessage Cannot find right api supported by
  */
 public function throwIfGatewayNotHaveApiSupportedByActionOnExecute()
 {
     $gateway = new Gateway();
     $gateway->addApi($firstApi = new \stdClass());
     $gateway->addApi($secondApi = new \stdClass());
     $action = $this->getMockForAbstractClass(ApiAwareAction::class);
     $action->expects($this->at(0))->method('setApi')->with($this->identicalTo($firstApi))->will($this->throwException(new UnsupportedApiException('first api not supported')));
     $action->expects($this->at(1))->method('setApi')->with($this->identicalTo($secondApi))->will($this->throwException(new UnsupportedApiException('second api not supported')));
     $action->expects($this->never())->method('supports');
     $gateway->addAction($action);
     $gateway->execute(new \stdClass());
 }