Code Duplication    Length = 15-16 lines in 2 locations

Tests/Unit/EventListener/UserContextSubscriberTest.php 2 locations

@@ 136-151 (lines=16) @@
133
        $this->assertContains('X-Hash', $event->getResponse()->headers->get('Vary'));
134
    }
135
136
    public function testOnKernelResponseNotMaster()
137
    {
138
        $request = new Request();
139
        $request->setMethod('HEAD');
140
        $request->headers->set('X-Hash', 'hash');
141
142
        $requestMatcher = $this->getRequestMatcher($request, false);
143
        $hashGenerator = \Mockery::mock('\FOS\HttpCache\UserContext\HashGenerator');
144
145
        $userContextSubscriber = new UserContextSubscriber($requestMatcher, $hashGenerator, array('X-SessionId'), 'X-Hash');
146
        $event = $this->getKernelResponseEvent($request, null, HttpKernelInterface::SUB_REQUEST);
147
148
        $userContextSubscriber->onKernelResponse($event);
149
150
        $this->assertFalse($event->getResponse()->headers->has('Vary'));
151
    }
152
153
    /**
154
     * If there is no hash in the request, vary on the user identifier.
@@ 156-170 (lines=15) @@
153
    /**
154
     * If there is no hash in the request, vary on the user identifier.
155
     */
156
    public function testOnKernelResponseNotCached()
157
    {
158
        $request = new Request();
159
        $request->setMethod('HEAD');
160
161
        $requestMatcher = $this->getRequestMatcher($request, false);
162
        $hashGenerator = \Mockery::mock('\FOS\HttpCache\UserContext\HashGenerator');
163
164
        $userContextSubscriber = new UserContextSubscriber($requestMatcher, $hashGenerator, array('X-SessionId'), 'X-Hash');
165
        $event = $this->getKernelResponseEvent($request);
166
167
        $userContextSubscriber->onKernelResponse($event);
168
169
        $this->assertEquals('X-SessionId', $event->getResponse()->headers->get('Vary'));
170
    }
171
172
    /**
173
     * If there is no hash in the request, vary on the user identifier.