function UnpublishedBlockTest::testViewShowsCorrectStates
Same name in other branches
- 9 core/modules/block_content/tests/src/Functional/UnpublishedBlockTest.php \Drupal\Tests\block_content\Functional\UnpublishedBlockTest::testViewShowsCorrectStates()
- 8.9.x core/modules/block_content/tests/src/Functional/UnpublishedBlockTest.php \Drupal\Tests\block_content\Functional\UnpublishedBlockTest::testViewShowsCorrectStates()
- 11.x core/modules/block_content/tests/src/Functional/UnpublishedBlockTest.php \Drupal\Tests\block_content\Functional\UnpublishedBlockTest::testViewShowsCorrectStates()
Tests unpublishing of block_content entities.
File
-
core/
modules/ block_content/ tests/ src/ Functional/ UnpublishedBlockTest.php, line 33
Class
- UnpublishedBlockTest
- Tests unpublishing of block_content entities.
Namespace
Drupal\Tests\block_content\FunctionalCode
public function testViewShowsCorrectStates() : void {
$block_content = BlockContent::create([
'info' => 'Test block',
'type' => 'basic',
]);
$block_content->save();
$block = $this->placeBlock('block_content:' . $block_content->uuid());
$this->drupalGet('<front>');
$page = $this->getSession()
->getPage();
$this->assertTrue($page->has('css', '#block-' . $block->id()));
$block_content->setUnpublished();
$block_content->save();
$this->drupalGet('<front>');
$page = $this->getSession()
->getPage();
$this->assertFalse($page->has('css', '#block-' . $block->id()));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.