You are here

public function HierarchyNestedSetIntegrationTest::testDeleteChild in Entity Reference Hierarchy 8.2

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

Tests deleting child node.

File

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

Class

HierarchyNestedSetIntegrationTest
Tests integration with entity_hierarchy.

Namespace

Drupal\Tests\entity_hierarchy\Kernel

Code

public function testDeleteChild() {
  $child = $this
    ->createTestEntity($this->parent
    ->id());
  $root_node = $this->treeStorage
    ->getNode($this->parentStub);
  $children = $this
    ->getChildren($root_node);
  $this
    ->assertCount(1, $children);
  $child
    ->delete();
  $children = $this
    ->getChildren($root_node);
  $this
    ->assertCount(0, $children);
}