3 * This file is part of PHPUnit.
5 * (c) Sebastian Bergmann <sebastian@phpunit.de>
7 * For the full copyright and license information, please view the LICENSE
8 * file that was distributed with this source code.
12 * @since Class available since Release 4.2.0
14 class Util_RegexTest extends PHPUnit_Framework_TestCase
16 public function validRegexpProvider()
19 array('#valid regexp#', 'valid regexp', 1),
20 array(';val.*xp;', 'valid regexp', 1),
21 array('/val.*xp/i', 'VALID REGEXP', 1),
22 array('/a val.*p/','valid regexp', 0),
26 public function invalidRegexpProvider()
29 array('valid regexp', 'valid regexp'),
30 array(';val.*xp', 'valid regexp'),
31 array('val.*xp/i', 'VALID REGEXP'),
36 * @dataProvider validRegexpProvider
37 * @covers PHPUnit_Util_Regex::pregMatchSafe
39 public function testValidRegex($pattern, $subject, $return)
41 $this->assertEquals($return, PHPUnit_Util_Regex::pregMatchSafe($pattern, $subject));
45 * @dataProvider invalidRegexpProvider
46 * @covers PHPUnit_Util_Regex::pregMatchSafe
48 public function testInvalidRegex($pattern, $subject)
50 $this->assertFalse(PHPUnit_Util_Regex::pregMatchSafe($pattern, $subject));