Code Duplication    Length = 24-25 lines in 3 locations

tests/TrailingSlashControllerProviderTest.php 3 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 shows that by default it will return 404 when the routes are defined with trailing slashes
@@ 274-297 (lines=24) @@
271
     *
272
     * @param string $method
273
     */
274
    public function testWillRespondWillNotFoundForRouteWithTrailingSlashWhenNotMounted($method)
275
    {
276
        $app = new Application();
277
278
        $app->match('/foo/', function () {
279
            return 'hunter42';
280
        })->method($method);
281
282
        $app->match('/foo/bar/', function () {
283
            return 'hunter42';
284
        })->method($method);
285
286
        $app->register(new TrailingSlashControllerProvider());
287
288
        $request = Request::create('/foo', $method);
289
        $response = $app->handle($request);
290
291
        $this->assertEquals(404, $response->getStatusCode());
292
293
        $request = Request::create('/foo/bar', $method);
294
        $response = $app->handle($request);
295
296
        $this->assertEquals(404, $response->getStatusCode());
297
    }
298
299
    /**
300
     * This is just to show when defining routes with no trailing slash before
@@ 307-331 (lines=25) @@
304
     *
305
     * @param string $method
306
     */
307
    public function testWillRespondWithOkForRouteWithNoTrailingSlashWhenMountedLast($method)
308
    {
309
        $app = new Application();
310
311
        $app->match('/foo', function () {
312
            return 'hunter42';
313
        })->method($method);
314
315
        $app->match('/foo/bar', function () {
316
            return 'hunter42';
317
        })->method($method);
318
319
        $app->register(new TrailingSlashControllerProvider());
320
        $app->mount('/', new TrailingSlashControllerProvider());
321
322
        $request = Request::create('/foo', $method);
323
        $response = $app->handle($request);
324
325
        $this->assertEquals(200, $response->getStatusCode());
326
327
        $request = Request::create('/foo/bar', $method);
328
        $response = $app->handle($request);
329
330
        $this->assertEquals(200, $response->getStatusCode());
331
    }
332
333
    /**
334
     * Test the case in which a request should have both query