public function EntityconnectAdminTest::testButtonsAdmin in Entity connect 8.2
Entityconnect buttons admin test.
File
- tests/
src/ Functional/ EntityconnectAdminTest.php, line 58
Class
- EntityconnectAdminTest
- Tests the Entityconnect administration.
Namespace
Drupal\Tests\entityconnect\FunctionalCode
public function testButtonsAdmin() {
$this
->drupalLogin($this->ecUser);
// Open the create test page.
$this
->drupalGet(Url::fromRoute('node.add', [
'node_type' => $this->testContentType
->id(),
]));
// By default, the entityconnect buttons should not exist.
$this
->assertSession()
->elementNotExists('xpath', '//div[contains(@class, \'entityconnect-\')]/input');
$this
->drupalLogout();
// Edit the entity reference field.
$this
->drupalLogin($this->adminUser);
$this
->drupalGet("admin/structure/types/manage/{$this->testContentType->id()}/fields/node.{$this->testContentType->id()}.{$this->testRefField->getName()}");
// Check that the entity connect fields appear in the field edit form.
$this
->assertSession()
->pageTextContains('EntityConnect default Parameters');
// Enable the add and edit buttons.
$edit = [
'third_party_settings[entityconnect][buttons][button_add]' => '0',
'third_party_settings[entityconnect][buttons][button_edit]' => '0',
];
$this
->drupalPostForm(NULL, $edit, 'Save settings');
$this
->drupalLogout();
// Open the create test page.
$this
->drupalLogin($this->ecUser);
$this
->drupalGet('node/add/' . $this->testContentType
->id());
// Check that the entity connect buttons appear.
$this
->assertSession()
->elementExists('xpath', '//div[contains(@class, \'entityconnect-\')]/input');
}