From cf8c025b3320b4643192a28b881f27f012b47d30 Mon Sep 17 00:00:00 2001 From: webchick Date: Thu, 3 Oct 2013 09:39:29 -0700 Subject: [PATCH] Issue #2080401 by Bladedu, mrsinguyen, lokapujya, pfrenssen: Remove Unused local variable from /core/modules/simpletest/lib/Drupal/simpletest/Tests/SimpleTestTest.php. --- .../lib/Drupal/simpletest/Tests/SimpleTestTest.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/core/modules/simpletest/lib/Drupal/simpletest/Tests/SimpleTestTest.php b/core/modules/simpletest/lib/Drupal/simpletest/Tests/SimpleTestTest.php index 180c58f46b2b..2a19a5c13c43 100644 --- a/core/modules/simpletest/lib/Drupal/simpletest/Tests/SimpleTestTest.php +++ b/core/modules/simpletest/lib/Drupal/simpletest/Tests/SimpleTestTest.php @@ -186,8 +186,8 @@ class SimpleTestTest extends WebTestBase { $this->pass(t('Test ID is @id.', array('@id' => $this->testId))); - // Generates a warning. - $i = 1 / 0; + // Call trigger_error() without the required argument to trigger an E_WARNING. + trigger_error(); // Call an assert function specific to that class. $this->assertNothing(); @@ -217,8 +217,9 @@ class SimpleTestTest extends WebTestBase { $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()'); - // Check that a warning is caught by simpletest. - $this->assertAssertion('Division by zero', 'Warning', 'Fail', 'SimpleTestTest.php', 'Drupal\simpletest\Tests\SimpleTestTest->stubTest()'); + // Check that a warning is caught by simpletest. The exact error message + // differs between PHP versions so only the function name is checked. + $this->assertAssertion('trigger_error()', 'Warning', 'Fail', 'SimpleTestTest.php', 'Drupal\simpletest\Tests\SimpleTestTest->stubTest()'); // Check that the backtracing code works for specific assert function. $this->assertAssertion('This is nothing.', 'Other', 'Pass', 'SimpleTestTest.php', 'Drupal\simpletest\Tests\SimpleTestTest->stubTest()');