Code Duplication    Length = 14-14 lines in 2 locations

tests/unit/JWTAuthenticationHandlerTest.php 1 location

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

tests/unit/JWTAuthenticatorTest.php 1 location

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