You are here

public function BambooTwigRenderTest::testEntity in Bamboo Twig 8.3

Same name and namespace in other branches
  1. 8.5 tests/src/Functional/BambooTwigRenderTest.php \Drupal\Tests\bamboo_twig\Functional\BambooTwigRenderTest::testEntity()
  2. 8.2 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 98

Class

BambooTwigRenderTest
Tests Renders twig filters and functions.

Namespace

Drupal\Tests\bamboo_twig\Functional

Code

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

  // Entity node (article) full loaded.
  $this
    ->assertElementPresent('.test-render div.render-entity-node');
  $this
    ->assertElementPresent('.test-render div.render-entity-node h2 a');
  $this
    ->assertElementContains('.test-render div.render-entity-node h2 a', $this->article
    ->getTitle());
  $this
    ->assertElementPresent('.test-render div.render-entity-node footer');
  $this
    ->assertElementContains('.test-render div.render-entity-node footer', 'Submitted by');

  // Entity node (article) teaser loaded.
  $this
    ->assertElementPresent('.test-render div.render-entity-node-teaser');
  $this
    ->assertElementPresent('.test-render div.render-entity-node-teaser h2 a');
  $this
    ->assertElementContains('.test-render div.render-entity-node-teaser h2 a', $this->article
    ->getTitle());
  $this
    ->assertElementPresent('.test-render div.render-entity-node-teaser footer');
  $this
    ->assertElementContains('.test-render div.render-entity-node-teaser footer', 'Submitted by');
  $this
    ->assertElementContains('.test-render div.render-entity-node-teaser .links', 'Read more');

  // Entity taxonomy term (term) full loaded.
  $this
    ->assertElementPresent('.test-render div.render-entity-taxonomy-term');
  $this
    ->assertElementPresent('.test-render div.render-entity-taxonomy-term h2 a');
  $this
    ->assertElementContains('.test-render div.render-entity-taxonomy-term h2 a', $this->term
    ->getName());

  // Entity taxonomy term (term) link loaded.
  $this
    ->assertElementPresent('.test-render div.render-entity-taxonomy-term-link');
  $this
    ->assertElementPresent('.test-render div.render-entity-taxonomy-term-link h2 a');
  $this
    ->assertElementContains('.test-render div.render-entity-taxonomy-term-link h2 a', $this->term
    ->getName());

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

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