X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=testing%2Fassert.patch;fp=testing%2Fassert.patch;h=d2e9737d6c3aff5274df83c984568c88b13ebff4;hb=6855525e48fad5de270500a5445c4f4ff85d8bda;hp=0000000000000000000000000000000000000000;hpb=e69709aa8ee6108a1197e46b45367ba8dab55a52;p=diogenes.git diff --git a/testing/assert.patch b/testing/assert.patch new file mode 100644 index 0000000..d2e9737 --- /dev/null +++ b/testing/assert.patch @@ -0,0 +1,92 @@ +--- Assert.php.orig 2004-06-09 15:52:13.000000000 +1000 ++++ Assert.php 2004-06-09 15:55:10.000000000 +1000 +@@ -240,6 +240,89 @@ + } + + /** ++ * Asserts that the actual string does not match a given ++ * regular expression. ++ * ++ * @param string ++ * @param string ++ * @param string ++ * @access public ++ * @author Sébastien Hordeaux ++ * @author Matthew Palmer ++ */ ++ function assertNotRegExp($expected, $actual, $message = '') { ++ $message = sprintf( ++ '%sexpected %s, actual %s', ++ ++ !empty($message) ? $message . ' ' : '', ++ $expected, ++ $actual ++ ); ++ ++ if (preg_match($expected, $actual)) { ++ return $this->fail($message); ++ } ++ } ++ ++ /** ++ * Asserts that the expected string is contained somewhere within the ++ * data string given. ++ * ++ * @param string ++ * @param string ++ * @param string ++ * @access public ++ * @author Matthew Palmer ++ */ ++ function assertSubStr($needle, $haystack, $message = '') ++ { ++ if (empty($message)) ++ { ++ $message = sprintf( ++ '"%s" not found in "%s"', ++ $expected, ++ $actual ++ ); ++ } ++ ++ if (substr_count($haystack, $needle) == 0) ++ { ++ return $this->fail($message); ++ } ++ ++ return $this->pass(); ++ } ++ ++ /** ++ * Asserts that the expected string is not contained anywhere within the ++ * data string given. ++ * ++ * @param string ++ * @param string ++ * @param string ++ * @access public ++ * @author Matthew Palmer ++ */ ++ function assertNotSubStr($needle, $haystack, $message = '') ++ { ++ if (empty($message)) ++ { ++ $message = sprintf( ++ '"%s" found in "%s"', ++ $expected, ++ $actual ++ ); ++ } ++ ++ if (substr_count($haystack, $needle) > 0) ++ { ++ return $this->fail($message); ++ } ++ ++ return $this->pass(); ++ } ++ ++ /** + * Asserts that a variable is of a given type. + * + * @param string $expected