summaryrefslogtreecommitdiff
path: root/tests/test_tools/simpletest/authentication.php
diff options
context:
space:
mode:
authorwei <>2006-07-07 23:18:19 +0000
committerwei <>2006-07-07 23:18:19 +0000
commitb2e97539e7af7712b04dd5c2610a454d09aa0333 (patch)
treed09ae76ddc7f349a39b74b0cb1f40c8b678a352e /tests/test_tools/simpletest/authentication.php
parentfce10eed76455b7e0419f13affb4f29e73ef0375 (diff)
Update simpletest
Diffstat (limited to 'tests/test_tools/simpletest/authentication.php')
-rw-r--r--tests/test_tools/simpletest/authentication.php23
1 files changed, 21 insertions, 2 deletions
diff --git a/tests/test_tools/simpletest/authentication.php b/tests/test_tools/simpletest/authentication.php
index 7b6ed4ba..bc413b2c 100644
--- a/tests/test_tools/simpletest/authentication.php
+++ b/tests/test_tools/simpletest/authentication.php
@@ -3,7 +3,7 @@
* Base include file for SimpleTest
* @package SimpleTest
* @subpackage WebTester
- * @version $Id: authentication.php,v 1.9 2004/09/19 17:24:11 lastcraft Exp $
+ * @version $Id: authentication.php,v 1.10 2005/07/26 01:27:18 lastcraft Exp $
*/
/**
* include http class
@@ -100,7 +100,26 @@
* @access public
*/
function isWithin($url) {
- return (strpos($url->getBasePath(), $this->_root) === 0);
+ if ($this->_isIn($this->_root, $url->getBasePath())) {
+ return true;
+ }
+ if ($this->_isIn($this->_root, $url->getBasePath() . $url->getPage() . '/')) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Tests to see if one string is a substring of
+ * another.
+ * @param string $part Small bit.
+ * @param string $whole Big bit.
+ * @return boolean True if the small bit is
+ * in the big bit.
+ * @access private
+ */
+ function _isIn($part, $whole) {
+ return strpos($whole, $part) === 0;
}
}