You are here

public function BambooTwigLoaderTest::testField in Bamboo Twig 8.2

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

@covers Drupal\bamboo_twig_loader\TwigExtension\Loader::loadField

File

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

Class

BambooTwigLoaderTest
Tests Loaders twig filters and functions.

Namespace

Drupal\Tests\bamboo_twig\Functional

Code

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

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

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

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

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