cvs: pear /PHPUnit PHPUnit_Assert.php package.xml

From: Date: Mon, 03 Jun 2002 12:45:32 +0000
Subject: cvs: pear /PHPUnit PHPUnit_Assert.php package.xml
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-4387@lists.php.net to get a copy of this message
sebastian Mon Jun 3 08:45:32 2002 EDT Modified files: /pear/PHPUnit PHPUnit_Assert.php package.xml Log: Add PHPUnit_Assert::assertRegExp(). (Patch by M@rms <marms@marms.com>) Index: pear/PHPUnit/PHPUnit_Assert.php diff -u pear/PHPUnit/PHPUnit_Assert.php:1.2 pear/PHPUnit/PHPUnit_Assert.php:1.3 --- pear/PHPUnit/PHPUnit_Assert.php:1.2 Tue Dec 11 14:45:52 2001 +++ pear/PHPUnit/PHPUnit_Assert.php Mon Jun 3 08:45:32 2002 @@ -14,9 +14,10 @@ // | license@php.net so we can mail you a copy immediately. | // +----------------------------------------------------------------------+ // | Author: Sebastian Bergmann <sb@sebastian-bergmann.de> | +// | M@rms <marms@marms.com> | // +----------------------------------------------------------------------+ // -// $Id: PHPUnit_Assert.php,v 1.2 2001/12/11 19:45:52 sebastian Exp $ +// $Id: PHPUnit_Assert.php,v 1.3 2002/06/03 12:45:32 sebastian Exp $ // /** @@ -130,6 +131,33 @@ return $this->pass(); } + /** + * Asserts that a condition match a given RegExp. + * + * @param string $pattern A RegExp to use as a + * validation rule against the actual value + * @param string $mixed The actual value + * @param string $message The message to display if the test fail. + * @return void + * @access public + * @author M@rms <marms@marms.com> + */ + function assertRegExp($pattern, $actual, $message = '') { + if (empty($message)) { + $message = sprintf( + 'expected a RegExp matching "%s", actual "%s"', + $pattern, + $actual + ); + } + + if (!preg_match($pattern, $actual)) { + return $this->fail($message); + } + + return $this->pass(); + } + /** * Fails a test with the given message. * Index: pear/PHPUnit/package.xml diff -u pear/PHPUnit/package.xml:1.9 pear/PHPUnit/package.xml:1.10 --- pear/PHPUnit/package.xml:1.9 Tue Apr 9 00:48:56 2002 +++ pear/PHPUnit/package.xml Mon Jun 3 08:45:32 2002 @@ -18,9 +18,13 @@ </maintainer> </maintainers> <release> - <version>0.1</version> - <date>2002-04-06</date> - <notes><![CDATA[First release.]]> + <version>0.2</version> + <date>2002-XX-XX</date> + <notes> +<![CDATA[ +* Added PHPUnit_Assert::assertRegExp(). + (Patch by M@rms <marms@marms.com>) +]]> </notes> <filelist> <dir name="/" baseinstalldir="PHPUnit"> @@ -37,4 +41,15 @@ </dir> </filelist> </release> + <changelog> + <release> + <version>0.1</version> + <date>2002-04-06</date> + <notes> +<![CDATA[ +First release. +]]> + </notes> + </release> + </changelog> </package>

« previous php.pear.cvs (#4387) next »