You are here

public function FieldLanguageTest::testField in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/language/src/Tests/Views/FieldLanguageTest.php \Drupal\language\Tests\Views\FieldLanguageTest::testField()

Tests the language field.

File

core/modules/language/src/Tests/Views/FieldLanguageTest.php, line 30
Contains \Drupal\language\Tests\Views\FieldLanguageTest.

Class

FieldLanguageTest
Tests the field language handler.

Namespace

Drupal\language\Tests\Views

Code

public function testField() {
  $view = Views::getView('test_view');
  $view
    ->setDisplay();
  $view->displayHandlers
    ->get('default')
    ->overrideOption('fields', array(
    'langcode' => array(
      'id' => 'langcode',
      'table' => 'views_test_data',
      'field' => 'langcode',
    ),
  ));
  $this
    ->executeView($view);
  $this
    ->assertEqual($view->field['langcode']
    ->advancedRender($view->result[0]), 'English');
  $this
    ->assertEqual($view->field['langcode']
    ->advancedRender($view->result[1]), 'Lolspeak');
}