summaryrefslogtreecommitdiff
path: root/modules/simpletest/simpletest.test
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2010-03-31 20:05:06 +0000
committerDries Buytaert <dries@buytaert.net>2010-03-31 20:05:06 +0000
commit6fc055ab906c035355bfb789aed404551db5b45a (patch)
treef29650c65f8a7003ce73ebc6047f216f91e14c79 /modules/simpletest/simpletest.test
parente0871ec49bb81adff156d4bc7cf2d9f8b50d04a0 (diff)
downloadbrdo-6fc055ab906c035355bfb789aed404551db5b45a.tar.gz
brdo-6fc055ab906c035355bfb789aed404551db5b45a.tar.bz2
- Patch #730220 by Berdir, aspilicious, Damien Tournoud, pwolanin: improved xpath tests.
Diffstat (limited to 'modules/simpletest/simpletest.test')
-rw-r--r--modules/simpletest/simpletest.test30
1 files changed, 26 insertions, 4 deletions
diff --git a/modules/simpletest/simpletest.test b/modules/simpletest/simpletest.test
index 375dab881..11bf16ef7 100644
--- a/modules/simpletest/simpletest.test
+++ b/modules/simpletest/simpletest.test
@@ -281,13 +281,13 @@ class SimpleTestFunctionalTest extends DrupalWebTestCase {
}
/**
- * Test internal testing framework URL handling.
+ * Test internal testing framework browser.
*/
-class SimpleTestURLTestCase extends DrupalWebTestCase {
+class SimpleTestBrowserTestCase extends DrupalWebTestCase {
public static function getInfo() {
return array(
- 'name' => 'SimpleTest URL handling',
- 'description' => 'Test the URL handling in the testing framework.',
+ 'name' => 'SimpleTest browser',
+ 'description' => 'Test the internal browser of the testing framework.',
'group' => 'SimpleTest',
);
}
@@ -315,6 +315,28 @@ class SimpleTestURLTestCase extends DrupalWebTestCase {
$this->assertEqual($absolute, $this->url, t('Passed and requested URL are equal.'));
$this->assertEqual($this->url, $this->getAbsoluteUrl($this->url), t('Requested and returned absolute URL are equal.'));
}
+
+ /**
+ * Tests XPath escaping.
+ */
+ function testXPathEscaping() {
+ $testpage = <<< EOF
+<html>
+<body>
+<a href="link1">A "weird" link, just to bother the dumb "XPath 1.0"</a>
+<a href="link2">A second "even more weird" link, in memory of George O'Malley</a>
+</body>
+</html>
+EOF;
+ $this->drupalSetContent($testpage);
+
+ // Matches the first link.
+ $urls = $this->xpath('//a[text()=:text]', array(':text' => 'A "weird" link, just to bother the dumb "XPath 1.0"'));
+ $this->assertEqual($urls[0]['href'], 'link1', 'Match with quotes.');
+
+ $urls = $this->xpath('//a[text()=:text]', array(':text' => 'A second "even more weird" link, in memory of George O\'Malley'));
+ $this->assertEqual($urls[0]['href'], 'link2', 'Match with mixed single and double quotes.');
+ }
}
class SimpleTestMailCaptureTestCase extends DrupalWebTestCase {