ExtraFieldDisplayUITest.php in Extra Field 8.2
File
tests/src/Functional/ExtraFieldDisplayUITest.php
View source
<?php
namespace Drupal\Tests\extra_field\Functional;
class ExtraFieldDisplayUITest extends ExtraFieldBrowserTestBase {
public static $modules = [
'extra_field',
'extra_field_test',
'node',
'field_ui',
];
protected $entityDisplay;
protected $manageDisplayUrl;
protected function setUp() {
parent::setUp();
$adminUser = $this
->drupalCreateUser([
'administer node display',
]);
$this
->drupalLogin($adminUser);
$this->entityDisplay['first_node_type'] = $this
->setupContentEntityDisplay('first_node_type');
$this->manageDisplayUrl['first_node_type'] = 'admin/structure/types/manage/first_node_type/display/teaser';
$this->entityDisplay['another_node_type'] = $this
->setupContentEntityDisplay('another_node_type');
$this->manageDisplayUrl['another_node_type'] = 'admin/structure/types/manage/another_node_type/display/teaser';
}
public function testOneNodeTypePlugin() {
$this
->drupalGet($this->manageDisplayUrl['first_node_type']);
$this
->assertSession()
->pageTextContains('Extra field for first node type');
$this
->assertSession()
->fieldValueEquals('fields[extra_field_one_node_type_test][region]', 'hidden');
$this
->assertSession()
->fieldValueEquals('fields[extra_field_one_node_type_test][weight]', '0');
$this
->drupalGet($this->manageDisplayUrl['another_node_type']);
$this
->assertSession()
->pageTextNotContains('Extra field for first node type');
}
public function testAllNodeTypesPlugin() {
$this
->drupalGet($this->manageDisplayUrl['first_node_type']);
$this
->assertSession()
->pageTextContains('Extra field for all node types');
$this
->assertSession()
->fieldValueEquals('fields[extra_field_all_node_types_test][region]', 'content');
$this
->assertSession()
->fieldValueEquals('fields[extra_field_all_node_types_test][weight]', '7');
$this
->drupalGet($this->manageDisplayUrl['another_node_type']);
$this
->assertSession()
->pageTextContains('Extra field for all node types');
}
}