コード例 #1
0
 /**
  * @test
  */
 public function shouldExecuteRefundRequestWithoutAfterUrl()
 {
     $request = Request::create('/');
     $request->query->set('foo', 'fooVal');
     $token = new Token();
     $token->setGatewayName('theGateway');
     $token->setAfterUrl(null);
     $tokenVerifierMock = $this->getMock('Payum\\Core\\Security\\HttpRequestVerifierInterface');
     $tokenVerifierMock->expects($this->once())->method('verify')->with($this->identicalTo($request))->will($this->returnValue($token));
     $tokenVerifierMock->expects($this->once())->method('invalidate')->with($this->identicalTo($token));
     $gatewayMock = $this->getMock('Payum\\Core\\GatewayInterface');
     $gatewayMock->expects($this->once())->method('execute')->with($this->isInstanceOf('Payum\\Core\\Request\\Refund'));
     $registryMock = $this->getMock('Payum\\Core\\Registry\\RegistryInterface');
     $registryMock->expects($this->once())->method('getGateway')->with('theGateway')->will($this->returnValue($gatewayMock));
     $container = new Container();
     $container->set('payum', $registryMock);
     $container->set('payum.security.http_request_verifier', $tokenVerifierMock);
     $controller = new RefundController();
     $controller->setContainer($container);
     $response = $controller->doAction($request);
     $this->assertInstanceOf('Symfony\\Component\\HttpFoundation\\Response', $response);
     $this->assertEquals(204, $response->getStatusCode());
 }
コード例 #2
0
 /**
  * @test
  */
 public function shouldExecuteRefundRequestWithoutAfterUrl()
 {
     $request = Request::create('/');
     $request->query->set('foo', 'fooVal');
     $token = new Token();
     $token->setGatewayName('theGateway');
     $token->setAfterUrl(null);
     $httpRequestVerifierMock = $this->getMock(HttpRequestVerifierInterface::class);
     $httpRequestVerifierMock->expects($this->once())->method('verify')->with($this->identicalTo($request))->will($this->returnValue($token));
     $httpRequestVerifierMock->expects($this->once())->method('invalidate')->with($this->identicalTo($token));
     $gatewayMock = $this->getMock(GatewayInterface::class);
     $gatewayMock->expects($this->once())->method('execute')->with($this->isInstanceOf(Refund::class));
     $registryMock = $this->getMock(RegistryInterface::class);
     $registryMock->expects($this->once())->method('getGateway')->with('theGateway')->will($this->returnValue($gatewayMock));
     $payum = new Payum($registryMock, $httpRequestVerifierMock, $this->getMock(GenericTokenFactoryInterface::class), $this->getMock(StorageInterface::class));
     $container = new Container();
     $container->set('payum', $payum);
     $controller = new RefundController();
     $controller->setContainer($container);
     $response = $controller->doAction($request);
     $this->assertInstanceOf(Response::class, $response);
     $this->assertEquals(204, $response->getStatusCode());
 }