You are here

public function FieldFieldTest::testFieldAliasRender in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/views/src/Tests/Handler/FieldFieldTest.php \Drupal\views\Tests\Handler\FieldFieldTest::testFieldAliasRender()

Tests the result of a view with complex field configuration.

A complex field configuration contains multiple times the same field, with different delta limit / offset.

File

core/modules/views/src/Tests/Handler/FieldFieldTest.php, line 325
Contains \Drupal\views\Tests\Handler\FieldFieldTest.

Class

FieldFieldTest
Provides some integration tests for the Field handler.

Namespace

Drupal\views\Tests\Handler

Code

public function testFieldAliasRender() {
  $executable = Views::getView('test_field_alias_test');
  $executable
    ->execute();
  for ($i = 0; $i < 5; $i++) {
    $this
      ->assertEqual((string) ($i + 1), $executable
      ->getStyle()
      ->getField($i, 'id'));
    $this
      ->assertEqual('test ' . $i, $executable
      ->getStyle()
      ->getField($i, 'name'));
    $entity = EntityTest::load($i + 1);
    $this
      ->assertEqual('<a href="' . $entity
      ->url() . '" hreflang="' . $entity
      ->language()
      ->getId() . '">test ' . $i . '</a>', (string) $executable
      ->getStyle()
      ->getField($i, 'name_alias'));
  }
}