コード例 #1
0
ファイル: RuleBookTest.php プロジェクト: minond/http
 public function testDuplicateRuleExceptionsIncludeRuleObjectThatTriggeredError()
 {
     $one = Rule::create(Rule::transpile('/api/{model}/{id}'), ['model' => '...']);
     $two = Rule::create('/api\\/(?P<model>[A-Za-z]+)/', ['model' => '...']);
     try {
         $this->rulebook->add($one);
         $this->rulebook->add($two);
     } catch (DuplicateRuleException $e) {
         $this->assertEquals($two, $e->getRule());
     } catch (Exception $e) {
         $this->fail();
     }
 }
コード例 #2
0
ファイル: RuleTest.php プロジェクト: minond/http
 public function testTemplateSetterTranspilesToExpression()
 {
     $template = '/list/{country}/{state}';
     $this->rule->setTemplate($template);
     $this->assertEquals($template, $this->rule->getTemplate());
     $this->assertEquals(Rule::transpile($template), $this->rule->getExpression());
 }