예제 #1
0
파일: ConvertTest.php 프로젝트: payum/core
 /**
  * @test
  */
 public function couldBeConstructedWithSourceModelAndToAndOptionnalToken()
 {
     $request = new Convert($source = new \stdClass(), $to = 'array', $token = $this->getMock(TokenInterface::class));
     $this->assertSame($source, $request->getSource());
     $this->assertSame($to, $request->getTo());
     $this->assertSame($token, $request->getToken());
     $this->assertNull($request->getResult());
 }
예제 #2
0
 function it_supports_only_converting_to_array_from_payment(Convert $fromSomethingElseToSomethingElseRequest, Convert $fromPaymentToArrayRequest, PaymentInterface $payment, PaymentMethodInterface $method)
 {
     $fromPaymentToArrayRequest->getTo()->willReturn('array');
     $fromPaymentToArrayRequest->getSource()->willReturn($payment);
     $fromSomethingElseToSomethingElseRequest->getTo()->willReturn('json');
     $fromSomethingElseToSomethingElseRequest->getSource()->willReturn($method);
     $this->supports($fromPaymentToArrayRequest)->shouldReturn(true);
     $this->supports($fromSomethingElseToSomethingElseRequest)->shouldReturn(false);
 }
 function it_throws_exception_when_source_is_not_a_payment_interface(Convert $request)
 {
     $request->getSource()->willReturn(null);
     $this->shouldThrow(RequestNotSupportedException::class)->during('execute', [$request]);
 }