/** * @expectedException WikiaException * @group Hack */ public function testCreatingTokenException() { $dbMock = $this->getMock('DatabaseMysql', array('insert', 'insertId', 'update', 'commit')); $dbMock->expects($this->once())->method('insert')->with($this->equalTo(UAD::TOKEN_DB_NAME), $this->anything(), $this->equalTo('UAD::createToken')); $dbMock->expects($this->once())->method('insertId')->will($this->returnValue(0)); $this->object->expects($this->once())->method('getDb')->will($this->returnValue($dbMock)); $this->object->createToken(); }
public function store() { $this->fetchCookie(); if (!isset($this->cookie->token)) { $token = $this->UAD->createToken(); $this->setTokenInCookie($token); } else { $token = $this->cookie->token; } //$events = $this->fetchEventsFromCookie( $token ); $this->getResponse()->setVal('token', $token); $this->updateCookie(); }