Commit 3e26a249 authored by catch's avatar catch

Issue #2217781 by alexpott: Can only run tests from the installed profile.

parent 53ef54c6
......@@ -2,7 +2,7 @@
/**
* @file
* Definition of \Drupal\simpletest\Tests\OtherInstallationProfileModuleTestsTest.
* Contains \Drupal\simpletest\Tests\OtherInstallationProfileTestsTest.
*/
namespace Drupal\simpletest\Tests;
......@@ -10,11 +10,11 @@
use Drupal\simpletest\WebTestBase;
/**
* Verifies that tests in other installation profiles are not found.
* Verifies that tests in other installation profiles are found.
*
* @see SimpleTestInstallationProfileModuleTestsTestCase
*/
class OtherInstallationProfileModuleTestsTest extends WebTestBase {
class OtherInstallationProfileTestsTest extends WebTestBase {
/**
* Modules to enable.
......@@ -27,9 +27,12 @@ class OtherInstallationProfileModuleTestsTest extends WebTestBase {
* Use the Minimal profile.
*
* The Testing profile contains drupal_system_listing_compatible_test.test,
* which should not be found.
* which should be found.
*
* @see SimpleTestInstallationProfileModuleTestsTestCase
* The Standard profile contains \Drupal\standard\Tests\StandardTest, which
* should be found.
*
* @see \Drupal\simpletest\Tests\InstallationProfileModuleTestsTest
* @see \Drupal\drupal_system_listing_compatible_test\Tests\SystemListingCompatibleTest
*/
protected $profile = 'minimal';
......@@ -37,7 +40,7 @@ class OtherInstallationProfileModuleTestsTest extends WebTestBase {
public static function getInfo() {
return array(
'name' => 'Other Installation profiles',
'description' => 'Verifies that tests in other installation profiles are not found.',
'description' => 'Verifies that tests in modules contained in other installation profiles are found.',
'group' => 'SimpleTest',
);
}
......@@ -50,10 +53,18 @@ function setUp() {
}
/**
* Tests that tests located in another installation profile do not appear.
* Tests that tests located in another installation profile appear.
*/
function testOtherInstallationProfile() {
// Assert the existence of a test in a different installation profile than
// the current.
$this->drupalGet('admin/config/development/testing');
$this->assertText('Tests Standard installation profile expectations.');
// Assert the existence of a test for a module in a different installation
// profile than the current.
$this->drupalGet('admin/config/development/testing');
$this->assertNoText('Installation profile module tests helper');
$this->assertText('Installation profile module tests helper');
}
}
......@@ -448,6 +448,8 @@ function simpletest_test_get_all($module = NULL) {
else {
// Select all PSR-0 classes in the Tests namespace of all modules.
$listing = new ExtensionDiscovery();
// Ensure that tests in all profiles are discovered.
$listing->setProfileDirectories(array());
$all_data = $listing->scan('module', TRUE);
// If module is set then we keep only that one module.
if (isset($module)) {
......@@ -549,6 +551,8 @@ function simpletest_classloader_register() {
}
else {
$listing = new ExtensionDiscovery();
// Ensure that tests in all profiles are discovered.
$listing->setProfileDirectories(array());
$extensions = array();
foreach ($types as $type) {
foreach ($listing->scan($type, TRUE) as $name => $file) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment