public function testOnKernelRequestUserHash() { $hash = '123abc'; $this->hashGenerator->expects($this->once())->method('generate')->will($this->returnValue($hash)); $this->request->headers->add(array('X-HTTP-Override' => 'AUTHENTICATE', 'Accept' => Kernel::USER_HASH_ACCEPT_HEADER)); $this->request->expects($this->once())->method('hasSession')->will($this->returnValue(true)); $this->assertNull($this->requestEventListener->onKernelRequestUserHash($this->event)); $this->assertTrue($this->event->isPropagationStopped()); $this->assertTrue($this->event->hasResponse()); $response = $this->event->getResponse(); $this->assertInstanceOf('Symfony\\Component\\HttpFoundation\\Response', $response); $this->assertTrue($response->headers->has('X-User-Hash')); $this->assertSame($hash, $response->headers->get('X-User-Hash')); }