@@ 35-46 (lines=12) @@ | ||
32 | $this->assertContains('successfully logged in', $message); |
|
33 | } |
|
34 | ||
35 | public function testAutoLoggingIn() |
|
36 | { |
|
37 | // Simulate an autologin by calling the extension hook directly. |
|
38 | // Member->autoLogin() relies on session and cookie state which we can't simulate here. |
|
39 | $this->logInWithPermission('ADMIN'); |
|
40 | $member = \Member::get()->filter(array('Email' => '[email protected]'))->first(); |
|
41 | $member->extend('memberAutoLoggedIn'); |
|
42 | ||
43 | $message = $this->writer->getLastMessage(); |
|
44 | $this->assertContains('[email protected]', $message); |
|
45 | $this->assertContains('successfully restored autologin', $message); |
|
46 | } |
|
47 | ||
48 | public function testLoggingOut() |
|
49 | { |
|
@@ 48-58 (lines=11) @@ | ||
45 | $this->assertContains('successfully restored autologin', $message); |
|
46 | } |
|
47 | ||
48 | public function testLoggingOut() |
|
49 | { |
|
50 | $this->logInWithPermission('ADMIN'); |
|
51 | ||
52 | $member = \Member::get()->filter(array('Email' => '[email protected]'))->first(); |
|
53 | $member->logOut(); |
|
54 | ||
55 | $message = $this->writer->getLastMessage(); |
|
56 | $this->assertContains('[email protected]', $message); |
|
57 | $this->assertContains('successfully logged out', $message); |
|
58 | } |
|
59 | ||
60 | public function testLoggingWriteDoesNotOccurWhenNotLoggedIn() |
|
61 | { |
|
@@ 71-82 (lines=12) @@ | ||
68 | $this->assertEmpty($message, 'No one is logged in, so nothing was logged'); |
|
69 | } |
|
70 | ||
71 | public function testLoggingWriteWhenLoggedIn() |
|
72 | { |
|
73 | $this->logInWithPermission('ADMIN'); |
|
74 | ||
75 | $group = new \Group(array('Title' => 'My group')); |
|
76 | $group->write(); |
|
77 | ||
78 | $message = $this->writer->getLastMessage(); |
|
79 | $this->assertContains('[email protected]', $message); |
|
80 | $this->assertContains('modified', $message); |
|
81 | $this->assertContains('Group', $message); |
|
82 | } |
|
83 | ||
84 | public function testAddMemberToGroupUsingGroupMembersRelation() |
|
85 | { |