/** * @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); }
/** * {@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); }
/** * @test */ public function shouldAllowSetAfterUrl() { $token = new \Payum\Model\Token(); $token->setAfterUrl('anUrl'); }
/** * @test */ public function shouldAllowGetIdentificatorPreviouslySetAsDetails() { $expectedIdentificator = new Identificator('anId', 'stdClass'); $token = new Token(); $token->setDetails($expectedIdentificator); $this->assertSame($expectedIdentificator, $token->getDetails()); }