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