Code Duplication    Length = 16-16 lines in 2 locations

tests/JwtServiceTest.php 2 locations

@@ 73-88 (lines=16) @@
70
    /**
71
     * testGetUserIdFromToken method
72
     */
73
    public function testGetUserIdFromToken()
74
    {
75
        $token = $this->getToken();
76
77
        $this->tokenManager->shouldReceive('check')
78
            ->once()
79
            ->with(Mockery::on(function($claim) {
80
                return $claim->sub == 5
81
                    && $claim->iss == 'http://www.test.com';
82
            }))
83
            ->andReturn(true);
84
85
        $userId = $this->jwtService->getUserIdFromToken($token);
86
87
        $this->assertEquals(5, $userId);
88
    }
89
90
    /**
91
     * testGetUserIdFromTokenWithInvalidClaim method
@@ 93-108 (lines=16) @@
90
    /**
91
     * testGetUserIdFromTokenWithInvalidClaim method
92
     */
93
    public function testGetUserIdFromTokenWithInvalidClaim()
94
    {
95
        $token = $this->getToken();
96
97
        $this->tokenManager->shouldReceive('check')
98
            ->once()
99
            ->with(Mockery::on(function($claim) {
100
                return $claim->sub == 5
101
                && $claim->iss == 'http://www.test.com';
102
            }))
103
            ->andReturn(false);
104
105
        $this->setExpectedException(\WWON\JwtGuard\Exceptions\InvalidTokenException::class);
106
107
        $userId = $this->jwtService->getUserIdFromToken($token);
108
    }
109
110
    /**
111
     * getToken method