You are here

public function ClassCollectionLoaderTest::testClassWithTraitsReordering in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony/class-loader/Tests/ClassCollectionLoaderTest.php \Symfony\Component\ClassLoader\Tests\ClassCollectionLoaderTest::testClassWithTraitsReordering()

@dataProvider getDifferentOrdersForTraits

File

vendor/symfony/class-loader/Tests/ClassCollectionLoaderTest.php, line 101

Class

ClassCollectionLoaderTest

Namespace

Symfony\Component\ClassLoader\Tests

Code

public function testClassWithTraitsReordering(array $classes) {
  if (PHP_VERSION_ID < 50400) {
    $this
      ->markTestSkipped('Requires PHP > 5.4');
    return;
  }
  require_once __DIR__ . '/Fixtures/ClassesWithParents/ATrait.php';
  require_once __DIR__ . '/Fixtures/ClassesWithParents/BTrait.php';
  require_once __DIR__ . '/Fixtures/ClassesWithParents/CTrait.php';
  require_once __DIR__ . '/Fixtures/ClassesWithParents/D.php';
  require_once __DIR__ . '/Fixtures/ClassesWithParents/E.php';
  $expected = array(
    'ClassesWithParents\\GInterface',
    'ClassesWithParents\\CInterface',
    'ClassesWithParents\\ATrait',
    'ClassesWithParents\\BTrait',
    'ClassesWithParents\\CTrait',
    'ClassesWithParents\\B',
    'ClassesWithParents\\A',
    'ClassesWithParents\\D',
    'ClassesWithParents\\E',
  );
  $r = new \ReflectionClass('Symfony\\Component\\ClassLoader\\ClassCollectionLoader');
  $m = $r
    ->getMethod('getOrderedClasses');
  $m
    ->setAccessible(true);
  $ordered = $m
    ->invoke('Symfony\\Component\\ClassLoader\\ClassCollectionLoader', $classes);
  $this
    ->assertEquals($expected, array_map(function ($class) {
    return $class
      ->getName();
  }, $ordered));
}