You are here

protected function ClassLoaderTest::assertCandidateOrder in X Autoload 7.5

Same name and namespace in other branches
  1. 7.4 tests/lib/ClassLoaderTest.php \Drupal\xautoload\Tests\ClassLoaderTest::assertCandidateOrder()

Parameters

\Drupal\xautoload\ClassLoader\ClassLoaderInterface $loader:

string $classTemplate:

string[] $expectedCandidateTemplates:

4 calls to ClassLoaderTest::assertCandidateOrder()
ClassLoaderTest::testNamespaces in tests/src/ClassLoaderTest.php
Test PSR-0-like namespaces.
ClassLoaderTest::testPrefixes in tests/src/ClassLoaderTest.php
Test PEAR-like prefixes.
ClassLoaderTest::testPsr4 in tests/src/ClassLoaderTest.php
Test PSR-4-like namespaces.
ClassLoaderTest::testSpecialUnderscores in tests/src/ClassLoaderTest.php
Tests PEAR-like class names beginning with underscore, or with a double underscore in between.

File

tests/src/ClassLoaderTest.php, line 138

Class

ClassLoaderTest

Namespace

Drupal\xautoload\Tests

Code

protected function assertCandidateOrder($loader, $classTemplate, array $expectedCandidateTemplates) {
  for ($i = 0; $i < count($expectedCandidateTemplates); ++$i) {
    $class = $this
      ->replaceWildcard($classTemplate, "n{$i}");

    // If str_replace() is called with an array as 3rd parameter, it will do
    // the replacement on all array elements.
    $expectedCandidates = $this
      ->replaceWildcardMultiple(array_slice($expectedCandidateTemplates, 0, $i + 1), "n{$i}");
    $this
      ->assertFileInclusions($loader, $class, $expectedCandidates);
  }
}