From 971135d0b012e8b200251fb82f6d4a5eee47d533 Mon Sep 17 00:00:00 2001 From: Nathaniel Catchpole <catch@35733.no-reply.drupal.org> Date: Thu, 13 Feb 2014 15:43:12 +0000 Subject: [PATCH] Issue #1813286 by sun: _simpletest_format_summary_line() should not use t(). --- .../Drupal/simpletest/Tests/SimpleTestTest.php | 2 +- core/modules/simpletest/simpletest.module | 18 ++++++++---------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/core/modules/simpletest/lib/Drupal/simpletest/Tests/SimpleTestTest.php b/core/modules/simpletest/lib/Drupal/simpletest/Tests/SimpleTestTest.php index 7c8c6f818889..4a105467602b 100644 --- a/core/modules/simpletest/lib/Drupal/simpletest/Tests/SimpleTestTest.php +++ b/core/modules/simpletest/lib/Drupal/simpletest/Tests/SimpleTestTest.php @@ -233,7 +233,7 @@ function confirmStubTestResults() { $this->assertAssertion("Debug: 'Foo'", 'Debug', 'Fail', 'SimpleTestTest.php', 'Drupal\simpletest\Tests\SimpleTestTest->stubTest()'); - $this->assertEqual('6 passes, 5 fails, 2 exceptions, and 1 debug message', $this->childTestResults['summary'], 'Stub test summary is correct'); + $this->assertEqual('6 passes, 5 fails, 2 exceptions, 1 debug message', $this->childTestResults['summary'], 'Stub test summary is correct'); $this->test_ids[] = $test_id = $this->getTestIdFromResults(); $this->assertTrue($test_id, 'Found test ID in results.'); diff --git a/core/modules/simpletest/simpletest.module b/core/modules/simpletest/simpletest.module index 74d92c0384ab..3571da963858 100644 --- a/core/modules/simpletest/simpletest.module +++ b/core/modules/simpletest/simpletest.module @@ -103,16 +103,14 @@ function simpletest_js_alter(&$javascript) { } function _simpletest_format_summary_line($summary) { - $args = array( - '@pass' => format_plural(isset($summary['#pass']) ? $summary['#pass'] : 0, '1 pass', '@count passes'), - '@fail' => format_plural(isset($summary['#fail']) ? $summary['#fail'] : 0, '1 fail', '@count fails'), - '@exception' => format_plural(isset($summary['#exception']) ? $summary['#exception'] : 0, '1 exception', '@count exceptions'), - ); - if (!$summary['#debug']) { - return t('@pass, @fail, and @exception', $args); - } - $args['@debug'] = format_plural(isset($summary['#debug']) ? $summary['#debug'] : 0, '1 debug message', '@count debug messages'); - return t('@pass, @fail, @exception, and @debug', $args); + $parts = array(); + $parts[] = $summary['#pass'] == 1 ? '1 pass' : $summary['#pass'] . ' passes'; + $parts[] = $summary['#fail'] == 1 ? '1 fail' : $summary['#fail'] . ' fails'; + $parts[] = $summary['#exception'] == 1 ? '1 exception' : $summary['#exception'] . ' exceptions'; + if ($summary['#debug']) { + $parts[] = $summary['#debug'] == 1 ? '1 debug message' : $summary['#debug'] . ' debug messages'; + } + return implode(', ', $parts); } /** -- GitLab