You are here

public function TaxonomyDefaultArgumentTest::testNodePath in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/taxonomy/src/Tests/Views/TaxonomyDefaultArgumentTest.php \Drupal\taxonomy\Tests\Views\TaxonomyDefaultArgumentTest::testNodePath()

Tests the relationship.

File

core/modules/taxonomy/src/Tests/Views/TaxonomyDefaultArgumentTest.php, line 31
Contains \Drupal\taxonomy\Tests\Views\TaxonomyDefaultArgumentTest.

Class

TaxonomyDefaultArgumentTest
Tests the representative node relationship for terms.

Namespace

Drupal\taxonomy\Tests\Views

Code

public function testNodePath() {
  $view = Views::getView('taxonomy_default_argument_test');
  $request = Request::create($this->nodes[0]
    ->url());
  $request->server
    ->set('SCRIPT_NAME', $GLOBALS['base_path'] . 'index.php');
  $request->server
    ->set('SCRIPT_FILENAME', 'index.php');
  $response = $this->container
    ->get('http_kernel')
    ->handle($request, HttpKernelInterface::SUB_REQUEST);
  $view
    ->setRequest($request);
  $view
    ->setResponse($response);
  $view
    ->initHandlers();
  $expected = implode(',', array(
    $this->term1
      ->id(),
    $this->term2
      ->id(),
  ));
  $this
    ->assertEqual($expected, $view->argument['tid']
    ->getDefaultArgument());
}