html_title-8.x-1.x-dev/tests/src/Functional/NodeHtmlTitleTest.php
tests/src/Functional/NodeHtmlTitleTest.php
<?php
namespace Drupal\Tests\html_title\Functional;
use Drupal\Tests\BrowserTestBase;
use Drupal\Tests\field\Traits\EntityReferenceFieldCreationTrait;
use Drupal\Tests\taxonomy\Traits\TaxonomyTestTrait;
/**
* Tests the HTML Title integration with Views.
*
* @group html_title
*/
class NodeHtmlTitleTest extends BrowserTestBase {
use TaxonomyTestTrait;
use EntityReferenceFieldCreationTrait;
/**
* {@inheritdoc}
*/
protected static $modules = [
'html_title',
'html_title_test',
'views',
'views_ui',
'node',
'taxonomy',
'user',
];
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* {@inheritdoc}
*/
protected function setUp(): void {
parent::setUp();
$this->drupalCreateContentType(['type' => 'article']);
$vocabulary = $this->createVocabulary();
$term = $this->createTerm($vocabulary);
// Create an entity reference field on taxonomy terms referencing nodes.
$this->createEntityReferenceField(
'taxonomy_term',
$term->bundle(),
'field_node',
'Reference to Node',
'node',
'default:node',
['target_bundles' => ['article']]
);
$admin = $this->drupalCreateUser();
$this->drupalLogin($admin);
}
/**
* Tests that a view with empty rendered results does not break the page.
*/
public function testEmptyRendered(): void {
// Use the configured test view with taxonomy referencing nodes.
$this->drupalGet('/test-empty-rendered-3537729');
$this->assertSession()->statusCodeEquals(200);
}
}
