You are here

public function BambooTwigRenderTest::testEntity in Bamboo Twig 8.5

Same name and namespace in other branches
  1. 8.2 tests/src/Functional/BambooTwigRenderTest.php \Drupal\Tests\bamboo_twig\Functional\BambooTwigRenderTest::testEntity()
  2. 8.3 tests/src/Functional/BambooTwigRenderTest.php \Drupal\Tests\bamboo_twig\Functional\BambooTwigRenderTest::testEntity()
  3. 8.4 tests/src/Functional/BambooTwigRenderTest.php \Drupal\Tests\bamboo_twig\Functional\BambooTwigRenderTest::testEntity()

@covers Drupal\bamboo_twig_loader\TwigExtension\Render::renderEntity

File

tests/src/Functional/BambooTwigRenderTest.php, line 92

Class

BambooTwigRenderTest
Tests Renders twig filters and functions.

Namespace

Drupal\Tests\bamboo_twig\Functional

Code

public function testEntity() {
  $this
    ->drupalGet('/bamboo-twig-render');

  // Asserts display mode are rendered properly.
  $this
    ->assertElementContains('.test-render div.render-entity-node-1 h2 a', 'News N°1');
  $this
    ->assertElementContains('.test-render div.render-entity-node-1 footer', 'Submitted by');
  $this
    ->assertElementContains('.test-render div.render-entity-node-1', 'Mot clé N°4');
  $this
    ->assertElementContains('.test-render div.render-entity-node-1-teaser h2 a', 'News N°1');
  $this
    ->assertElementContains('.test-render div.render-entity-node-1-teaser footer', 'Submitted by');
  $this
    ->assertElementContains('.test-render div.render-entity-node-1-teaser .links', 'Read more');

  // Asserts node translations works.
  $this
    ->assertElementContains('.test-render div.render-entity-node-2 h2 a', 'News N°2');
  $this
    ->assertElementContains('.test-render div.render-entity-node-2', 'Tag N°2');
  $this
    ->assertElementContains('.test-render div.render-entity-node-2-teaser h2 a', 'News N°2');
  $this
    ->assertElementContains('.test-render div.render-entity-node-3 h2 a', 'News N°3');
  $this
    ->assertElementContains('.test-render div.render-entity-node-3', 'Tag N°3');
  $this
    ->assertElementContains('.test-render div.render-entity-node-3-teaser h2 a', 'News N°3');
  $this
    ->assertElementContains('.test-render div.render-entity-node-4 h2 a', 'Article N°4');
  $this
    ->assertElementContains('.test-render div.render-entity-node-4', 'Tag N°1');
  $this
    ->assertElementContains('.test-render div.render-entity-node-4-teaser h2 a', 'Article N°4');
  $this
    ->assertElementContains('.test-render div.render-entity-node-5 h2 a', 'News N°5');
  $this
    ->assertElementContains('.test-render div.render-entity-node-5', 'Tag N°5');
  $this
    ->assertElementContains('.test-render div.render-entity-node-5-teaser h2 a', 'News N°5');

  // Asserts display mode are rendered properly.
  $this
    ->assertElementContains('.test-render div.render-entity-taxonomy-term-1 h2 a', 'Tag N°1');
  $this
    ->assertElementContains('.test-render div.render-entity-taxonomy-term-1-link h2 a', 'Tag N°1');

  // Asserts taxonomy translations works.
  $this
    ->assertElementContains('.test-render div.render-entity-taxonomy-term-2 h2 a', 'Tag N°2');
  $this
    ->assertElementContains('.test-render div.render-entity-taxonomy-term-2-link h2 a', 'Tag N°2');
  $this
    ->assertElementContains('.test-render div.render-entity-taxonomy-term-3 h2 a', 'Tag N°3');
  $this
    ->assertElementContains('.test-render div.render-entity-taxonomy-term-3-link h2 a', 'Tag N°3');
  $this
    ->assertElementContains('.test-render div.render-entity-taxonomy-term-4 h2 a', 'Mot clé N°4');
  $this
    ->assertElementContains('.test-render div.render-entity-taxonomy-term-4-link h2 a', 'Mot clé N°4');
  $this
    ->assertElementContains('.test-render div.render-entity-taxonomy-term-5 h2 a', 'Tag N°5');
  $this
    ->assertElementContains('.test-render div.render-entity-taxonomy-term-5-link h2 a', 'Tag N°5');

  // Entity user full loaded.
  $this
    ->assertElementContains('.test-render div.render-entity-user', 'Member for');

  // Entity user compact loaded.
  $this
    ->assertElementContains('.test-render div.render-entity-user-compact', 'Member for');
  $this
    ->drupalGet('/fr/bamboo-twig-render');

  // Asserts node translations works.
  $this
    ->assertElementContains('.test-render div.render-entity-node-1 h2 a', 'News N°1');
  $this
    ->assertElementContains('.test-render div.render-entity-node-1', 'Mot clé N°4');
  $this
    ->assertElementContains('.test-render div.render-entity-node-1-teaser h2 a', 'News N°1');
  $this
    ->assertElementContains('.test-render div.render-entity-node-2 h2 a', 'Article N°2');
  $this
    ->assertElementContains('.test-render div.render-entity-node-2', 'Mot clé N°2');
  $this
    ->assertElementContains('.test-render div.render-entity-node-2-teaser h2 a', 'Article N°2');
  $this
    ->assertElementContains('.test-render div.render-entity-node-3 h2 a', 'Article N°3');
  $this
    ->assertElementContains('.test-render div.render-entity-node-3', 'Mot clé N°3');
  $this
    ->assertElementContains('.test-render div.render-entity-node-3-teaser h2 a', 'Article N°3');
  $this
    ->assertElementContains('.test-render div.render-entity-node-4 h2 a', 'Article N°4');
  $this
    ->assertElementContains('.test-render div.render-entity-node-4', 'Tag N°1');
  $this
    ->assertElementContains('.test-render div.render-entity-node-4-teaser h2 a', 'Article N°4');
  $this
    ->assertElementContains('.test-render div.render-entity-node-5 h2 a', 'Article N°5');
  $this
    ->assertElementContains('.test-render div.render-entity-node-5', 'Mot clé N°5');
  $this
    ->assertElementContains('.test-render div.render-entity-node-5-teaser h2 a', 'Article N°5');

  // Asserts taxonomy translations works.
  $this
    ->assertElementContains('.test-render div.render-entity-taxonomy-term-1 h2 a', 'Tag N°1');
  $this
    ->assertElementContains('.test-render div.render-entity-taxonomy-term-1-link h2 a', 'Tag N°1');
  $this
    ->assertElementContains('.test-render div.render-entity-taxonomy-term-2 h2 a', 'Mot clé N°2');
  $this
    ->assertElementContains('.test-render div.render-entity-taxonomy-term-2-link h2 a', 'Mot clé N°2');
  $this
    ->assertElementContains('.test-render div.render-entity-taxonomy-term-3 h2 a', 'Mot clé N°3');
  $this
    ->assertElementContains('.test-render div.render-entity-taxonomy-term-3-link h2 a', 'Mot clé N°3');
  $this
    ->assertElementContains('.test-render div.render-entity-taxonomy-term-4 h2 a', 'Mot clé N°4');
  $this
    ->assertElementContains('.test-render div.render-entity-taxonomy-term-4-link h2 a', 'Mot clé N°4');
  $this
    ->assertElementContains('.test-render div.render-entity-taxonomy-term-5 h2 a', 'Mot clé N°5');
  $this
    ->assertElementContains('.test-render div.render-entity-taxonomy-term-5-link h2 a', 'Mot clé N°5');
  $this
    ->drupalGet('/de/bamboo-twig-render');

  // Asserts node translations works.
  $this
    ->assertElementContains('.test-render div.render-entity-node-1 h2 a', 'News N°1');
  $this
    ->assertElementContains('.test-render div.render-entity-node-1', 'Mot clé N°4');
  $this
    ->assertElementContains('.test-render div.render-entity-node-1-teaser h2 a', 'News N°1');
  $this
    ->assertElementContains('.test-render div.render-entity-node-2 h2 a', 'News N°2');
  $this
    ->assertElementContains('.test-render div.render-entity-node-2', 'Tag N°2');
  $this
    ->assertElementContains('.test-render div.render-entity-node-2-teaser h2 a', 'News N°2');
  $this
    ->assertElementContains('.test-render div.render-entity-node-3 h2 a', 'Artikel N°3');
  $this
    ->assertElementContains('.test-render div.render-entity-node-3', 'Stichworte N°3');
  $this
    ->assertElementContains('.test-render div.render-entity-node-3-teaser h2 a', 'Artikel N°3');
  $this
    ->assertElementContains('.test-render div.render-entity-node-4 h2 a', 'Article N°4');
  $this
    ->assertElementContains('.test-render div.render-entity-node-4', 'Tag N°1');
  $this
    ->assertElementContains('.test-render div.render-entity-node-4-teaser h2 a', 'Article N°4');
  $this
    ->assertElementContains('.test-render div.render-entity-node-5 h2 a', 'News N°5');
  $this
    ->assertElementContains('.test-render div.render-entity-node-5', 'Tag N°5');
  $this
    ->assertElementContains('.test-render div.render-entity-node-5-teaser h2 a', 'News N°5');

  // Asserts taxonomy translations works.
  $this
    ->assertElementContains('.test-render div.render-entity-taxonomy-term-1 h2 a', 'Tag N°1');
  $this
    ->assertElementContains('.test-render div.render-entity-taxonomy-term-1-link h2 a', 'Tag N°1');
  $this
    ->assertElementContains('.test-render div.render-entity-taxonomy-term-2 h2 a', 'Tag N°2');
  $this
    ->assertElementContains('.test-render div.render-entity-taxonomy-term-2-link h2 a', 'Tag N°2');
  $this
    ->assertElementContains('.test-render div.render-entity-taxonomy-term-3 h2 a', 'Stichworte N°3');
  $this
    ->assertElementContains('.test-render div.render-entity-taxonomy-term-3-link h2 a', 'Stichworte N°3');
  $this
    ->assertElementContains('.test-render div.render-entity-taxonomy-term-4 h2 a', 'Mot clé N°4');
  $this
    ->assertElementContains('.test-render div.render-entity-taxonomy-term-4-link h2 a', 'Mot clé N°4');
  $this
    ->assertElementContains('.test-render div.render-entity-taxonomy-term-5 h2 a', 'Tag N°5');
  $this
    ->assertElementContains('.test-render div.render-entity-taxonomy-term-5-link h2 a', 'Tag N°5');
}