コード例 #1
0
 /**
  * @covers       \Graviton\SecurityBundle\Authentication\Strategies\CookieFieldStrategy::apply
  * @covers       \Graviton\SecurityBundle\Authentication\Strategies\AbstractHttpStrategy::extractFieldInfo
  * @covers       \Graviton\SecurityBundle\Authentication\Strategies\AbstractHttpStrategy::validateField
  *
  * @dataProvider stringProvider
  *
  * @param string $fieldValue value to check
  *
  * @return void
  */
 public function testApply($fieldValue)
 {
     $client = static::createClient();
     $cookie = new Cookie(CookieFieldStrategy::COOKIE_FIELD, $fieldValue, time() + 3600 * 24 * 7, '/', null, false, false);
     $client->getCookieJar()->set($cookie);
     $client->request('GET', '/', array(), array(), array());
     $strategy = new CookieFieldStrategy();
     $this->assertSame($fieldValue, $strategy->apply($client->getRequest()));
 }
コード例 #2
0
 /**
  * @covers       \Graviton\SecurityBundle\Authentication\Strategies\CookieFieldStrategy::apply
  * @covers       \Graviton\SecurityBundle\Authentication\Strategies\AbstractHttpStrategy::extractFieldInfo
  * @covers       \Graviton\SecurityBundle\Authentication\Strategies\AbstractHttpStrategy::validateField
  *
  * @dataProvider stringProvider
  *
  * @param string $fieldValue value to check
  *
  * @return void
  */
 public function testApply($fieldValue)
 {
     $client = static::createClient();
     $cookie = new Cookie($client->getKernel()->getContainer()->getParameter('graviton.security.authentication.strategy_key'), $fieldValue, time() + 3600 * 24 * 7, '/', null, false, false);
     $client->getCookieJar()->set($cookie);
     $client->request('GET', '/', array(), array(), array());
     $strategy = new CookieFieldStrategy($client->getKernel()->getContainer()->getParameter('graviton.security.authentication.strategy_key'));
     $this->assertSame($fieldValue, $strategy->apply($client->getRequest()));
 }