You are here

public function BambooTwigLoaderTest::testEntity in Bamboo Twig 8

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

@covers Drupal\bamboo_twig_loaders\TwigExtension\Loader::loadEntity

File

tests/src/Functional/BambooTwigLoadersTest.php, line 86

Class

BambooTwigLoaderTest
Tests Loaders twig filters and functions.

Namespace

Drupal\Tests\bamboo_twig\Functional

Code

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

  // Entity article full loaded.
  $this
    ->assertElementPresent('.test-loaders div.loader-entity');
  $this
    ->assertElementPresent('.test-loaders div.loader-entity h2 a');
  $this
    ->assertElementContains('.test-loaders div.loader-entity h2 a', 'Hello, world!');
  $this
    ->assertLinkLabelExist('Hello, world!');
  $this
    ->assertLinkUrlExist('/node/' . $this->article
    ->id());
  $this
    ->assertElementPresent('.test-loaders div.loader-entity footer');
  $this
    ->assertElementContains('.test-loaders div.loader-entity footer', 'Submitted by');

  // Entity page teaser loaded.
  $this
    ->assertElementPresent('.test-loaders div.loader-entity-teaser');
  $this
    ->assertElementPresent('.test-loaders div.loader-entity-teaser h2 a');
  $this
    ->assertElementContains('.test-loaders div.loader-entity-teaser h2 a', 'Foo Bar');
  $this
    ->assertLinkLabelExist('Foo Bar');
  $this
    ->assertLinkUrlExist('/node/' . $this->page
    ->id());
  $this
    ->assertElementPresent('.test-loaders div.loader-entity-teaser footer');
  $this
    ->assertElementContains('.test-loaders div.loader-entity-teaser footer', 'Submitted by');
  $this
    ->assertLinkLabelExist('Read more');
}