You are here

public function BambooTwigLoaderTest::testEntity in Bamboo Twig 8.3

Same name and namespace in other branches
  1. 8.5 tests/src/Functional/BambooTwigLoaderTest.php \Drupal\Tests\bamboo_twig\Functional\BambooTwigLoaderTest::testEntity()
  2. 8 tests/src/Functional/BambooTwigLoadersTest.php \Drupal\Tests\bamboo_twig\Functional\BambooTwigLoaderTest::testEntity()
  3. 8.2 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_loader\TwigExtension\Loader::loadEntity

File

tests/src/Functional/BambooTwigLoaderTest.php, line 78

Class

BambooTwigLoaderTest
Tests Loaders twig filters and functions.

Namespace

Drupal\Tests\bamboo_twig\Functional

Code

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

  // Load entity article.
  $this
    ->assertElementPresent('.test-loaders div.loader-entity-node');
  $this
    ->assertElementContains('.test-loaders div.loader-entity-node', $this->article
    ->getTitle());

  // Load entity taxonomy term.
  $this
    ->assertElementPresent('.test-loaders div.loader-entity-taxonomy-term');
  $this
    ->assertElementContains('.test-loaders div.loader-entity-taxonomy-term', $this->term
    ->getName());

  // Load entity file.
  $this
    ->assertElementPresent('.test-loaders div.loader-entity-file');
  $this
    ->assertElementContains('.test-loaders div.loader-entity-file', $this->file->filename->value);

  // Load entity user.
  $this
    ->assertElementPresent('.test-loaders div.loader-entity-user');
  $this
    ->assertElementContains('.test-loaders div.loader-entity-user', 'admin');
}