
| Current Path : /var/www/html1/testsite/web/core/modules/views/tests/src/Functional/Wizard/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/html1/testsite/web/core/modules/views/tests/src/Functional/Wizard/NodeWizardTest.php |
<?php
namespace Drupal\Tests\views\Functional\Wizard;
/**
* Tests node wizard and generic entity integration.
*
* @group Views
* @group node
*/
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->drupalPostForm('admin/structure/views/add', $view, t('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->assertEqual('node', $display_options['fields']['title']['entity_type']);
$this->assertEqual('title', $display_options['fields']['title']['entity_field']);
$this->assertEqual('node', $display_options['filters']['status']['entity_type']);
$this->assertEqual('status', $display_options['filters']['status']['entity_field']);
$this->assertEqual('node', $display_options['sorts']['created']['entity_type']);
$this->assertEqual('created', $display_options['sorts']['created']['entity_field']);
}
}