function TermParentsTest::assertParentsUnchanged

Same name and namespace in other branches
  1. 9 core/modules/taxonomy/tests/src/Functional/TermParentsTest.php \Drupal\Tests\taxonomy\Functional\TermParentsTest::assertParentsUnchanged()
  2. 10 core/modules/taxonomy/tests/src/Functional/TermParentsTest.php \Drupal\Tests\taxonomy\Functional\TermParentsTest::assertParentsUnchanged()
  3. 11.x core/modules/taxonomy/tests/src/Functional/TermParentsTest.php \Drupal\Tests\taxonomy\Functional\TermParentsTest::assertParentsUnchanged()

Asserts that the parents of the term have not changed after saving.

Parameters

\Drupal\taxonomy\TermInterface $term: The term to check.

3 calls to TermParentsTest::assertParentsUnchanged()
TermParentsTest::doTestEditingSingleParent in core/modules/taxonomy/tests/src/Functional/TermParentsTest.php
Performs tests that edit terms with a single parent
TermParentsTest::testEditingParents in core/modules/taxonomy/tests/src/Functional/TermParentsTest.php
Tests editing the parents of existing terms.
TermParentsTest::testEditingParentsWithDisabledFormElement in core/modules/taxonomy/tests/src/Functional/TermParentsTest.php
Tests specifying parents when creating terms and a disabled parent form.

File

core/modules/taxonomy/tests/src/Functional/TermParentsTest.php, line 301

Class

TermParentsTest
Tests managing taxonomy parents through the user interface.

Namespace

Drupal\Tests\taxonomy\Functional

Code

protected function assertParentsUnchanged(TermInterface $term) {
    $saved_term = $this->termStorage
        ->load($term->id());
    $expected = $term->get('parent')
        ->getValue();
    $this->assertEquals($expected, $saved_term->get('parent')
        ->getValue());
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.