/** * @covers \Graviton\SecurityBundle\Authentication\Strategies\HeaderFieldStrategy::apply * @covers \Graviton\SecurityBundle\Authentication\Strategies\AbstractHttpStrategy::extractFieldInfo * @covers \Graviton\SecurityBundle\Authentication\Strategies\AbstractHttpStrategy::validateField * * @dataProvider stringProvider * * @param string $headerFieldValue header to test with * * @return void */ public function testApply($headerFieldValue) { $server = array('HTTP_X_IDP_USERNAME' => $headerFieldValue); $client = static::createClient(); $client->request('GET', '/', array(), array(), $server); $strategy = new HeaderFieldStrategy(); $this->assertEquals($headerFieldValue, $strategy->apply($client->getRequest())); }
/** * @covers \Graviton\SecurityBundle\Authentication\Strategies\HeaderFieldStrategy::apply * @covers \Graviton\SecurityBundle\Authentication\Strategies\AbstractHttpStrategy::extractFieldInfo * @covers \Graviton\SecurityBundle\Authentication\Strategies\AbstractHttpStrategy::validateField * * @dataProvider stringProvider * * @param string $headerFieldValue header to test with * * @return void */ public function testApply($headerFieldValue) { $server = array('HTTP_X_IDP_USERNAME' => $headerFieldValue); $client = static::createClient(); $client->request('GET', '/', array(), array(), $server); $strategy = new HeaderFieldStrategy($client->getKernel()->getContainer()->getParameter('graviton.security.authentication.strategy_key')); $this->assertEquals($headerFieldValue, $strategy->apply($client->getRequest())); }