Code Duplication    Length = 24-26 lines in 2 locations

tests/Http/Controllers/SecurityControllerTest.php 2 locations

@@ 303-326 (lines=24) @@
300
        $this->assertEquals($resp->getTargetUrl(), 'http://leo108.com?ticket=ST-abc');
301
    }
302
303
    public function testLogoutWhenNotLoggedInWithoutService()
304
    {
305
        $loginInteraction = Mockery::mock(UserLogin::class)
306
            ->shouldReceive('getCurrentUser')
307
            ->andReturn(false)
308
            ->once()
309
            ->shouldReceive('showLoggedOut')
310
            ->andReturnUsing(
311
                function ($request) {
312
                    return 'showLoggedOut called';
313
                }
314
            )
315
            ->once()
316
            ->getMock();
317
        app()->instance(UserLogin::class, $loginInteraction);
318
        $request = Mockery::mock(Request::class)
319
            ->shouldReceive('get')
320
            ->withArgs(['service'])
321
            ->andReturn(null)
322
            ->once()
323
            ->getMock();
324
        $this->doesntExpectEvents(CasUserLogoutEvent::class);
325
        $this->assertEquals('showLoggedOut called', app()->make(SecurityController::class)->logout($request));
326
    }
327
328
    public function testLogoutWithoutService()
329
    {
@@ 328-353 (lines=26) @@
325
        $this->assertEquals('showLoggedOut called', app()->make(SecurityController::class)->logout($request));
326
    }
327
328
    public function testLogoutWithoutService()
329
    {
330
        $loginInteraction = Mockery::mock(UserLogin::class)
331
            ->shouldReceive('logout')
332
            ->once()
333
            ->shouldReceive('getCurrentUser')
334
            ->andReturn(new User())
335
            ->once()
336
            ->shouldReceive('showLoggedOut')
337
            ->andReturnUsing(
338
                function ($request) {
339
                    return 'showLoggedOut called';
340
                }
341
            )
342
            ->once()
343
            ->getMock();
344
        app()->instance(UserLogin::class, $loginInteraction);
345
        $request = Mockery::mock(Request::class)
346
            ->shouldReceive('get')
347
            ->withArgs(['service'])
348
            ->andReturn(null)
349
            ->once()
350
            ->getMock();
351
        $this->expectsEvents(CasUserLogoutEvent::class);
352
        $this->assertEquals('showLoggedOut called', app()->make(SecurityController::class)->logout($request));
353
    }
354
355
    public function testLogoutWithValidService()
356
    {