public function AdminToolbarStateTest::testNotModeratedEntity in Moderation Sidebar 8
Tests state labels in admin toolbar with a not moderated entity.
File
- tests/
src/ Functional/ AdminToolbarStateTest.php, line 76
Class
- AdminToolbarStateTest
- Contains test for the toolbar state label.
Namespace
Drupal\Tests\moderation_sidebar\FunctionalCode
public function testNotModeratedEntity() {
$node = $this
->createNode([
'type' => 'article',
]);
$url = $node
->toUrl()
->toString();
$assert_session = $this
->assertSession();
// Draft.
$node
->set('status', NodeInterface::NOT_PUBLISHED);
$node
->save();
$this
->drupalGet($url);
$assert_session
->elementExists('css', '.moderation-label-draft[data-label="Draft"]');
// Published.
$node
->set('status', NodeInterface::PUBLISHED);
$node
->save();
$this
->drupalGet($url);
$assert_session
->elementExists('css', '.moderation-label-published[data-label="Published"]');
}