예제 #1
0
 /**
  * @expectedException REBuilder\Exception\Generic
  */
 public function testCanBeAddedOnlyToCharClasses()
 {
     $pattern = new REBuilder\Pattern\SubPattern();
     $class = new REBuilder\Pattern\PosixCharClass();
     $pattern->addChild($class);
 }
예제 #2
0
 /**
  * @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"));
 }
예제 #3
0
 /**
  * @expectedException REBuilder\Exception\Generic
  */
 public function testAlternationNotInAlternationGroupException()
 {
     $alternation = new REBuilder\Pattern\Alternation();
     $subpattern = new REBuilder\Pattern\SubPattern();
     $subpattern->addChild($alternation);
 }