function FinderTest::testFoundDataIsInDependencyOrder

Same name in other branches
  1. 11.x core/tests/Drupal/Tests/Core/DefaultContent/FinderTest.php \Drupal\Tests\Core\DefaultContent\FinderTest::testFoundDataIsInDependencyOrder()

Tests that any discovered entity data is sorted into dependency order.

File

core/tests/Drupal/Tests/Core/DefaultContent/FinderTest.php, line 21

Class

FinderTest
@covers \Drupal\Core\DefaultContent\Finder @group DefaultContent

Namespace

Drupal\Tests\Core\DefaultContent

Code

public function testFoundDataIsInDependencyOrder() : void {
    $finder = new Finder(__DIR__ . '/../../../../fixtures/default_content');
    $expected_order = [
        // First is the author of the node.
'94503467-be7f-406c-9795-fc25baa22203',
        // Next, the taxonomy term referenced by the node.
'550f86ad-aa11-4047-953f-636d42889f85',
        // Then we have the node itself, since it has no other dependencies.
'e1714f23-70c0-4493-8e92-af1901771921',
        // Finally, the menu link to the node.
'3434bd5a-d2cd-4f26-bf79-a7f6b951a21b',
    ];
    $this->assertSame($expected_order, array_slice(array_keys($finder->data), 0, 4));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.