|
16 | 16 | class viewonline_test extends ideas_functional_base |
17 | 17 | { |
18 | 18 | /** |
19 | | - * Visit Ideas as user "admin" |
| 19 | + * Test viewonline page for admin |
20 | 20 | */ |
21 | | - public function test_viewonline_visit_ideas() |
| 21 | + public function test_viewonline_check_viewonline() |
22 | 22 | { |
| 23 | + // Visit Ideas as user "admin" |
23 | 24 | $this->login(); |
24 | 25 | $crawler = self::request('GET', "app.php/ideas?sid=$this->sid"); |
25 | 26 | $this->assertContainsLang('IDEAS_TITLE', $crawler->filter('h2')->text()); |
26 | | - } |
27 | 27 |
|
28 | | - /** |
29 | | - * Test viewonline page for admin |
30 | | - * |
31 | | - * We use a second function here, so we get a new session and can log in |
32 | | - * without having to log out "admin" first. |
33 | | - * |
34 | | - * @depends test_viewonline_visit_ideas |
35 | | - */ |
36 | | - public function test_viewonline_check_viewonline() |
37 | | - { |
38 | | - // Create user1 and send them to the Viewonline |
39 | | - $this->create_user('user1'); |
40 | | - $this->login('user1'); |
| 28 | + // Create a second user and check who is online from a separate session. |
| 29 | + self::$client->restart(); |
| 30 | + $this->create_user('ideas-viewonline-user1'); |
| 31 | + $this->login('ideas-viewonline-user1'); |
| 32 | + // PHP goes faster than DBMS, make sure session data got written to the database. |
| 33 | + sleep(1); |
41 | 34 | $crawler = self::request('GET', "viewonline.php?sid=$this->sid"); |
42 | 35 |
|
43 | | - // Is admin still viewing Ideas page |
| 36 | + // Is admin still viewing Ideas page? |
44 | 37 | self::assertStringContainsString('admin', $crawler->filter('#page-body table.table1')->text()); |
45 | 38 |
|
46 | 39 | $session_entries = $crawler->filter('#page-body table.table1 tr')->count(); |
|
0 commit comments