class NodeWizardTest
Same name and namespace in other branches
- 11.x core/modules/views/tests/src/Functional/Wizard/NodeWizardTest.php \Drupal\Tests\views\Functional\Wizard\NodeWizardTest
Tests node wizard and generic entity integration.
@group Views @group node
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 implements \PHPUnit\Framework\TestCase
- class \Drupal\Tests\views\Functional\ViewTestBase uses \Drupal\views\Tests\ViewResultAssertionTrait implements \Drupal\Tests\BrowserTestBase
- class \Drupal\Tests\views\Functional\Wizard\WizardTestBase implements \Drupal\Tests\views\Functional\ViewTestBase
- class \Drupal\Tests\views\Functional\Wizard\NodeWizardTest implements \Drupal\Tests\views\Functional\Wizard\WizardTestBase
- class \Drupal\Tests\views\Functional\Wizard\WizardTestBase implements \Drupal\Tests\views\Functional\ViewTestBase
- class \Drupal\Tests\views\Functional\ViewTestBase uses \Drupal\views\Tests\ViewResultAssertionTrait implements \Drupal\Tests\BrowserTestBase
Expanded class hierarchy of NodeWizardTest
File
-
core/
modules/ views/ tests/ src/ Functional/ Wizard/ NodeWizardTest.php, line 11
Namespace
Drupal\Tests\views\Functional\WizardView source
class NodeWizardTest extends WizardTestBase {
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* Tests creating a view with node titles.
*/
public function testViewAddWithNodeTitles() {
$this->drupalCreateContentType([
'type' => 'article',
]);
$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]'] = 'node';
$view['page[style][row_plugin]'] = 'titles';
$this->drupalGet('admin/structure/views/add');
$this->submitForm($view, 'Save and edit');
$view_storage_controller = \Drupal::entityTypeManager()->getStorage('view');
/** @var \Drupal\views\Entity\View $view */
$view = $view_storage_controller->load($view['id']);
$display_options = $view->getDisplay('default')['display_options'];
// Ensure that the 'entity_table' and 'entity_field' properties are set
// property.
$this->assertEquals('node', $display_options['fields']['title']['entity_type']);
$this->assertEquals('title', $display_options['fields']['title']['entity_field']);
$this->assertEquals('node', $display_options['filters']['status']['entity_type']);
$this->assertEquals('status', $display_options['filters']['status']['entity_field']);
$this->assertEquals('node', $display_options['sorts']['created']['entity_type']);
$this->assertEquals('created', $display_options['sorts']['created']['entity_field']);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.