コード例 #1
0
 public function testWriteSerie()
 {
     $serie = new SerieToken(3, 'abc', 'def');
     $serie->setExpiresAt(new \DateTime('+1 year'));
     $response = new Response();
     $this->service->writeSerie($response, $serie);
     $this->assertTrue($response->getHeaders()->has('SetCookie'));
     $cookie = $response->getHeaders()->get('SetCookie')->current();
     $this->assertInstanceOf('Zend\\Http\\Header\\SetCookie', $cookie);
     $this->assertEquals('JwPersistentUser', $cookie->getName());
     $this->assertEquals('3:abc:def', $cookie->getValue());
     $this->assertDateTimeEquals(new \DateTime('+1 year'), new \DateTime($cookie->getExpires()));
     $this->assertEquals('/', $cookie->getPath());
 }