/** * @test */ public function shouldExecuteNotifyRequestOnDoUnsafe() { $request = Request::create('/'); $request->query->set('payment_name', 'thePaymentName'); $paymentMock = $this->getMock('Payum\Core\PaymentInterface'); $paymentMock ->expects($this->once()) ->method('execute') ->with($this->isInstanceOf('Payum\Core\Request\Notify')) ; $registryMock = $this->getMock('Payum\Core\Registry\RegistryInterface'); $registryMock ->expects($this->once()) ->method('getPayment') ->with('thePaymentName') ->will($this->returnValue($paymentMock)) ; $container = new Container; $container->set('payum', $registryMock); $controller = new NotifyController; $controller->setContainer($container); $response = $controller->doUnsafeAction($request); $this->assertInstanceOf('Symfony\Component\HttpFoundation\Response', $response); $this->assertEquals(204, $response->getStatusCode()); $this->assertEquals('', $response->getContent()); }
/** * @test */ public function shouldExecuteNotifyRequestOnDoUnsafe() { $request = Request::create('/'); $request->query->set('gateway', 'theGatewayName'); $gatewayMock = $this->getMock(GatewayInterface::class); $gatewayMock->expects($this->once())->method('execute')->with($this->isInstanceOf(Notify::class)); $registryMock = $this->getMock(RegistryInterface::class); $registryMock->expects($this->once())->method('getGateway')->with('theGatewayName')->will($this->returnValue($gatewayMock)); $container = new Container(); $container->set('payum', $registryMock); $controller = new NotifyController(); $controller->setContainer($container); $response = $controller->doUnsafeAction($request); $this->assertInstanceOf(Response::class, $response); $this->assertEquals(204, $response->getStatusCode()); $this->assertEquals('', $response->getContent()); }