diff --git a/core/modules/simpletest/src/Tests/SimpleTestTest.php b/core/modules/simpletest/src/Tests/SimpleTestTest.php index 7d39fe6..fe67c7c 100644 --- a/core/modules/simpletest/src/Tests/SimpleTestTest.php +++ b/core/modules/simpletest/src/Tests/SimpleTestTest.php @@ -86,8 +86,8 @@ class: Drupal\Core\Cache\MemoryBackendFactory * Ensures the tests selected through the web interface are run and displayed. */ function testWebTestRunner() { - $this->pass = t('SimpleTest pass.'); - $this->fail = t('SimpleTest fail.'); + $this->passMessage = t('SimpleTest pass.'); + $this->failMessage = t('SimpleTest fail.'); $this->valid_permission = 'access administration pages'; $this->invalid_permission = 'invalid permission'; @@ -119,6 +119,9 @@ function testWebTestRunner() { /** * Test to be run and the results confirmed. + * + * Here we force test results which must match the expected results from + * confirmStubResults(). */ function stubTest() { // Ensure the .htkey file exists since this is only created just before a @@ -133,17 +136,21 @@ function stubTest() { // This causes the first of the fifteen passes asserted in // confirmStubResults(). - $this->pass($this->pass); + $this->pass($this->passMessage); + // The first three fails are caused by enabling a non-existent module in - // setUp(). This causes the fourth of the five fails asserted in + // setUp(). + + // This causes the fourth of the five fails asserted in // confirmStubResults(). - $this->fail($this->fail); + $this->fail($this->failMessage); // This causes the second to fourth of the fifteen passes asserted in // confirmStubResults(). $user = $this->drupalCreateUser(array($this->valid_permission), 'SimpleTestTest'); // This causes the fifth of the five fails asserted in confirmStubResults(). $this->drupalCreateUser(array($this->invalid_permission)); + // Test logging in as a user. // This causes the fifth to ninth of the fifteen passes asserted in // confirmStubResults(). @@ -189,8 +196,8 @@ function assertNothing() { function confirmStubTestResults() { $this->assertAssertion(t('Enabled modules: %modules', array('%modules' => 'non_existent_module')), 'Other', 'Fail', 'SimpleTestTest.php', 'Drupal\simpletest\Tests\SimpleTestTest->setUp()'); - $this->assertAssertion($this->pass, 'Other', 'Pass', 'SimpleTestTest.php', 'Drupal\simpletest\Tests\SimpleTestTest->stubTest()'); - $this->assertAssertion($this->fail, 'Other', 'Fail', 'SimpleTestTest.php', 'Drupal\simpletest\Tests\SimpleTestTest->stubTest()'); + $this->assertAssertion($this->passMessage, 'Other', 'Pass', 'SimpleTestTest.php', 'Drupal\simpletest\Tests\SimpleTestTest->stubTest()'); + $this->assertAssertion($this->failMessage, 'Other', 'Fail', 'SimpleTestTest.php', 'Drupal\simpletest\Tests\SimpleTestTest->stubTest()'); $this->assertAssertion(t('Created permissions: @perms', array('@perms' => $this->valid_permission)), 'Role', 'Pass', 'SimpleTestTest.php', 'Drupal\simpletest\Tests\SimpleTestTest->stubTest()'); $this->assertAssertion(t('Invalid permission %permission.', array('%permission' => $this->invalid_permission)), 'Role', 'Fail', 'SimpleTestTest.php', 'Drupal\simpletest\Tests\SimpleTestTest->stubTest()');