You are here

public function BambooTwigRenderTest::testField 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::testField()
  2. 8.2 tests/src/Functional/BambooTwigRenderTest.php \Drupal\Tests\bamboo_twig\Functional\BambooTwigRenderTest::testField()
  3. 8.4 tests/src/Functional/BambooTwigRenderTest.php \Drupal\Tests\bamboo_twig\Functional\BambooTwigRenderTest::testField()

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

File

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

Class

BambooTwigRenderTest
Tests Renders twig filters and functions.

Namespace

Drupal\Tests\bamboo_twig\Functional

Code

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

  // Entity node (article) title.
  $this
    ->assertElementPresent('.test-render div.render-field-node');
  $this
    ->assertElementContains('.test-render div.render-field-node', '<span>Hello, world!</span>');

  // Entity taxonomy term (term) name.
  $this
    ->assertElementPresent('.test-render div.render-field-taxonomy-term');
  $this
    ->assertElementContains('.test-render div.render-field-taxonomy-term', '<div>' . $this->term
    ->getName() . '</div>');

  // Entity file uri.
  $this
    ->assertElementPresent('.test-render div.render-field-file');
  $this
    ->assertElementContains('.test-render div.render-field-file', $this->file->filename->value);

  // Entity user username.
  $this
    ->assertElementPresent('.test-render div.render-field-user');
  $this
    ->assertElementContains('.test-render div.render-field-user', 'admin');
}