You are here

public function HierarchyNestedSetIntegrationTest::testDeleteChildWithGrandChildren 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::testDeleteChildWithGrandChildren()

Tests deleting child node with grandchildren.

File

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

Class

HierarchyNestedSetIntegrationTest
Tests integration with entity_hierarchy.

Namespace

Drupal\Tests\entity_hierarchy\Kernel

Code

public function testDeleteChildWithGrandChildren() {
  $child = $this
    ->createTestEntity($this->parent
    ->id());
  $grand_child = $this
    ->createTestEntity($child
    ->id(), 'Grandchild 1', 1);
  $this
    ->assertSimpleParentChild($child);
  $this
    ->assertSimpleParentChild($grand_child, $child, 1);
  $child
    ->delete();
  $this
    ->assertSimpleParentChild($grand_child, $this->parent);
}