comparison core/modules/user/tests/src/Kernel/WhosOnlineBlockTest.php @ 18:af1871eacc83

Update to Drupal core 8.7.1
author Chris Cannam
date Thu, 09 May 2019 15:33:08 +0100
parents 129ea1e6d783
children
comparison
equal deleted inserted replaced
17:129ea1e6d783 18:af1871eacc83
107 // Test the rendering of a block. 107 // Test the rendering of a block.
108 $entity = Block::load('views_block__who_s_online_who_s_online_block'); 108 $entity = Block::load('views_block__who_s_online_who_s_online_block');
109 $output = entity_view($entity, 'block'); 109 $output = entity_view($entity, 'block');
110 $this->setRawContent($this->renderer->renderRoot($output)); 110 $this->setRawContent($this->renderer->renderRoot($output));
111 $this->assertRaw('2 users', 'Correct number of online users (2 users).'); 111 $this->assertRaw('2 users', 'Correct number of online users (2 users).');
112 $this->assertText($user1->getUsername(), 'Active user 1 found in online list.'); 112 $this->assertText($user1->getAccountName(), 'Active user 1 found in online list.');
113 $this->assertText($user2->getUsername(), 'Active user 2 found in online list.'); 113 $this->assertText($user2->getAccountName(), 'Active user 2 found in online list.');
114 $this->assertNoText($user3->getUsername(), 'Inactive user not found in online list.'); 114 $this->assertNoText($user3->getAccountName(), 'Inactive user not found in online list.');
115 $this->assertTrue(strpos($this->getRawContent(), $user1->getUsername()) > strpos($this->getRawContent(), $user2->getUsername()), 'Online users are ordered correctly.'); 115 $this->assertTrue(strpos($this->getRawContent(), $user1->getAccountName()) > strpos($this->getRawContent(), $user2->getAccountName()), 'Online users are ordered correctly.');
116 } 116 }
117 117
118 } 118 }