You are here

public function TaxonomyDefaultArgumentTest::testTermPath in Zircon Profile 8

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

File

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

Class

TaxonomyDefaultArgumentTest
Tests the representative node relationship for terms.

Namespace

Drupal\taxonomy\Tests\Views

Code

public function testTermPath() {
  $view = Views::getView('taxonomy_default_argument_test');
  $request = Request::create($this->term1
    ->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 = $this->term1
    ->id();
  $this
    ->assertEqual($expected, $view->argument['tid']
    ->getDefaultArgument());
}