/**
  * @test
  */
 public function shouldReturnExpectedTokenIfAllCheckPassedOnVerify()
 {
     $_SERVER['REQUEST_URI'] = 'http://target.com/foo';
     $expectedToken = new Token();
     $expectedToken->setHash('theHash');
     $expectedToken->setTargetUrl('http://target.com/foo');
     $storageMock = $this->createStorageMock();
     $storageMock->expects($this->once())->method('findModelById')->with('theHash')->will($this->returnValue($expectedToken));
     $verifier = new PlainHttpRequestVerifier($storageMock);
     $actualToken = $verifier->verify(array('payum_token' => 'theHash'));
     $this->assertSame($expectedToken, $actualToken);
 }
Exemplo n.º 2
0
 /**
  * {@inheritDoc}
  *
  * @param Identificator $details
  *
  * @throws InvalidArgumentException if $details is not instance of Identificator
  *
  * @return void
  */
 public function setDetails($details)
 {
     if (false == $details instanceof Identificator) {
         throw new InvalidArgumentException('Details must be instance of `Identificator`.');
     }
     parent::setDetails($details);
 }
Exemplo n.º 3
0
 /**
  * @test
  */
 public function shouldAllowSetAfterUrl()
 {
     $token = new \Payum\Model\Token();
     $token->setAfterUrl('anUrl');
 }
Exemplo n.º 4
0
 /**
  * @test
  */
 public function shouldAllowGetIdentificatorPreviouslySetAsDetails()
 {
     $expectedIdentificator = new Identificator('anId', 'stdClass');
     $token = new Token();
     $token->setDetails($expectedIdentificator);
     $this->assertSame($expectedIdentificator, $token->getDetails());
 }