summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2008-05-10 06:55:09 +0000
committerDries Buytaert <dries@buytaert.net>2008-05-10 06:55:09 +0000
commitbdf980c40b7a3f92dd7ac291699e1435592b1301 (patch)
treec8e373b58ba2136ab286a154b371363e84e03b33
parenta96ffc1185146676a05579471fb66d2ef1395284 (diff)
downloadbrdo-bdf980c40b7a3f92dd7ac291699e1435592b1301.tar.gz
brdo-bdf980c40b7a3f92dd7ac291699e1435592b1301.tar.bz2
- Patch by boombatower: fixed code style of simpletests.
-rw-r--r--modules/simpletest/drupal_reporter.php4
-rw-r--r--modules/simpletest/drupal_web_test_case.php42
-rw-r--r--modules/simpletest/dumper.php2
-rw-r--r--modules/simpletest/expectation.php4
-rw-r--r--modules/simpletest/reporter.php6
-rw-r--r--modules/simpletest/simpletest.install8
-rw-r--r--modules/simpletest/simpletest.module36
-rw-r--r--modules/simpletest/simpletest.php22
-rw-r--r--modules/simpletest/test_case.php6
-rw-r--r--modules/simpletest/unit_tester.php20
-rw-r--r--modules/simpletest/xml.php4
11 files changed, 82 insertions, 72 deletions
diff --git a/modules/simpletest/drupal_reporter.php b/modules/simpletest/drupal_reporter.php
index 8885dfbe4..7664925f6 100644
--- a/modules/simpletest/drupal_reporter.php
+++ b/modules/simpletest/drupal_reporter.php
@@ -23,7 +23,7 @@ class DrupalReporter extends SimpleReporter {
function DrupalReporter($character_set = 'ISO-8859-1') {
$this->SimpleReporter();
- drupal_add_css(drupal_get_path('module', 'simpletest') .'/simpletest.css');
+ drupal_add_css(drupal_get_path('module', 'simpletest') . '/simpletest.css');
$this->_character_set = $character_set;
}
@@ -226,7 +226,7 @@ class DrupalReporter extends SimpleReporter {
if (!$weight) {
$weight = $this->weight++;
}
- $write['content'.$this->content_count++] = array(
+ $write['content' . $this->content_count++] = array(
'#value' => '<div class=' . $class .'>' . $msg . '</div>',
'#weight' => $weight,
);
diff --git a/modules/simpletest/drupal_web_test_case.php b/modules/simpletest/drupal_web_test_case.php
index 782666375..822750afe 100644
--- a/modules/simpletest/drupal_web_test_case.php
+++ b/modules/simpletest/drupal_web_test_case.php
@@ -135,8 +135,8 @@ class DrupalWebTestCase extends UnitTestCase {
// Make sure type is valid.
if (in_array($type, array('binary', 'html', 'image', 'javascript', 'php', 'sql', 'text'))) {
// Use original file directory instead of one created during setUp().
- $path = $this->original_file_directory .'/simpletest';
- $files = file_scan_directory($path, $type .'\-.*');
+ $path = $this->original_file_directory . '/simpletest';
+ $files = file_scan_directory($path, $type . '\-.*');
// If size is set then remove any files that are not of that size.
if ($size !== NULL) {
@@ -203,6 +203,11 @@ class DrupalWebTestCase extends UnitTestCase {
menu_rebuild();
cache_clear_all('schema', 'cache');
module_rebuild_cache();
+
+ if (module_exists($name)) {
+ $this->pass(t('@name enabled.', array('@name' => $name)), t('Module'));
+ return TRUE;
+ }
}
/**
@@ -227,6 +232,11 @@ class DrupalWebTestCase extends UnitTestCase {
menu_rebuild();
cache_clear_all('schema', 'cache');
module_rebuild_cache();
+
+ if (!module_exists($name)) {
+ $this->pass(t('@name disabled.', array('@name' => $name)), t('Module'));
+ return TRUE;
+ }
}
/**
@@ -247,7 +257,7 @@ class DrupalWebTestCase extends UnitTestCase {
// Create a user assigned to that role.
$edit = array();
$edit['name'] = $this->randomName();
- $edit['mail'] = $edit['name'] .'@example.com';
+ $edit['mail'] = $edit['name'] . '@example.com';
$edit['roles'] = array($rid => $rid);
$edit['pass'] = user_password();
$edit['status'] = 1;
@@ -355,7 +365,7 @@ class DrupalWebTestCase extends UnitTestCase {
global $db_prefix;
$this->db_prefix_original = $db_prefix;
$clean_url_original = variable_get('clean_url', 0);
- $db_prefix = 'simpletest'. mt_rand(1000, 1000000);
+ $db_prefix = 'simpletest' . mt_rand(1000, 1000000);
include_once './includes/install.inc';
drupal_install_system();
$modules = array_unique(array_merge(func_get_args(), drupal_verify_profile('default', 'en')));
@@ -373,7 +383,7 @@ class DrupalWebTestCase extends UnitTestCase {
// Use temporary files directory with the same prefix as database.
$this->original_file_directory = file_directory_path();
- variable_set('file_directory_path', file_directory_path() .'/'. $db_prefix);
+ variable_set('file_directory_path', file_directory_path() . '/' . $db_prefix);
file_check_directory(file_directory_path(), TRUE); // Create the files directory.
parent::setUp();
}
@@ -436,7 +446,7 @@ class DrupalWebTestCase extends UnitTestCase {
}
if (!isset($curl_options[CURLOPT_USERPWD]) && ($auth = variable_get('simpletest_httpauth_username', ''))) {
if ($pass = variable_get('simpletest_httpauth_pass', '')) {
- $auth .= ':'. $pass;
+ $auth .= ':' . $pass;
}
$curl_options[CURLOPT_USERPWD] = $auth;
}
@@ -560,7 +570,7 @@ class DrupalWebTestCase extends UnitTestCase {
}
}
foreach ($upload as $key => $file) {
- $post[$key] = '@'. realpath($file);
+ $post[$key] = '@' . realpath($file);
}
}
else {
@@ -569,7 +579,7 @@ class DrupalWebTestCase extends UnitTestCase {
foreach ($post_array as $key => $value) {
// Whethet this needs to be urlencode or rawurlencode, is not
// quite clear, but this seems to be the better choice.
- $post[] = urlencode($key) .'='. urlencode($value);
+ $post[] = urlencode($key) . '=' . urlencode($value);
}
$post = implode('&', $post);
}
@@ -644,7 +654,7 @@ class DrupalWebTestCase extends UnitTestCase {
if (is_array($new_value)) {
$option_value= (string)$option['value'];
if (in_array($option_value, $new_value)) {
- $post[$key .'['. $index++ .']'] = $option_value;
+ $post[$key . '[' . $index++ . ']'] = $option_value;
$done = TRUE;
unset($edit[$name]);
}
@@ -682,7 +692,7 @@ class DrupalWebTestCase extends UnitTestCase {
$post[$name] = (string)$option['value'];
}
else {
- $post[$key .'['. $index++ .']'] = (string)$option['value'];
+ $post[$key . '[' . $index++ . ']'] = (string)$option['value'];
}
}
}
@@ -748,7 +758,7 @@ class DrupalWebTestCase extends UnitTestCase {
$url_before = $this->getUrl();
$ret = FALSE;
if ($this->parse()) {
- $urls = $this->elements->xpath('//a[text()="'. $label .'"]');
+ $urls = $this->elements->xpath('//a[text()="' . $label . '"]');
if (isset($urls[$index])) {
$url_target = $this->getAbsoluteUrl($urls[$index]['href']);
$curl_options = array(CURLOPT_URL => $url_target);
@@ -867,7 +877,7 @@ class DrupalWebTestCase extends UnitTestCase {
$this->plain_text = filter_xss($this->_content, array());
}
if (!$message) {
- $message = '"'. $text .'"'. ($not_exists ? ' not found.' : ' found.');
+ $message = '"' . $text . '"' . ($not_exists ? ' not found.' : ' found.');
}
return $this->assertTrue($not_exists == (strpos($this->plain_text, $text) === FALSE), $message, $group);
}
@@ -902,7 +912,7 @@ class DrupalWebTestCase extends UnitTestCase {
* @return boolean TRUE on pass.
*/
function assertTitle($title, $message, $group = 'Other') {
- return $this->assertTrue($this->parse() && $this->elements->xpath('//title[text()="'. $title .'"]'), $message, $group);
+ return $this->assertTrue($this->parse() && $this->elements->xpath('//title[text()="' . $title . '"]'), $message, $group);
}
/**
@@ -1015,7 +1025,7 @@ class DrupalWebTestCase extends UnitTestCase {
* @return boolean Assertion result.
*/
function assertField($field, $message = '', $group = 'Other') {
- return $this->assertFieldByXPath($this->_constructFieldXpath('name', $field) .'|'. $this->_constructFieldXpath('id', $field), '', $message, $group);
+ return $this->assertFieldByXPath($this->_constructFieldXpath('name', $field) . '|' . $this->_constructFieldXpath('id', $field), '', $message, $group);
}
/**
@@ -1026,7 +1036,7 @@ class DrupalWebTestCase extends UnitTestCase {
* @return boolean Assertion result.
*/
function assertNoField($field, $message = '', $group = 'Other') {
- return $this->assertNoFieldByXPath($this->_constructFieldXpath('name', $field) .'|'. $this->_constructFieldXpath('id', $field), '', $message, $group);
+ return $this->assertNoFieldByXPath($this->_constructFieldXpath('name', $field) . '|' . $this->_constructFieldXpath('id', $field), '', $message, $group);
}
/**
@@ -1037,7 +1047,7 @@ class DrupalWebTestCase extends UnitTestCase {
* @return string XPath for specified values.
*/
function _constructFieldXpath($attribute, $value) {
- return '//textarea[@'. $attribute .'="'. $value .'"]|//input[@'. $attribute .'="'. $value .'"]|//select[@'. $attribute .'="'. $value .'"]';
+ return '//textarea[@' . $attribute . '="' . $value . '"]|//input[@' . $attribute . '="' . $value . '"]|//select[@' . $attribute . '="' . $value . '"]';
}
/**
diff --git a/modules/simpletest/dumper.php b/modules/simpletest/dumper.php
index e2995cb21..ae7c88fa8 100644
--- a/modules/simpletest/dumper.php
+++ b/modules/simpletest/dumper.php
@@ -48,7 +48,7 @@ class SimpleDumper {
}
$functions = array('bool', 'string', 'integer', 'float', 'array', 'resource', 'object');
foreach ($functions as $function) {
- $function_name = 'is_'. $function;
+ $function_name = 'is_' . $function;
if ($function_name($value)) {
return ucfirst($function);
}
diff --git a/modules/simpletest/expectation.php b/modules/simpletest/expectation.php
index 1dd85c9ac..c9386907f 100644
--- a/modules/simpletest/expectation.php
+++ b/modules/simpletest/expectation.php
@@ -108,7 +108,7 @@ class AnythingExpectation extends SimpleExpectation {
*/
function testMessage($compare) {
$dumper = &$this->_getDumper();
- return 'Anything always matches ['. $dumper->describeValue($compare) .']';
+ return 'Anything always matches [' . $dumper->describeValue($compare) . ']';
}
}
@@ -138,7 +138,7 @@ class TrueExpectation extends SimpleExpectation {
*/
function testMessage($compare) {
$dumper = &$this->_getDumper();
- return 'Expected true, got ['. $dumper->describeValue($compare) .']';
+ return 'Expected true, got [' . $dumper->describeValue($compare) . ']';
}
}
diff --git a/modules/simpletest/reporter.php b/modules/simpletest/reporter.php
index c6bca2fd7..e0487a243 100644
--- a/modules/simpletest/reporter.php
+++ b/modules/simpletest/reporter.php
@@ -128,7 +128,7 @@ class HtmlReporter extends SimpleReporter {
$breadcrumb = $this->getTestList();
array_shift($breadcrumb);
print implode(" -&gt; ", $breadcrumb);
- $message = 'Unexpected exception of type ['. get_class($exception) .'] with message ['. $exception->getMessage() .'] in ['. $exception->getFile() .' line '. $exception->getLine() .']';
+ $message = 'Unexpected exception of type [' . get_class($exception) . '] with message [' . $exception->getMessage() . '] in [' . $exception->getFile() . ' line ' . $exception->getLine() . ']';
print " -&gt; <strong>". $this->_htmlEntities($message) ."</strong><br />\n";
}
@@ -152,7 +152,7 @@ class HtmlReporter extends SimpleReporter {
* @access public
*/
function paintFormattedMessage($message) {
- print '<pre>'. $this->_htmlEntities($message) .'</pre>';
+ print '<pre>' . $this->_htmlEntities($message) . '</pre>';
}
/**
@@ -253,7 +253,7 @@ class TextReporter extends SimpleReporter {
*/
function paintException($exception) {
parent::paintException($exception);
- $message = 'Unexpected exception of type ['. get_class($exception) .'] with message ['. $exception->getMessage() .'] in ['. $exception->getFile() .' line '. $exception->getLine() .']';
+ $message = 'Unexpected exception of type [' . get_class($exception) . '] with message [' . $exception->getMessage() . '] in [' . $exception->getFile() . ' line ' . $exception->getLine() . ']';
print "Exception ". $this->getExceptionCount() ."!\n$message\n";
$breadcrumb = $this->getTestList();
array_shift($breadcrumb);
diff --git a/modules/simpletest/simpletest.install b/modules/simpletest/simpletest.install
index 25b828698..074d250a6 100644
--- a/modules/simpletest/simpletest.install
+++ b/modules/simpletest/simpletest.install
@@ -29,10 +29,10 @@ function simpletest_install() {
// Copy other test files for consistency.
$files = file_scan_directory($path, '(html|image|javascript|php|sql)-.*');
if (count($files) == 0) {
- $original = drupal_get_path('module', 'simpletest') .'/files';
+ $original = drupal_get_path('module', 'simpletest') . '/files';
$files = file_scan_directory($original, '(html|image|javascript|php|sql)-.*');
foreach ($files as $file) {
- file_copy($file->filename, $path .'/'. $file->basename);
+ file_copy($file->filename, $path . '/' . $file->basename);
}
$generated = TRUE;
}
@@ -70,7 +70,7 @@ function simpletest_generate_file($filename, $width, $lines, $type = 'binary-tex
// Create filename.
$path = file_directory_path() . '/simpletest/';
$count = simpletest_get_file_count($path, $filename);
- file_put_contents($path . $filename .'-'. ($count + 1) .'.txt', $text);
+ file_put_contents($path . $filename . '-' . ($count + 1) . '.txt', $text);
}
/**
@@ -80,7 +80,7 @@ function simpletest_get_file_count($directory, $filename) {
$files = scandir($directory);
$count = 0;
foreach ($files as $file) {
- if (preg_match('/'. $filename .'.*?/', $file)) {
+ if (preg_match('/' . $filename . '.*?/', $file)) {
$count++;
}
}
diff --git a/modules/simpletest/simpletest.module b/modules/simpletest/simpletest.module
index c61c30f83..96d70145f 100644
--- a/modules/simpletest/simpletest.module
+++ b/modules/simpletest/simpletest.module
@@ -7,11 +7,11 @@
function simpletest_help($path, $arg) {
switch ($path) {
case 'admin/help#simpletest':
- $output = '<p>'. t('The SimpleTest module is a framework for running automated unit tests in Drupal. It can be used to verify a working state of Drupal before and after any code changes, or as a means for developers to write and execute tests for their modules.') .'</p>';
- $output .= '<p>'. t('Visit <a href="@admin-simpletest">Administer >> Site building >> SimpleTest</a> to display a list of available tests. For comprehensive testing, select <em>all</em> tests, or individually select tests for more targeted testing. Note that it might take several minutes for all tests to complete.)', array('@admin-simpletest' => url('admin/build/testing'))) .'</p>';
- $output .= '<p>'. t('After the tests have run, a message will be displayed next to each test group indicating whether tests within it passed, failed, or had exceptions. A pass means that a test returned the expected results, while fail means that it did not. An exception normally indicates an error outside of the test, such as a PHP warning or notice. If there were fails or exceptions, the results are expanded, and the tests that had issues will be indicated in red or pink rows. Use these results to refine your code and tests until all tests return a pass.') .'</p>';
- $output .= '<p>'. t('For more information on creating and modifying your own tests, see the <a href="@simpletest-api">SimpleTest API Documentation</a> in the Drupal handbook.', array('@simpletest-api' => 'http://drupal.org/simpletest')) .'</p>';
- $output .= '<p>'. t('For more information, see the online handbook entry for <a href="@simpletest">SimpleTest module</a>.', array('@simpletest' => 'http://drupal.org/handbook/modules/simpletest')) .'</p>';
+ $output = '<p>' . t('The SimpleTest module is a framework for running automated unit tests in Drupal. It can be used to verify a working state of Drupal before and after any code changes, or as a means for developers to write and execute tests for their modules.') .'</p>';
+ $output .= '<p>' . t('Visit <a href="@admin-simpletest">Administer >> Site building >> SimpleTest</a> to display a list of available tests. For comprehensive testing, select <em>all</em> tests, or individually select tests for more targeted testing. Note that it might take several minutes for all tests to complete.)', array('@admin-simpletest' => url('admin/build/testing'))) .'</p>';
+ $output .= '<p>' . t('After the tests have run, a message will be displayed next to each test group indicating whether tests within it passed, failed, or had exceptions. A pass means that a test returned the expected results, while fail means that it did not. An exception normally indicates an error outside of the test, such as a PHP warning or notice. If there were fails or exceptions, the results are expanded, and the tests that had issues will be indicated in red or pink rows. Use these results to refine your code and tests until all tests return a pass.') .'</p>';
+ $output .= '<p>' . t('For more information on creating and modifying your own tests, see the <a href="@simpletest-api">SimpleTest API Documentation</a> in the Drupal handbook.', array('@simpletest-api' => 'http://drupal.org/simpletest')) .'</p>';
+ $output .= '<p>' . t('For more information, see the online handbook entry for <a href="@simpletest">SimpleTest module</a>.', array('@simpletest' => 'http://drupal.org/handbook/modules/simpletest')) .'</p>';
return $output;
}
}
@@ -68,7 +68,7 @@ function simpletest_load() {
if ($user->uid != 1) {
drupal_set_message(t('It is strongly suggested to run the tests with the first user!'));
}
- $path = drupal_get_path('module', 'simpletest') .'/';
+ $path = drupal_get_path('module', 'simpletest') . '/';
foreach (array('simpletest.php', 'unit_tester.php', 'reporter.php', 'drupal_reporter.php', 'drupal_web_test_case.php', 'drupal_test_suite.php') as $file) {
require_once($path . $file);
}
@@ -80,8 +80,8 @@ function simpletest_load() {
*/
function simpletest_entrypoint() {
simpletest_load();
- drupal_add_css(drupal_get_path('module', 'simpletest') .'/simpletest.css', 'module');
- drupal_add_js(drupal_get_path('module', 'simpletest') .'/simpletest.js', 'module');
+ drupal_add_css(drupal_get_path('module', 'simpletest') . '/simpletest.css', 'module');
+ drupal_add_js(drupal_get_path('module', 'simpletest') . '/simpletest.js', 'module');
$output = drupal_get_form('simpletest_overview_form');
if (simpletest_running_output()) {
@@ -204,30 +204,30 @@ function theme_simpletest_overview_form($form) {
$row = array();
$row[] = array('id' => $test_class, 'class' => 'simpletest-select-all');
$row[] = array(
- 'data' => '<div class="simpletest-image" id="simpletest-test-group-'. $test_class .'">'. $js['images'][0] .'</div>&nbsp;<label for="'. $test_class .'-select-all" class="simpletest-group-label">'. $element['#title'] .'</label>',
+ 'data' => '<div class="simpletest-image" id="simpletest-test-group-' . $test_class . '">' . $js['images'][0] . '</div>&nbsp;<label for="' . $test_class . '-select-all" class="simpletest-group-label">' . $element['#title'] . '</label>',
'style' => 'font-weight: bold;'
);
$row[] = $element['#description'];
$rows[] = array('data' => $row, 'class' => 'simpletest-group');
- $current_js = array('testClass' => $test_class .'-test', 'testNames' => array(), 'imageDirection' => 0, 'clickActive' => FALSE);
+ $current_js = array('testClass' => $test_class . '-test', 'testNames' => array(), 'imageDirection' => 0, 'clickActive' => FALSE);
// Go through each test in the group and create table rows setting them to invisible:
foreach (element_children($element['tests']) as $test_name) {
- $current_js['testNames'][] = 'edit-'. $test_name;
+ $current_js['testNames'][] = 'edit-' . $test_name;
$test = $element['tests'][$test_name];
foreach (array('title', 'description') as $key) {
- $$key = $test['#'. $key];
- unset($test['#'. $key]);
+ $$key = $test['#' . $key];
+ unset($test['#' . $key]);
}
$test['#name'] = $test_name;
$themed_test = drupal_render($test);
$row = array();
$row[] = $themed_test;
- $row[] = theme('indentation', 1) .'<label for="edit-'. $test_name .'">'. $title .'</label>';
- $row[] = '<div class="description">'. $description .'</div>';
- $rows[] = array('data' => $row, 'style' => 'display: none;', 'class' => $test_class .'-test');
+ $row[] = theme('indentation', 1) . '<label for="edit-' . $test_name . '">' . $title . '</label>';
+ $row[] = '<div class="description">' . $description . '</div>';
+ $rows[] = array('data' => $row, 'style' => 'display: none;', 'class' => $test_class . '-test');
}
- $js['simpletest-test-group-'. $test_class] = $current_js;
+ $js['simpletest-test-group-' . $test_class] = $current_js;
unset($form[$gid]); // Remove test group from form.
}
}
@@ -343,7 +343,7 @@ function simpletest_clean_temporary_directories() {
$files = scandir(file_directory_path());
$count = 0;
foreach ($files as $file) {
- $path = file_directory_path() .'/'. $file;
+ $path = file_directory_path() . '/' . $file;
if (is_dir($path) && preg_match('/^simpletest\d+/', $file)) {
simpletest_clean_temporary_directory($path);
$count++;
diff --git a/modules/simpletest/simpletest.php b/modules/simpletest/simpletest.php
index c5f647910..f6c93c4c9 100644
--- a/modules/simpletest/simpletest.php
+++ b/modules/simpletest/simpletest.php
@@ -1,17 +1,17 @@
<?php
// $Id$
-require_once dirname(__FILE__) .'/test_case.php';
-require_once dirname(__FILE__) .'/unit_tester.php';
-require_once dirname(__FILE__) .'/expectation.php';
-require_once dirname(__FILE__) .'/invoker.php';
-require_once dirname(__FILE__) .'/scorer.php';
-require_once dirname(__FILE__) .'/reporter.php';
-require_once dirname(__FILE__) .'/default_reporter.php';
-require_once dirname(__FILE__) .'/dumper.php';
-require_once dirname(__FILE__) .'/errors.php';
-require_once dirname(__FILE__) .'/exceptions.php';
-require_once dirname(__FILE__) .'/xml.php';
+require_once dirname(__FILE__) . '/test_case.php';
+require_once dirname(__FILE__) . '/unit_tester.php';
+require_once dirname(__FILE__) . '/expectation.php';
+require_once dirname(__FILE__) . '/invoker.php';
+require_once dirname(__FILE__) . '/scorer.php';
+require_once dirname(__FILE__) . '/reporter.php';
+require_once dirname(__FILE__) . '/default_reporter.php';
+require_once dirname(__FILE__) . '/dumper.php';
+require_once dirname(__FILE__) . '/errors.php';
+require_once dirname(__FILE__) . '/exceptions.php';
+require_once dirname(__FILE__) . '/xml.php';
/**
* Registry and test context. Includes a few
diff --git a/modules/simpletest/test_case.php b/modules/simpletest/test_case.php
index fd37658b0..d84625836 100644
--- a/modules/simpletest/test_case.php
+++ b/modules/simpletest/test_case.php
@@ -52,7 +52,7 @@ class SimpleTestCase {
function skipIf($should_skip, $message = '%s') {
if ($should_skip && !$this->_should_skip) {
$this->_should_skip = true;
- $message = sprintf($message, 'Skipping ['. get_class($this) .']');
+ $message = sprintf($message, 'Skipping [' . get_class($this) . ']');
$this->_reporter->paintSkip($message . $this->getAssertionLine());
}
}
@@ -589,8 +589,8 @@ class BadTestSuite {
*/
function run(&$reporter) {
$reporter->paintGroupStart($this->getLabel(), $this->getSize());
- $reporter->paintFail('Bad TestSuite ['. $this->getLabel() .
- '] with error ['. $this->_error .']');
+ $reporter->paintFail('Bad TestSuite [' . $this->getLabel() .
+ '] with error [' . $this->_error . ']');
$reporter->paintGroupEnd($this->getLabel());
return $reporter->getStatus();
}
diff --git a/modules/simpletest/unit_tester.php b/modules/simpletest/unit_tester.php
index cf4ea16ba..5b77faacc 100644
--- a/modules/simpletest/unit_tester.php
+++ b/modules/simpletest/unit_tester.php
@@ -47,7 +47,7 @@ class UnitTestCase extends SimpleTestCase {
*/
function assertFalse($result, $message = '%s', $group = 'Other') {
$dumper = &new SimpleDumper();
- $message = sprintf($message, 'Expected false, got ['. $dumper->describeValue($result) .']');
+ $message = sprintf($message, 'Expected false, got [' . $dumper->describeValue($result) . ']');
return $this->assertTrue(!$result, $message, $group);
}
@@ -60,7 +60,7 @@ class UnitTestCase extends SimpleTestCase {
*/
function assertNull($value, $message = '%s', $group = 'Other') {
$dumper = &new SimpleDumper();
- $message = sprintf($message, '['. $dumper->describeValue($value) .'] should be null');
+ $message = sprintf($message, '[' . $dumper->describeValue($value) . '] should be null');
return $this->assertTrue(!isset($value), $message, $group);
}
@@ -73,7 +73,7 @@ class UnitTestCase extends SimpleTestCase {
*/
function assertNotNull($value, $message = '%s', $group = 'Other') {
$dumper = &new SimpleDumper();
- $message = sprintf($message, '['. $dumper->describeValue($value) .'] should not be null');
+ $message = sprintf($message, '[' . $dumper->describeValue($value) . '] should not be null');
return $this->assertTrue(isset($value), $message, $group);
}
@@ -88,7 +88,7 @@ class UnitTestCase extends SimpleTestCase {
*/
function assertEqual($first, $second, $message = '%s', $group = 'Other') {
$dumper = &new SimpleDumper();
- $message = sprintf($message, 'Expected '. $dumper->describeValue($first) .', got ['. $dumper->describeValue($second) .']');
+ $message = sprintf($message, 'Expected ' . $dumper->describeValue($first) . ', got [' . $dumper->describeValue($second) . ']');
$this->assertTrue($first == $second, $message, $group);
}
@@ -103,7 +103,7 @@ class UnitTestCase extends SimpleTestCase {
*/
function assertNotEqual($first, $second, $message = '%s', $group = 'Other') {
$dumper = &new SimpleDumper();
- $message = sprintf($message, 'Expected '. $dumper->describeValue($first) .', not equal to '. $dumper->describeValue($second));
+ $message = sprintf($message, 'Expected ' . $dumper->describeValue($first) . ', not equal to ' . $dumper->describeValue($second));
$this->assertTrue($first != $second, $message, $group);
}
@@ -118,7 +118,7 @@ class UnitTestCase extends SimpleTestCase {
*/
function assertIdentical($first, $second, $message = '%s', $group = 'Other') {
$dumper = &new SimpleDumper();
- $message = sprintf($message, 'Expected '. $dumper->describeValue($first) .', got ['. $dumper->describeValue($second) .']');
+ $message = sprintf($message, 'Expected ' . $dumper->describeValue($first) . ', got [' . $dumper->describeValue($second) . ']');
$this->assertTrue($first === $second, $message, $group);
}
@@ -133,7 +133,7 @@ class UnitTestCase extends SimpleTestCase {
*/
function assertNotIdentical($first, $second, $message = '%s', $group = 'Other') {
$dumper = &new SimpleDumper();
- $message = sprintf($message, 'Expected '. $dumper->describeValue($first) .', not identical to '. $dumper->describeValue($second));
+ $message = sprintf($message, 'Expected ' . $dumper->describeValue($first) . ', not identical to ' . $dumper->describeValue($second));
$this->assertTrue($first !== $second, $message, $group);
}
@@ -149,11 +149,11 @@ class UnitTestCase extends SimpleTestCase {
*/
function assertPattern($pattern, $subject, $message = '%s', $group = 'Other') {
$dumper = &new SimpleDumper();
- $replace = 'Pattern '. $pattern .' detected in ['. $dumper->describeValue($subject) .']';
+ $replace = 'Pattern ' . $pattern . ' detected in [' . $dumper->describeValue($subject) . ']';
$found = preg_match($pattern, $subject, $matches);
if ($found) {
$position = strpos($subject, $matches[0]);
- $replace .= ' in region ['. $dumper->clipString($subject, 100, $position) .']';
+ $replace .= ' in region [' . $dumper->clipString($subject, 100, $position) . ']';
}
$message = sprintf($message, $replace);
$this->assertTrue($found, $message, $group);
@@ -172,7 +172,7 @@ class UnitTestCase extends SimpleTestCase {
function assertNoPattern($pattern, $subject, $message = '%s', $group = 'Other') {
$dumper = &new SimpleDumper();
$found = preg_match($pattern, $subject);
- $message = sprintf($message, 'Pattern '. $pattern .' not detected in ['. $dumper->describeValue($subject) .']');
+ $message = sprintf($message, 'Pattern ' . $pattern . ' not detected in [' . $dumper->describeValue($subject) . ']');
$this->assertFalse($found, $message, $group = 'Other');
}
} \ No newline at end of file
diff --git a/modules/simpletest/xml.php b/modules/simpletest/xml.php
index f3f105618..dcaa7525b 100644
--- a/modules/simpletest/xml.php
+++ b/modules/simpletest/xml.php
@@ -184,8 +184,8 @@ class XmlReporter extends SimpleReporter {
print $this->_getIndent(1);
print "<" . $this->_namespace . "exception>";
$message = 'Unexpected exception of type [' . get_class($exception) .
- '] with message ['. $exception->getMessage() .
- '] in ['. $exception->getFile() .
+ '] with message [' . $exception->getMessage() .
+ '] in [' . $exception->getFile() .
' line ' . $exception->getLine() . ']';
print $this->toParsedXml($message);
print "</" . $this->_namespace . "exception>\n";