public function BambooTwigLoaderTest::testEntity in Bamboo Twig 8.5
Same name and namespace in other branches
- 8 tests/src/Functional/BambooTwigLoadersTest.php \Drupal\Tests\bamboo_twig\Functional\BambooTwigLoaderTest::testEntity()
- 8.2 tests/src/Functional/BambooTwigLoaderTest.php \Drupal\Tests\bamboo_twig\Functional\BambooTwigLoaderTest::testEntity()
- 8.3 tests/src/Functional/BambooTwigLoaderTest.php \Drupal\Tests\bamboo_twig\Functional\BambooTwigLoaderTest::testEntity()
- 8.4 tests/src/Functional/BambooTwigLoaderTest.php \Drupal\Tests\bamboo_twig\Functional\BambooTwigLoaderTest::testEntity()
@covers Drupal\bamboo_twig_loader\TwigExtension\Loader::loadEntity
File
- tests/
src/ Functional/ BambooTwigLoaderTest.php, line 86
Class
- BambooTwigLoaderTest
- Tests Loaders twig filters and functions.
Namespace
Drupal\Tests\bamboo_twig\FunctionalCode
public function testEntity() {
$this
->drupalGet('/bamboo-twig-loader');
// Load entity article (node).
$this
->assertElementContains('.test-loaders div.loader-entity-node-1', 'News N°1');
$this
->assertElementContains('.test-loaders div.loader-entity-node-2', 'News N°2');
$this
->assertElementContains('.test-loaders div.loader-entity-node-3', 'News N°3');
$this
->assertElementContains('.test-loaders div.loader-entity-node-4', 'Article N°4');
$this
->assertElementContains('.test-loaders div.loader-entity-node-5', 'News N°5');
// Load entity tag (taxonomy).
$this
->assertElementContains('.test-loaders div.loader-entity-taxonomy-term-1', 'Tag N°1');
$this
->assertElementContains('.test-loaders div.loader-entity-taxonomy-term-2', 'Tag N°2');
$this
->assertElementContains('.test-loaders div.loader-entity-taxonomy-term-3', 'Tag N°3');
$this
->assertElementContains('.test-loaders div.loader-entity-taxonomy-term-4', 'Mot clé N°4');
$this
->assertElementContains('.test-loaders div.loader-entity-taxonomy-term-5', 'Tag N°5');
// Load entity article (node) referenced field.
// Referenced field will always display the entity in its own original lang.
$this
->assertElementContains('.test-loaders div.loader-entity-reference-field-1', 'Mot clé N°4');
$this
->assertElementContains('.test-loaders div.loader-entity-reference-field-2', 'Tag N°2');
$this
->assertElementContains('.test-loaders div.loader-entity-reference-field-3', 'Tag N°3');
$this
->assertElementContains('.test-loaders div.loader-entity-reference-field-4', 'Tag N°1');
$this
->assertElementContains('.test-loaders div.loader-entity-reference-field-5', 'Mot clé N°5');
// Load entity file.
$this
->assertSession()
->elementExists('css', '.test-loaders div.loader-entity-file');
$this
->assertElementContains('.test-loaders div.loader-entity-file', 'antistatique.jpg');
// Load entity user.
$this
->assertSession()
->elementExists('css', '.test-loaders div.loader-entity-user');
$this
->assertElementContains('.test-loaders div.loader-entity-user', 'admin');
$this
->drupalGet('/fr/bamboo-twig-loader');
// Load entity article (node) - French.
$this
->assertElementContains('.test-loaders div.loader-entity-node-1', 'News N°1');
$this
->assertElementContains('.test-loaders div.loader-entity-node-2', 'Article N°2');
$this
->assertElementContains('.test-loaders div.loader-entity-node-3', 'Article N°3');
$this
->assertElementContains('.test-loaders div.loader-entity-node-4', 'Article N°4');
$this
->assertElementContains('.test-loaders div.loader-entity-node-5', 'Article N°5');
// Load entity tag (taxonomy) - French.
$this
->assertElementContains('.test-loaders div.loader-entity-taxonomy-term-1', 'Tag N°1');
$this
->assertElementContains('.test-loaders div.loader-entity-taxonomy-term-2', 'Mot clé N°2');
$this
->assertElementContains('.test-loaders div.loader-entity-taxonomy-term-3', 'Mot clé N°3');
$this
->assertElementContains('.test-loaders div.loader-entity-taxonomy-term-4', 'Mot clé N°4');
$this
->assertElementContains('.test-loaders div.loader-entity-taxonomy-term-5', 'Mot clé N°5');
// Load entity article (node) referenced field - French.
// Referenced field will always display the entity in its own original lang.
$this
->assertElementContains('.test-loaders div.loader-entity-reference-field-1', 'Mot clé N°4');
$this
->assertElementContains('.test-loaders div.loader-entity-reference-field-2', 'Tag N°2');
$this
->assertElementContains('.test-loaders div.loader-entity-reference-field-3', 'Tag N°3');
$this
->assertElementContains('.test-loaders div.loader-entity-reference-field-4', 'Tag N°1');
$this
->assertElementContains('.test-loaders div.loader-entity-reference-field-5', 'Mot clé N°5');
$this
->drupalGet('/de/bamboo-twig-loader');
// Load entity article (node) - German.
$this
->assertElementContains('.test-loaders div.loader-entity-node-1', 'News N°1');
$this
->assertElementContains('.test-loaders div.loader-entity-node-2', 'News N°2');
$this
->assertElementContains('.test-loaders div.loader-entity-node-3', 'Artikel N°3');
$this
->assertElementContains('.test-loaders div.loader-entity-node-4', 'Article N°4');
$this
->assertElementContains('.test-loaders div.loader-entity-node-5', 'News N°5');
// Load entity tag (taxonomy) - German.
$this
->assertElementContains('.test-loaders div.loader-entity-taxonomy-term-1', 'Tag N°1');
$this
->assertElementContains('.test-loaders div.loader-entity-taxonomy-term-2', 'Tag N°2');
$this
->assertElementContains('.test-loaders div.loader-entity-taxonomy-term-3', 'Stichworte N°3');
$this
->assertElementContains('.test-loaders div.loader-entity-taxonomy-term-4', 'Mot clé N°4');
$this
->assertElementContains('.test-loaders div.loader-entity-taxonomy-term-5', 'Tag N°5');
// Load entity article (node) referenced field - German.
// Referenced field will always display the entity in its own original lang.
$this
->assertElementContains('.test-loaders div.loader-entity-reference-field-1', 'Mot clé N°4');
$this
->assertElementContains('.test-loaders div.loader-entity-reference-field-2', 'Tag N°2');
$this
->assertElementContains('.test-loaders div.loader-entity-reference-field-3', 'Tag N°3');
$this
->assertElementContains('.test-loaders div.loader-entity-reference-field-4', 'Tag N°1');
$this
->assertElementContains('.test-loaders div.loader-entity-reference-field-5', 'Mot clé N°5');
}