@@ 44-55 (lines=12) @@ | ||
41 | $this->assertNotNull($response->Token); |
|
42 | } |
|
43 | ||
44 | public function testResolveInvalidWithAllowedAnonymous() |
|
45 | { |
|
46 | Config::modify()->set(JWTAuthenticator::class, 'anonymous_allowed', true); |
|
47 | $authenticator = Injector::inst()->get(CreateTokenMutationCreator::class); |
|
48 | ||
49 | $response = $authenticator->resolve(null, ['Email' => '[email protected]', 'Password' => 'wrong'], [], |
|
50 | new ResolveInfo([])); |
|
51 | ||
52 | $this->assertTrue($response instanceof Member); |
|
53 | $this->assertEquals(0, $response->ID); |
|
54 | $this->assertNotNull($response->Token); |
|
55 | } |
|
56 | ||
57 | public function testResolveInvalidWithoutAllowedAnonymous() |
|
58 | { |
|
@@ 57-67 (lines=11) @@ | ||
54 | $this->assertNotNull($response->Token); |
|
55 | } |
|
56 | ||
57 | public function testResolveInvalidWithoutAllowedAnonymous() |
|
58 | { |
|
59 | Config::modify()->set(JWTAuthenticator::class, 'anonymous_allowed', false); |
|
60 | $authenticator = Injector::inst()->get(CreateTokenMutationCreator::class); |
|
61 | ||
62 | $response = $authenticator->resolve(null, ['Email' => '[email protected]', 'Password' => 'wrong'], [], |
|
63 | new ResolveInfo([])); |
|
64 | ||
65 | $this->assertTrue($response instanceof Member); |
|
66 | $this->assertNull($response->Token); |
|
67 | } |
|
68 | } |
|
69 |