You are here

protected function TaxonomyTermArgumentTest::getSubjectUnderTest in Search API 8

Creates the plugin to test.

Parameters

string|null $argument: The argument to set on the plugin.

Return value

\Drupal\search_api\Plugin\views\argument\SearchApiTerm The subject under test.

5 calls to TaxonomyTermArgumentTest::getSubjectUnderTest()
TaxonomyTermArgumentTest::testReturnsArgumentIfInvalidTermIdIsPassed in tests/src/Unit/Views/TaxonomyTermArgumentTest.php
Tests that the set argument is returned when non existing ids are provided.
TaxonomyTermArgumentTest::testReturnsArgumentIfSet in tests/src/Unit/Views/TaxonomyTermArgumentTest.php
Tests that the set argument is returned when no value is provided.
TaxonomyTermArgumentTest::testReturnsCommaSeparatedNamesIfValidTermIdsArePassed in tests/src/Unit/Views/TaxonomyTermArgumentTest.php
Tests that a comma separated list of term labels is returned.
TaxonomyTermArgumentTest::testReturnsNullIfArgumentNotSet in tests/src/Unit/Views/TaxonomyTermArgumentTest.php
Tests that null is returned if no argument has been set for any reason.
TaxonomyTermArgumentTest::testReturnsTermNameIfValidTermIdIsPassed in tests/src/Unit/Views/TaxonomyTermArgumentTest.php
Tests that the term label is returned if an existing id is provided.

File

tests/src/Unit/Views/TaxonomyTermArgumentTest.php, line 147

Class

TaxonomyTermArgumentTest
Tests whether the SearchApiTerm argument plugin works correctly.

Namespace

Drupal\Tests\search_api\Unit\Views

Code

protected function getSubjectUnderTest($argument = NULL) {
  $plugin = new SearchApiTerm([], 'search_api_term', []);
  if ($argument !== NULL) {
    $plugin->argument_validated = TRUE;
    $plugin
      ->setArgument($argument);
  }
  return $plugin;
}