ViewsTest.php in Entity Usage 8.4
File
tests/src/FunctionalJavascript/ViewsTest.php
View source
<?php
namespace Drupal\Tests\entity_usage\FunctionalJavascript;
use Drupal\node\Entity\Node;
class ViewsTest extends EntityUsageJavascriptTestBase {
protected static $modules = [
'views',
];
public function testViewsIntegration() {
$page = $this
->getSession()
->getPage();
$this
->drupalGet('/node/add/eu_test_ct');
$page
->fillField('title[0][value]', 'Node 1');
$page
->pressButton('Save');
$this
->assertSession()
->pageTextContains('eu_test_ct Node 1 has been created.');
$this
->saveHtmlOutput();
$this
->drupalGet('/node/add/eu_test_ct');
$page
->fillField('title[0][value]', 'Node 2');
$page
->fillField('field_eu_test_related_nodes[0][target_id]', 'Node 1 (1)');
$page
->pressButton('Save');
$this
->assertSession()
->pageTextContains('eu_test_ct Node 2 has been created.');
$node2 = Node::load(2);
$this
->saveHtmlOutput();
$this
->drupalGet('/node/add/eu_test_ct');
$page
->fillField('title[0][value]', 'Node 3');
$page
->fillField('field_eu_test_related_nodes[0][target_id]', 'Node 1 (1)');
$page
->pressButton('Save');
$this
->assertSession()
->pageTextContains('eu_test_ct Node 3 has been created.');
$this
->saveHtmlOutput();
$this
->drupalGet('/eu-basic-test-view');
$this
->assertSession()
->pageTextContains('Node 1');
$this
->assertSession()
->responseContains('<td headers="view-count-table-column" class="views-field views-field-count">2 </td>');
$node2
->delete();
$this
->drupalGet('/eu-basic-test-view');
$this
->assertSession()
->pageTextContains('Node 1');
$this
->assertSession()
->responseContains('<td headers="view-count-table-column" class="views-field views-field-count">1 </td>');
}
}
Classes
Name |
Description |
ViewsTest |
Basic tests for the views integration. |