summaryrefslogtreecommitdiff
path: root/modules/system
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2011-02-28 20:36:37 -0500
committerDries Buytaert <dries@buytaert.net>2011-02-28 20:36:37 -0500
commit768208f8ddb2d03bc1e6d484ecac6e78c5fa75a8 (patch)
treef7f428f07922e354fe47f169605e67d581c5f1ed /modules/system
parent540ee5f4400e33bb202835b61bdefc7f7a280d82 (diff)
downloadbrdo-768208f8ddb2d03bc1e6d484ecac6e78c5fa75a8.tar.gz
brdo-768208f8ddb2d03bc1e6d484ecac6e78c5fa75a8.tar.bz2
- Patch #1076394 by pillarsdotnet: improved test code.
Diffstat (limited to 'modules/system')
-rw-r--r--modules/system/system.test14
1 files changed, 7 insertions, 7 deletions
diff --git a/modules/system/system.test b/modules/system/system.test
index 304556988..fb6a6e867 100644
--- a/modules/system/system.test
+++ b/modules/system/system.test
@@ -1575,13 +1575,13 @@ class TokenReplaceTestCase extends DrupalWebTestCase {
// Test that the clear parameter cleans out non-existent tokens.
$result = token_replace($source, array('node' => $node), array('language' => $language, 'clear' => TRUE));
- $result = $this->assertFalse(strcmp($target, $result), 'Valid tokens replaced while invalid tokens cleared out.');
+ $result = $this->assertEqual($target, $result, 'Valid tokens replaced while invalid tokens cleared out.');
// Test without using the clear parameter (non-existant token untouched).
$target .= '[user:name]';
$target .= '[bogus:token]';
$result = token_replace($source, array('node' => $node), array('language' => $language));
- $this->assertFalse(strcmp($target, $result), 'Valid tokens replaced while invalid tokens ignored.');
+ $this->assertEqual($target, $result, 'Valid tokens replaced while invalid tokens ignored.');
// Check that the results of token_generate are sanitized properly. This does NOT
// test the cleanliness of every token -- just that the $sanitize flag is being
@@ -1589,10 +1589,10 @@ class TokenReplaceTestCase extends DrupalWebTestCase {
// token, [node:title].
$raw_tokens = array('title' => '[node:title]');
$generated = token_generate('node', $raw_tokens, array('node' => $node));
- $this->assertFalse(strcmp($generated['[node:title]'], check_plain($node->title)), t('Token sanitized.'));
+ $this->assertEqual($generated['[node:title]'], check_plain($node->title), t('Token sanitized.'));
$generated = token_generate('node', $raw_tokens, array('node' => $node), array('sanitize' => FALSE));
- $this->assertFalse(strcmp($generated['[node:title]'], $node->title), t('Unsanitized token generated properly.'));
+ $this->assertEqual($generated['[node:title]'], $node->title, t('Unsanitized token generated properly.'));
}
/**
@@ -1624,7 +1624,7 @@ class TokenReplaceTestCase extends DrupalWebTestCase {
foreach ($tests as $input => $expected) {
$output = token_replace($input, array(), array('language' => $language));
- $this->assertFalse(strcmp($output, $expected), t('Sanitized system site information token %token replaced.', array('%token' => $input)));
+ $this->assertEqual($output, $expected, t('Sanitized system site information token %token replaced.', array('%token' => $input)));
}
// Generate and test unsanitized tokens.
@@ -1633,7 +1633,7 @@ class TokenReplaceTestCase extends DrupalWebTestCase {
foreach ($tests as $input => $expected) {
$output = token_replace($input, array(), array('language' => $language, 'sanitize' => FALSE));
- $this->assertFalse(strcmp($output, $expected), t('Unsanitized system site information token %token replaced.', array('%token' => $input)));
+ $this->assertEqual($output, $expected, t('Unsanitized system site information token %token replaced.', array('%token' => $input)));
}
}
@@ -1660,7 +1660,7 @@ class TokenReplaceTestCase extends DrupalWebTestCase {
foreach ($tests as $input => $expected) {
$output = token_replace($input, array('date' => $date), array('language' => $language));
- $this->assertFalse(strcmp($output, $expected), t('Date token %token replaced.', array('%token' => $input)));
+ $this->assertEqual($output, $expected, t('Date token %token replaced.', array('%token' => $input)));
}
}
}