You are here

protected function MergeTermsTestBase::prepareTarget in Term Merge 8

Prepares the target provided by mergeTermFunctionsProvider for use.

Dataproviders run before the tests are set up and are therefore unable to create proper taxonomy terms. Which means we'll have to do so in the test.

Parameters

string $target: The label for the taxonomy term target.

Return value

\Drupal\taxonomy\Entity\Term|string A newly created term if the target was an empty string, the original string otherwise.

6 calls to MergeTermsTestBase::prepareTarget()
MergeTermsConfirmTest::buildForm in tests/src/Kernel/Form/MergeTermsConfirmTest.php
Tests the form build for the confirm form.
MergeTermsConfirmTest::submitFormInvokesCorrectTermMergerMethod in tests/src/Kernel/Form/MergeTermsConfirmTest.php
Tests the correct method is invoked on the term merger after confirmation.
MergeTermsConfirmTest::submitRedirectsToMergeRoute in tests/src/Kernel/Form/MergeTermsConfirmTest.php
Tests the redirect after merging terms.
TermMergerTermCrudTest::canOnlyMergeTermsInTheSameVocabulary in tests/src/Kernel/TermMergerTermCrudTest.php
Tests only taxonomy terms in the same vocabulary can be merged.
TermMergerTermCrudTest::mergedTermsAreDeleted in tests/src/Kernel/TermMergerTermCrudTest.php
Tests the merged terms are deleted after the migration.

... See full list

File

tests/src/Kernel/MergeTermsTestBase.php, line 124

Class

MergeTermsTestBase
Base class for Term merge kernel tests.

Namespace

Drupal\Tests\term_merge\Kernel

Code

protected function prepareTarget($target) {
  if (!empty($target)) {
    return $target;
  }
  return $this
    ->createTerm($this->vocabulary);
}