Code Duplication    Length = 14-14 lines in 2 locations

tests/unit/JWTAuthenticationHandlerTest.php 1 location

@@ 45-58 (lines=14) @@
42
        parent::tearDown();
43
    }
44
45
    public function testInvalidAuthenticateRequest()
46
    {
47
        putenv('JWT_SIGNER_KEY=string');
48
49
        $request = new HTTPRequest('POST', Director::absoluteBaseURL() . '/graphql');
50
        $request->addHeader('Authorization', 'Bearer ' . $this->token);
51
52
        $handler = Injector::inst()->get(JWTAuthenticationHandler::class);
53
54
        $result = $handler->authenticateRequest($request);
55
        putenv('JWT_SIGNER_KEY=test_signer');
56
57
        $this->assertNull($result);
58
    }
59
60
    public function testAuthenticateRequest()
61
    {

tests/unit/JWTAuthenticatorTest.php 1 location

@@ 58-71 (lines=14) @@
55
        $this->assertEquals($this->member->ID, $result->ID);
56
    }
57
58
    public function testInvalidToken()
59
    {
60
        putenv('JWT_SIGNER_KEY=string');
61
62
        $authenticator = Injector::inst()->get(JWTAuthenticator::class);
63
        $request = new HTTPRequest('POST', Director::absoluteBaseURL() . '/graphql');
64
        $request->addHeader('Authorization', 'Bearer ' . $this->token);
65
66
        $result = $authenticator->authenticate(['token' => $this->token], $request);
67
68
        $this->assertNotInstanceOf(Member::class, $result);
69
70
        putenv('JWT_SIGNER_KEY=test_signer');
71
    }
72
73
    public function testInvalidUniqueID()
74
    {