NodeWizardTest.php in Zircon Profile 8
File
core/modules/views/src/Tests/Wizard/NodeWizardTest.php
View source
<?php
namespace Drupal\views\Tests\Wizard;
class NodeWizardTest extends WizardTestBase {
public function testViewAddWithNodeTitles() {
$this
->drupalCreateContentType(array(
'type' => 'article',
));
$view = array();
$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::entityManager()
->getStorage('view');
$view = $view_storage_controller
->load($view['id']);
$display_options = $view
->getDisplay('default')['display_options'];
$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']);
}
}