You are here

protected function TaxonomyTermArgumentDepthTest::assertTermWithDepthResult in Drupal 9

Asserts the result of the view for the given arguments.

Parameters

array $expected: The expected views result.

int|string $tid: The term ID or IDs to use as an argument.

int $depth: The depth to search.

bool $break_phrase: Whether to break the argument up into multiple terms.

1 call to TaxonomyTermArgumentDepthTest::assertTermWithDepthResult()
TaxonomyTermArgumentDepthTest::testTermWithDepthFilter in core/modules/taxonomy/tests/src/Kernel/Views/TaxonomyTermArgumentDepthTest.php
Tests the terms with depth filter.

File

core/modules/taxonomy/tests/src/Kernel/Views/TaxonomyTermArgumentDepthTest.php, line 182

Class

TaxonomyTermArgumentDepthTest
Test the taxonomy term with depth argument.

Namespace

Drupal\Tests\taxonomy\Kernel\Views

Code

protected function assertTermWithDepthResult(array $expected, $tid, int $depth, bool $break_phrase = FALSE) : void {
  $this->view
    ->destroy();
  $this->view
    ->initDisplay();
  $arguments = $this->view->displayHandlers
    ->get('default')
    ->getOption('arguments');
  $arguments['term_node_tid_depth']['depth'] = $depth;
  $arguments['term_node_tid_depth']['break_phrase'] = $break_phrase;
  $this->view->displayHandlers
    ->get('default')
    ->setOption('arguments', $arguments);
  $this
    ->executeView($this->view, [
    $tid,
  ]);
  $this
    ->assertIdenticalResultsetHelper($this->view, $expected, [
    'nid' => 'nid',
  ], 'assertIdentical');
}