/** * @covers ::getResumeContextResponse * * @depends testGetPayment */ public function testGetResumeContextResponse() { $response = $this->getMock(ResponseInterface::class); $payment = $this->getMock(PaymentInterface::class); $this->sut->setPayment($payment); $this->sut->expects($this->atLeastOnce())->method('doGetResumeContextResponse')->willReturn($response); $this->eventDispatcher->expects($this->once())->method('preResumeContext')->with($payment); $this->assertSame($response, $this->sut->getResumeContextResponse()); }
/** * @covers ::executePaymentAccessCurrency * * @dataProvider providerTestExecutePaymentAccessCurrency */ public function testExecutePaymentAccessCurrency($expected, $supported_currencies, $payment_currency_code, $payment_amount) { $payment = $this->getMockPayment(); $payment->expects($this->atLeastOnce())->method('getAmount')->willReturn($payment_amount); $payment->expects($this->atLeastOnce())->method('getCurrencyCode')->willReturn($payment_currency_code); $this->sut->setPayment($payment); $this->sut->expects($this->atLeastOnce())->method('getSupportedCurrencies')->willReturn($supported_currencies); $account = $this->getMock(AccountInterface::class); $method = new \ReflectionMethod($this->sut, 'executePaymentAccessCurrency'); $method->setAccessible(TRUE); $this->assertSame($expected, $method->invoke($this->sut, $account)->isAllowed()); }
/** * @covers ::setPayment * @covers ::getPayment */ public function testGetPayment() { $payment = $this->getMock(PaymentInterface::class); $this->assertSame($this->sut, $this->sut->setPayment($payment)); $this->assertSame($payment, $this->sut->getPayment()); }
/** * @covers ::doGetResumeContextResponse * @expectedException \Symfony\Component\HttpKernel\Exception\NotFoundHttpException */ public function testDoGetResumeContextResponse() { $payment = $this->getMock(PaymentInterface::class); $this->sut->setPayment($payment); $this->sut->getResumeContextResponse(); }