3 namespace Drupal\Tests\block_content\Functional\Views;
5 use Drupal\Tests\block_content\Functional\BlockContentTestBase;
8 * Tests block_content wizard and generic entity integration.
10 * @group block_content
12 class BlockContentWizardTest extends BlockContentTestBase {
17 public static $modules = ['block_content', 'views_ui'];
22 protected function setUp() {
24 $this->drupalLogin($this->drupalCreateUser(['administer views']));
25 $this->createBlockContentType('Basic block');
29 * Tests creating a 'block_content' entity view.
31 public function testViewAddBlockContent() {
33 $view['label'] = $this->randomMachineName(16);
34 $view['id'] = strtolower($this->randomMachineName(16));
35 $view['description'] = $this->randomMachineName(16);
36 $view['page[create]'] = FALSE;
37 $view['show[wizard_key]'] = 'block_content';
38 $this->drupalPostForm('admin/structure/views/add', $view, t('Save and edit'));
40 $view_storage_controller = $this->container->get('entity_type.manager')->getStorage('view');
41 /** @var \Drupal\views\Entity\View $view */
42 $view = $view_storage_controller->load($view['id']);
44 $display_options = $view->getDisplay('default')['display_options'];
46 $this->assertEquals('block_content', $display_options['filters']['reusable']['entity_type']);
47 $this->assertEquals('reusable', $display_options['filters']['reusable']['entity_field']);
48 $this->assertEquals('boolean', $display_options['filters']['reusable']['plugin_id']);
49 $this->assertEquals('1', $display_options['filters']['reusable']['value']);