public function HierarchyNestedSetIntegrationTest::testNestedSetStorageMoveParentWithSiblingOrdering 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::testNestedSetStorageMoveParentWithSiblingOrdering()
Tests moving parents with weight ordering.
@group entity_hierarchy_ordering
File
- tests/
src/ Kernel/ HierarchyNestedSetIntegrationTest.php, line 204
Class
- HierarchyNestedSetIntegrationTest
- Tests integration with entity_hierarchy.
Namespace
Drupal\Tests\entity_hierarchy\KernelCode
public function testNestedSetStorageMoveParentWithSiblingOrdering() {
$child = $this
->createTestEntity($this->parent
->id(), 'Cousin 1', -2);
$parent2 = $this
->createTestEntity(NULL, 'Parent 2');
$child_entities = $this
->createChildEntities($parent2
->id(), 5);
$child_entities['Cousin 1'] = $child;
$this
->assertSimpleParentChild($child);
$child
->set(static::FIELD_NAME, $parent2
->id());
$child
->save();
$this
->assertChildOrder($this->treeStorage
->getNode($this->nodeFactory
->fromEntity($parent2)), $child_entities, [
'Child 5',
'Child 4',
'Child 3',
'Child 2',
'Cousin 1',
'Child 1',
]);
}