Pull merge.
[yaffs-website] / web / core / modules / block_content / tests / src / Functional / UnpublishedBlockTest.php
1 <?php
2
3 namespace Drupal\Tests\block_content\Functional;
4
5 use Drupal\block_content\Entity\BlockContent;
6 use Drupal\simpletest\BlockCreationTrait;
7 use Drupal\Tests\BrowserTestBase;
8
9 /**
10  * Tests unpublishing of block_content entities.
11  *
12  * @group block_content
13  */
14 class UnpublishedBlockTest extends BrowserTestBase {
15
16   use BlockCreationTrait;
17
18   /**
19    * {@inheritdoc}
20    */
21   public static $modules = ['block_content'];
22
23   /**
24    * Tests unpublishing of block_content entities.
25    */
26   public function testViewShowsCorrectStates() {
27     $block_content = BlockContent::create([
28       'info' => 'Test block',
29       'type' => 'basic',
30     ]);
31     $block_content->save();
32
33     $this->placeBlock('block_content:' . $block_content->uuid());
34
35     $this->drupalGet('<front>');
36     $page = $this->getSession()->getPage();
37     $this->assertTrue($page->has('css', '.block-block-content' . $block_content->uuid()));
38
39     $block_content->setUnpublished();
40     $block_content->save();
41
42     $this->drupalGet('<front>');
43     $page = $this->getSession()->getPage();
44     $this->assertFalse($page->has('css', '.block-block-content' . $block_content->uuid()));
45   }
46
47 }