You are here

public function FieldFieldTest::testSimpleRender 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::testSimpleRender()

Tests the output of a view with base fields and configurable fields.

File

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

Class

FieldFieldTest
Provides some integration tests for the Field handler.

Namespace

Drupal\views\Tests\Handler

Code

public function testSimpleRender() {
  $executable = Views::getView('test_field_field_test');
  $executable
    ->execute();
  $this
    ->assertEqual('1', $executable
    ->getStyle()
    ->getField(0, 'id'));
  $this
    ->assertEqual('3', $executable
    ->getStyle()
    ->getField(0, 'field_test'));
  $this
    ->assertEqual('2', $executable
    ->getStyle()
    ->getField(1, 'id'));

  // @todo Switch this assertion to assertIdentical('', ...) when
  //   https://www.drupal.org/node/2488006 gets fixed.
  $this
    ->assertEqual('0', $executable
    ->getStyle()
    ->getField(1, 'field_test'));
  $this
    ->assertEqual('3', $executable
    ->getStyle()
    ->getField(2, 'id'));
  $this
    ->assertEqual('8', $executable
    ->getStyle()
    ->getField(2, 'field_test'));
  $this
    ->assertEqual('4', $executable
    ->getStyle()
    ->getField(3, 'id'));
  $this
    ->assertEqual('5', $executable
    ->getStyle()
    ->getField(3, 'field_test'));
  $this
    ->assertEqual('5', $executable
    ->getStyle()
    ->getField(4, 'id'));
  $this
    ->assertEqual('6', $executable
    ->getStyle()
    ->getField(4, 'field_test'));
}