You are here

public function HierarchyNestedSetIntegrationTest::testNestedSetStorageMoveParent in Entity Reference Hierarchy 3.x

Same name and namespace in other branches
  1. 8.2 tests/src/Kernel/HierarchyNestedSetIntegrationTest.php \Drupal\Tests\entity_hierarchy\Kernel\HierarchyNestedSetIntegrationTest::testNestedSetStorageMoveParent()

Tests moving parents.

File

tests/src/Kernel/HierarchyNestedSetIntegrationTest.php, line 174

Class

HierarchyNestedSetIntegrationTest
Tests integration with entity_hierarchy.

Namespace

Drupal\Tests\entity_hierarchy\Kernel

Code

public function testNestedSetStorageMoveParent() {
  $child = $this
    ->createTestEntity($this->parent
    ->id(), 'Child 1', 1);
  $parent2 = $this
    ->createTestEntity(NULL, 'Parent 2');
  $parent2
    ->save();
  $this
    ->assertSimpleParentChild($child);
  $child
    ->set(static::FIELD_NAME, $parent2
    ->id());
  $child
    ->save();
  $this
    ->assertSimpleParentChild($child, $parent2);
}