/** * @expectedException REBuilder\Exception\Generic */ public function testCanBeAddedOnlyToCharClasses() { $pattern = new REBuilder\Pattern\SubPattern(); $class = new REBuilder\Pattern\PosixCharClass(); $pattern->addChild($class); }
/** * @dataProvider combinedOptions */ public function testCombinedOptions($capture, $name, $modifiers, $groupMatches, $onceOnly, $testCode) { $subpattern = new REBuilder\Pattern\SubPattern($capture, $name, $modifiers, $groupMatches, $onceOnly); $subpattern->addChild(new REBuilder\Pattern\Char("a")); $render = $subpattern->render(); $this->assertSame($testCode, $render); $this->assertSame(1, preg_match("/" . $render . "/", "a")); }
/** * @expectedException REBuilder\Exception\Generic */ public function testAlternationNotInAlternationGroupException() { $alternation = new REBuilder\Pattern\Alternation(); $subpattern = new REBuilder\Pattern\SubPattern(); $subpattern->addChild($alternation); }