summaryrefslogtreecommitdiff
path: root/modules/system
diff options
context:
space:
mode:
authorDavid Rothstein <drothstein@gmail.com>2013-03-30 14:48:22 -0400
committerDavid Rothstein <drothstein@gmail.com>2013-03-30 14:48:22 -0400
commitfc104c95bde2db0c6e266e76205a870be0e221c3 (patch)
tree5dfc5473f817a33a02021e111b77510015d7dd64 /modules/system
parent1d378ff882353b32716837d3ff901305e0aa05a8 (diff)
downloadbrdo-fc104c95bde2db0c6e266e76205a870be0e221c3.tar.gz
brdo-fc104c95bde2db0c6e266e76205a870be0e221c3.tar.bz2
Issue #1035292 by Désiré, vijaycs85, wizonesolutions, oriol_e9g, ACF, achton, darkadept: Fixed Dynamic tokens can't have spaces.
Diffstat (limited to 'modules/system')
-rw-r--r--modules/system/system.test31
1 files changed, 31 insertions, 0 deletions
diff --git a/modules/system/system.test b/modules/system/system.test
index abd21aae6..84ed269bc 100644
--- a/modules/system/system.test
+++ b/modules/system/system.test
@@ -2681,3 +2681,34 @@ class SystemIndexPhpTest extends DrupalWebTestCase {
}
}
+/**
+ * Test token replacement in strings.
+ */
+class TokenScanTest extends DrupalWebTestCase {
+
+ public static function getInfo() {
+ return array(
+ 'name' => 'Token scanning',
+ 'description' => 'Scan token-like patterns in a dummy text to check token scanning.',
+ 'group' => 'System',
+ );
+ }
+
+ /**
+ * Scans dummy text, then tests the output.
+ */
+ function testTokenScan() {
+ // Define text with valid and not valid, fake and existing token-like
+ // strings.
+ $text = 'First a [valid:simple], but dummy token, and a dummy [valid:token with: spaces].';
+ $text .= 'Then a [not valid:token].';
+ $text .= 'Last an existing token: [node:author:name].';
+ $token_wannabes = token_scan($text);
+
+ $this->assertTrue(isset($token_wannabes['valid']['simple']), 'A simple valid token has been matched.');
+ $this->assertTrue(isset($token_wannabes['valid']['token with: spaces']), 'A valid token with space characters in the token name has been matched.');
+ $this->assertFalse(isset($token_wannabes['not valid']), 'An invalid token with spaces in the token type has not been matched.');
+ $this->assertTrue(isset($token_wannabes['node']), 'An existing valid token has been matched.');
+ }
+}
+