public function HierarchyNestedSetIntegrationTest::testRemoveParentReferenceWithGrandChildren in Entity Reference Hierarchy 8.2
Same name and namespace in other branches
- 3.x tests/src/Kernel/HierarchyNestedSetIntegrationTest.php \Drupal\Tests\entity_hierarchy\Kernel\HierarchyNestedSetIntegrationTest::testRemoveParentReferenceWithGrandChildren()
Tests removing parent reference with grandchildren.
File
- tests/
src/ Kernel/ HierarchyNestedSetIntegrationTest.php, line 136
Class
- HierarchyNestedSetIntegrationTest
- Tests integration with entity_hierarchy.
Namespace
Drupal\Tests\entity_hierarchy\KernelCode
public function testRemoveParentReferenceWithGrandChildren() {
$child = $this
->createTestEntity($this->parent
->id());
$grand_child = $this
->createTestEntity($child
->id(), 'Grandchild 1', 1);
$root_node = $this->treeStorage
->getNode($this->parentStub);
$this
->assertSimpleParentChild($child);
$this
->assertSimpleParentChild($grand_child, $child, 1);
$child
->set(static::FIELD_NAME, NULL);
$child
->save();
$children = $this
->getChildren($root_node);
$this
->assertCount(0, $children);
// Should now be at top level.
$this
->assertSimpleParentChild($grand_child, $child);
}