/** * @covers Alchemy\Phrasea\Authentication\PersistentCookie\Manager::getSession */ public function testGetSessionReturnFalse() { $encoder = $this->getPasswordEncoderMock(); $browser = $this->getBrowserMock(); $tokenValue = 'encrypted-persistent-value'; $browser->expects($this->once())->method('getBrowser')->will($this->returnValue('Firefox')); $browser->expects($this->once())->method('getPlatform')->will($this->returnValue('Linux')); $session = new Session(); $session->setNonce('prettyN0nce'); $repo = $this->getMockBuilder('Doctrine\\ORM\\EntityRepository')->disableOriginalConstructor()->getMock(); $repo->expects($this->once())->method('findOneBy')->with($this->equalTo(['token' => $tokenValue]))->will($this->returnValue($session)); $manager = new Manager($encoder, $repo, $browser); $encoder->expects($this->once())->method('isPasswordValid')->with($this->anything(), 'Firefox_Linux', 'prettyN0nce')->will($this->returnValue(false)); $this->assertFalse($manager->getSession($tokenValue)); }
/** * {@inheritDoc} */ public function setNonce($nonce) { $this->__initializer__ && $this->__initializer__->__invoke($this, 'setNonce', array($nonce)); return parent::setNonce($nonce); }