Further Drupal 8.6.4 changes. Some core files were not committed before a commit...
[yaffs-website] / web / core / modules / views / tests / src / Functional / Wizard / NodeWizardTest.php
1 <?php
2
3 namespace Drupal\Tests\views\Functional\Wizard;
4
5 /**
6  * Tests node wizard and generic entity integration.
7  *
8  * @group Views
9  * @group node
10  */
11 class NodeWizardTest extends WizardTestBase {
12
13   /**
14    * Tests creating a view with node titles.
15    */
16   public function testViewAddWithNodeTitles() {
17     $this->drupalCreateContentType(['type' => 'article']);
18
19     $view = [];
20     $view['label'] = $this->randomMachineName(16);
21     $view['id'] = strtolower($this->randomMachineName(16));
22     $view['description'] = $this->randomMachineName(16);
23     $view['page[create]'] = FALSE;
24     $view['show[wizard_key]'] = 'node';
25     $view['page[style][row_plugin]'] = 'titles';
26     $this->drupalPostForm('admin/structure/views/add', $view, t('Save and edit'));
27
28     $view_storage_controller = \Drupal::entityManager()->getStorage('view');
29     /** @var \Drupal\views\Entity\View $view */
30     $view = $view_storage_controller->load($view['id']);
31
32     $display_options = $view->getDisplay('default')['display_options'];
33     // Ensure that the 'entity_table' and 'entity_field' properties are set
34     // property.
35     $this->assertEqual('node', $display_options['fields']['title']['entity_type']);
36     $this->assertEqual('title', $display_options['fields']['title']['entity_field']);
37
38     $this->assertEqual('node', $display_options['filters']['status']['entity_type']);
39     $this->assertEqual('status', $display_options['filters']['status']['entity_field']);
40
41     $this->assertEqual('node', $display_options['sorts']['created']['entity_type']);
42     $this->assertEqual('created', $display_options['sorts']['created']['entity_field']);
43   }
44
45 }