379aed4499026af41190d6bea62e6d9933ab1148
[yaffs-website] / web / core / modules / simpletest / src / Tests / InstallationProfileModuleTestsTest.php
1 <?php
2
3 namespace Drupal\simpletest\Tests;
4
5 use Drupal\simpletest\WebTestBase;
6
7 /**
8  * Verifies that tests bundled with installation profile modules are found.
9  *
10  * @group simpletest
11  */
12 class InstallationProfileModuleTestsTest extends WebTestBase {
13
14   /**
15    * Modules to enable.
16    *
17    * @var array
18    */
19   public static $modules = ['simpletest'];
20
21   /**
22    * An administrative user with permission to adminsiter unit tests.
23    *
24    * @var \Drupal\user\UserInterface
25    */
26   protected $adminUser;
27
28   /**
29    * Use the Testing profile.
30    *
31    * The Testing profile contains drupal_system_listing_compatible_test.test,
32    * which attempts to:
33    * - run tests using the Minimal profile (which does not contain the
34    *   drupal_system_listing_compatible_test.module)
35    * - but still install the drupal_system_listing_compatible_test.module
36    *   contained in the Testing profile.
37    *
38    * @see \Drupal\drupal_system_listing_compatible_test\Tests\SystemListingCompatibleTest
39    */
40   protected $profile = 'testing';
41
42   protected function setUp() {
43     parent::setUp();
44
45     $this->adminUser = $this->drupalCreateUser(['administer unit tests']);
46     $this->drupalLogin($this->adminUser);
47   }
48
49   /**
50    * Tests existence of test case located in an installation profile module.
51    */
52   public function testInstallationProfileTests() {
53     $this->drupalGet('admin/config/development/testing');
54     $this->assertText('Drupal\drupal_system_listing_compatible_test\Tests\SystemListingCompatibleTest');
55     $edit = [
56       'tests[Drupal\drupal_system_listing_compatible_test\Tests\SystemListingCompatibleTest]' => TRUE,
57     ];
58     $this->drupalPostForm(NULL, $edit, t('Run tests'));
59     $this->assertText('SystemListingCompatibleTest test executed.');
60   }
61
62 }