Code Duplication    Length = 22-22 lines in 2 locations

Tests/Unit/EventListener/UserContextSubscriberTest.php 2 locations

@@ 37-58 (lines=22) @@
34
        );
35
    }
36
37
    public function testOnKernelRequest()
38
    {
39
        $request = new Request();
40
        $request->setMethod('HEAD');
41
42
        $requestMatcher = $this->getRequestMatcher($request, true);
43
        $hashGenerator = \Mockery::mock('\FOS\HttpCache\UserContext\HashGenerator');
44
        $hashGenerator->shouldReceive('generateHash')->andReturn('hash');
45
46
        $userContextSubscriber = new UserContextSubscriber($requestMatcher, $hashGenerator, array('X-SessionId'), 'X-Hash');
47
        $event = $this->getKernelRequestEvent($request);
48
49
        $userContextSubscriber->onKernelRequest($event);
50
51
        $response = $event->getResponse();
52
53
        $this->assertNotNull($response);
54
        $this->assertInstanceOf('\Symfony\Component\HttpFoundation\Response', $response);
55
        $this->assertEquals('hash', $response->headers->get('X-Hash'));
56
        $this->assertNull($response->headers->get('Vary'));
57
        $this->assertEquals('max-age=0, no-cache, private', $response->headers->get('Cache-Control'));
58
    }
59
60
    public function testOnKernelRequestNonMaster()
61
    {
@@ 77-98 (lines=22) @@
74
        $this->assertNull($event->getResponse());
75
    }
76
77
    public function testOnKernelRequestCached()
78
    {
79
        $request = new Request();
80
        $request->setMethod('HEAD');
81
82
        $requestMatcher = $this->getRequestMatcher($request, true);
83
        $hashGenerator = \Mockery::mock('\FOS\HttpCache\UserContext\HashGenerator');
84
        $hashGenerator->shouldReceive('generateHash')->andReturn('hash');
85
86
        $userContextSubscriber = new UserContextSubscriber($requestMatcher, $hashGenerator, array('X-SessionId'), 'X-Hash', 30);
87
        $event = $this->getKernelRequestEvent($request);
88
89
        $userContextSubscriber->onKernelRequest($event);
90
91
        $response = $event->getResponse();
92
93
        $this->assertNotNull($response);
94
        $this->assertInstanceOf('\Symfony\Component\HttpFoundation\Response', $response);
95
        $this->assertEquals('hash', $response->headers->get('X-Hash'));
96
        $this->assertEquals('X-SessionId', $response->headers->get('Vary'));
97
        $this->assertEquals('max-age=30, public', $response->headers->get('Cache-Control'));
98
    }
99
100
    public function testOnKernelRequestNotMatched()
101
    {