public function ArgumentLanguageTest::testArgument

Tests the language argument.

File

drupal/core/modules/views/lib/Drupal/views/Tests/Language/ArgumentLanguageTest.php, line 37
Contains Drupal\views\Tests\Language\ArgumentLanguageTest.

Class

ArgumentLanguageTest
Tests the argument language handler.

Namespace

Drupal\views\Tests\Language

Code

public function testArgument() {
  $view = views_get_view('test_view');
  foreach (array(
    'en' => 'John',
    'xx-lolspeak' => 'George',
  ) as $langcode => $name) {
    $view
      ->setDisplay();
    $view->displayHandlers['default']
      ->overrideOption('arguments', array(
      'langcode' => array(
        'id' => 'langcode',
        'table' => 'views_test_data',
        'field' => 'langcode',
      ),
    ));
    $this
      ->executeView($view, array(
      $langcode,
    ));
    $expected = array(
      array(
        'name' => $name,
      ),
    );
    $this
      ->assertIdenticalResultset($view, $expected, array(
      'views_test_data_name' => 'name',
    ));
    $view
      ->destroy();
  }
}