class BlockContentWizardTest
Same name and namespace in other branches
- 11.x core/modules/block_content/tests/src/Functional/Views/BlockContentWizardTest.php \Drupal\Tests\block_content\Functional\Views\BlockContentWizardTest
- 10 core/modules/block_content/tests/src/Functional/Views/BlockContentWizardTest.php \Drupal\Tests\block_content\Functional\Views\BlockContentWizardTest
- 8.9.x core/modules/block_content/tests/src/Functional/Views/BlockContentWizardTest.php \Drupal\Tests\block_content\Functional\Views\BlockContentWizardTest
Tests block_content wizard and generic entity integration.
@group block_content
Hierarchy
- class \Drupal\Tests\BrowserTestBase uses \Drupal\Core\Test\FunctionalTestSetupTrait, \Drupal\Tests\UiHelperTrait, \Drupal\Core\Test\TestSetupTrait, \Drupal\Tests\block\Traits\BlockCreationTrait, \Drupal\FunctionalTests\AssertLegacyTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\node\Traits\NodeCreationTrait, \Drupal\Tests\node\Traits\ContentTypeCreationTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\user\Traits\UserCreationTrait, \Drupal\Tests\XdebugRequestTrait, \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait, \Drupal\Tests\ExtensionListTestTrait extends \PHPUnit\Framework\TestCase
- class \Drupal\Tests\block_content\Functional\BlockContentTestBase extends \Drupal\Tests\BrowserTestBase
- class \Drupal\Tests\block_content\Functional\Views\BlockContentWizardTest extends \Drupal\Tests\block_content\Functional\BlockContentTestBase
- class \Drupal\Tests\block_content\Functional\BlockContentTestBase extends \Drupal\Tests\BrowserTestBase
Expanded class hierarchy of BlockContentWizardTest
File
-
core/
modules/ block_content/ tests/ src/ Functional/ Views/ BlockContentWizardTest.php, line 12
Namespace
Drupal\Tests\block_content\Functional\ViewsView source
class BlockContentWizardTest extends BlockContentTestBase {
/**
* {@inheritdoc}
*/
protected static $modules = [
'block_content',
'views_ui',
];
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* {@inheritdoc}
*/
protected function setUp() : void {
parent::setUp();
$this->drupalLogin($this->drupalCreateUser([
'administer views',
]));
$this->createBlockContentType('Basic block');
}
/**
* Tests creating a 'block_content' entity view.
*/
public function testViewAddBlockContent() {
$view = [];
$view['label'] = $this->randomMachineName(16);
$view['id'] = strtolower($this->randomMachineName(16));
$view['description'] = $this->randomMachineName(16);
$view['page[create]'] = FALSE;
$view['show[wizard_key]'] = 'block_content';
$this->drupalGet('admin/structure/views/add');
$this->submitForm($view, 'Save and edit');
$view_storage_controller = $this->container
->get('entity_type.manager')
->getStorage('view');
/** @var \Drupal\views\Entity\View $view */
$view = $view_storage_controller->load($view['id']);
$display_options = $view->getDisplay('default')['display_options'];
$this->assertEquals('block_content', $display_options['filters']['reusable']['entity_type']);
$this->assertEquals('reusable', $display_options['filters']['reusable']['entity_field']);
$this->assertEquals('boolean', $display_options['filters']['reusable']['plugin_id']);
$this->assertEquals('1', $display_options['filters']['reusable']['value']);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.