You are here

function SimpleTestDiscoveryTestCase::testDiscoveryFunctions in Drupal 7

Test discovery of PSR-0 test classes.

File

modules/simpletest/simpletest.test, line 750
Tests for simpletest.module.

Class

SimpleTestDiscoveryTestCase
Verifies that tests in other installation profiles are not found.

Code

function testDiscoveryFunctions() {
  if (version_compare(PHP_VERSION, '5.3') < 0) {

    // Don't expect PSR-0 tests to be discovered on older PHP versions.
    return;
  }

  // TODO: What if we have cached values? Do we need to force a cache refresh?
  $classes_all = simpletest_test_get_all();
  foreach (array(
    'Drupal\\simpletest\\Tests\\PSR0WebTest',
    'Drupal\\simpletest\\Tests\\PSR4WebTest',
    'Drupal\\psr_0_test\\Tests\\ExampleTest',
    'Drupal\\psr_4_test\\Tests\\ExampleTest',
  ) as $class) {
    $this
      ->assert(!empty($classes_all['SimpleTest'][$class]), t('Class @class must be discovered by simpletest_test_get_all().', array(
      '@class' => $class,
    )));
  }
}