Code Duplication    Length = 25-25 lines in 2 locations

tests/TrailingSlashControllerProviderTest.php 2 locations

@@ 241-265 (lines=25) @@
238
     *
239
     * @param string $method
240
     */
241
    public function testWillRespondWithNotFoundForRouteWithNoTrailingSlashWhenMountedFirst($method)
242
    {
243
        $app = new Application();
244
245
        $app->register(new TrailingSlashControllerProvider());
246
        $app->mount('/', new TrailingSlashControllerProvider());
247
248
        $app->match('/foo', function () {
249
            return 'hunter42';
250
        })->method($method);
251
252
        $app->match('/foo/bar', function () {
253
            return 'hunter42';
254
        })->method($method);
255
256
        $request = Request::create('/foo', $method);
257
        $response = $app->handle($request);
258
259
        $this->assertEquals(404, $response->getStatusCode());
260
261
        $request = Request::create('/foo/bar', $method);
262
        $response = $app->handle($request);
263
264
        $this->assertEquals(404, $response->getStatusCode());
265
    }
266
267
    /**
268
     * This is just to show when defining routes with no trailing slash before
@@ 275-299 (lines=25) @@
272
     *
273
     * @param string $method
274
     */
275
    public function testWillRespondWithOkForRouteWithNoTrailingSlashWhenMountedLast($method)
276
    {
277
        $app = new Application();
278
279
        $app->match('/foo', function () {
280
            return 'hunter42';
281
        })->method($method);
282
283
        $app->match('/foo/bar', function () {
284
            return 'hunter42';
285
        })->method($method);
286
287
        $app->register(new TrailingSlashControllerProvider());
288
        $app->mount('/', new TrailingSlashControllerProvider());
289
290
        $request = Request::create('/foo', $method);
291
        $response = $app->handle($request);
292
293
        $this->assertEquals(200, $response->getStatusCode());
294
295
        $request = Request::create('/foo/bar', $method);
296
        $response = $app->handle($request);
297
298
        $this->assertEquals(200, $response->getStatusCode());
299
    }
300
301
    /**
302
     * Test the case in which a request should have both query