PHPUnit addon
| From: | M@rms | Date: | Mon, 03 Jun 2002 08:09:00 +0000 |
| Subject: | PHPUnit addon | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-6711@lists.php.net to get a copy of this message | ||
Hi,
I've added assertRegExp method to PHPUnit_Assert.
The following method to allow a RegExp to be used as validation rule.
Can someone commit it or tell me how to obtain a write access to the
repository ?
I'd like to obtain an XML result of a test execution; is there a
better way than adding a method to PHPUnit_TestResult ? Does anyone
have a DTD he way to be used for that method, or should I made my own
proposal ?
cvs diff PHPUnit_Assert.php (in directory Z:\public_html\GeneOS\code\pear\PHPUnit\)
Index: PHPUnit_Assert.php
===================================================================
RCS file: /repository/pear/PHPUnit/PHPUnit_Assert.php,v
retrieving revision 1.2
diff -r1.2 PHPUnit_Assert.php
133a134,154
> * 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
> */
> function assertRegExp($pattern, $actual, $message = '') {
> if (empty($message)) {
> $message = 'expected a RegExp matching '.$pattern.', actual
> '.$actual;
> }
>
> if (!preg_match($pattern, $actual)) {
> return $this->fail($message);
> }
>
> return $this->pass();
> }
>
> /**
Best regards,
M@rms
--
Searching for a PHP IDE ? I've found mine: http://www.phpedit.net/