You are here

FieldLanguageTest.php in Zircon Profile 8

Same filename and directory in other branches
  1. 8.0 core/modules/language/src/Tests/Views/FieldLanguageTest.php

File

core/modules/language/src/Tests/Views/FieldLanguageTest.php
View source
<?php

/**
 * @file
 * Contains \Drupal\language\Tests\Views\FieldLanguageTest.
 */
namespace Drupal\language\Tests\Views;

use Drupal\views\Views;

/**
 * Tests the field language handler.
 *
 * @group language
 * @see \Drupal\language\Plugin\views\field\Language
 */
class FieldLanguageTest extends LanguageTestBase {

  /**
   * Views used by this test.
   *
   * @var array
   */
  public static $testViews = array(
    'test_view',
  );

  /**
   * Tests the language field.
   */
  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');
  }

}

Classes

Namesort descending Description
FieldLanguageTest Tests the field language handler.