@@ 21-30 (lines=10) @@ | ||
18 | ||
19 | final class SessionManagerTest extends TestCase |
|
20 | { |
|
21 | public function testIsAuthenticated(): void |
|
22 | { |
|
23 | $session = $this->prophesize(Session::class); |
|
24 | $session->get('_CORE23_FACEBOOK_TOKEN') |
|
25 | ->willReturn(true) |
|
26 | ; |
|
27 | ||
28 | $manager = new SessionManager($session->reveal()); |
|
29 | static::assertTrue($manager->isAuthenticated()); |
|
30 | } |
|
31 | ||
32 | public function testIsNotAuthenticated(): void |
|
33 | { |
|
@@ 32-41 (lines=10) @@ | ||
29 | static::assertTrue($manager->isAuthenticated()); |
|
30 | } |
|
31 | ||
32 | public function testIsNotAuthenticated(): void |
|
33 | { |
|
34 | $session = $this->prophesize(Session::class); |
|
35 | $session->get('_CORE23_FACEBOOK_TOKEN') |
|
36 | ->willReturn(false) |
|
37 | ; |
|
38 | ||
39 | $manager = new SessionManager($session->reveal()); |
|
40 | static::assertFalse($manager->isAuthenticated()); |
|
41 | } |
|
42 | ||
43 | public function testGetUsername(): void |
|
44 | { |
|
@@ 43-52 (lines=10) @@ | ||
40 | static::assertFalse($manager->isAuthenticated()); |
|
41 | } |
|
42 | ||
43 | public function testGetUsername(): void |
|
44 | { |
|
45 | $session = $this->prophesize(Session::class); |
|
46 | $session->get('_CORE23_FACEBOOK_NAME') |
|
47 | ->willReturn('MyUser') |
|
48 | ; |
|
49 | ||
50 | $manager = new SessionManager($session->reveal()); |
|
51 | static::assertSame('MyUser', $manager->getUsername()); |
|
52 | } |
|
53 | ||
54 | public function testGetUsernameNotExist(): void |
|
55 | { |
|
@@ 54-63 (lines=10) @@ | ||
51 | static::assertSame('MyUser', $manager->getUsername()); |
|
52 | } |
|
53 | ||
54 | public function testGetUsernameNotExist(): void |
|
55 | { |
|
56 | $session = $this->prophesize(Session::class); |
|
57 | $session->get('_CORE23_FACEBOOK_NAME') |
|
58 | ->willReturn(null) |
|
59 | ; |
|
60 | ||
61 | $manager = new SessionManager($session->reveal()); |
|
62 | static::assertNull($manager->getUsername()); |
|
63 | } |
|
64 | ||
65 | public function testStore(): void |
|
66 | { |
|
@@ 134-144 (lines=11) @@ | ||
131 | static::assertSame($tomorrow, $facebookSession->getExpireDate()); |
|
132 | } |
|
133 | ||
134 | public function testGetSessionWithNoAuth(): void |
|
135 | { |
|
136 | $session = $this->prophesize(Session::class); |
|
137 | $session->get('_CORE23_FACEBOOK_TOKEN') |
|
138 | ->willReturn(null) |
|
139 | ; |
|
140 | ||
141 | $manager = new SessionManager($session->reveal()); |
|
142 | ||
143 | static::assertNull($manager->getSession()); |
|
144 | } |
|
145 | } |
|
146 |