You are here

public function ArgumentLanguageTest::testArgument in Zircon Profile 8

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

Tests the language argument.

File

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

Class

ArgumentLanguageTest
Tests the argument language handler.

Namespace

Drupal\language\Tests\Views

Code

public function testArgument() {
  $view = Views::getView('test_view');
  foreach (array(
    'en' => 'John',
    'xx-lolspeak' => 'George',
  ) as $langcode => $name) {
    $view
      ->setDisplay();
    $view->displayHandlers
      ->get('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();
  }
}