You are here

protected function XAutoloadUnitTestCase::assertFinderSuggestions in X Autoload 7.5

Same name and namespace in other branches
  1. 7.3 lib/Drupal/xautoload/Tests/XAutoloadUnitTestCase.php \Drupal\xautoload\Tests\XAutoloadUnitTestCase::assertFinderSuggestions()
  2. 7.4 lib/Drupal/xautoload/Tests/XAutoloadUnitTestCase.php \Drupal\xautoload\Tests\XAutoloadUnitTestCase::assertFinderSuggestions()

Parameters

ClassFinder $finder:

string $class:

array $expectedSuggestions:

Return value

bool Result of the assertion

2 calls to XAutoloadUnitTestCase::assertFinderSuggestions()
XAutoloadUnitTestCase::testNamespaces in lib/Drupal/xautoload/Tests/XAutoloadUnitTestCase.php
XAutoloadUnitTestCase::testPrefixes in lib/Drupal/xautoload/Tests/XAutoloadUnitTestCase.php

File

lib/Drupal/xautoload/Tests/XAutoloadUnitTestCase.php, line 103

Class

XAutoloadUnitTestCase

Namespace

Drupal\xautoload\Tests

Code

protected function assertFinderSuggestions($finder, $class, array $expectedSuggestions) {
  $success = TRUE;
  for ($iAccept = 0; $iAccept < count($expectedSuggestions); ++$iAccept) {
    list($method_name, $file) = $expectedSuggestions[$iAccept];
    $api = new CollectFilesInjectedApi($class, $method_name, $file);
    $finder
      ->apiFindFile($api, $class);
    $suggestions = $api
      ->getSuggestions();
    $expected = array_slice($expectedSuggestions, 0, $iAccept + 1);
    $success = $success && $this
      ->assertEqualBlock($expected, $suggestions, "Finder suggestions for class <code>{$class}</code>:");
  }
  return $success;
}