Beispiel #1
0
 /**
  * @expectedException InvalidArgumentException
  */
 public function testSettingInvalidMethodsTriggersError()
 {
     $this->req->setMethod('invalid');
 }
Beispiel #2
0
 public function testRuleIsSavedToRequest()
 {
     $req = new Request();
     $req->setMethod(Verb::GET);
     $req->setUri('/mypage');
     $rand = mt_rand();
     $rule = Rule::create('/mypage', ['random' => $rand], true);
     $this->rulebook->add($rule);
     $this->rulebook->matching($req, true);
     $this->assertEquals($rule, $req->getRule());
 }
Beispiel #3
0
 public function testRequestMethodIsProperlyCompared()
 {
     $req = new Request();
     $req->setMethod(Verb::PUT);
     $req->setUri('/mypage');
     $this->assertTrue(Rule::create(Rule::transpile('/{page}'), ['method' => Verb::PUT])->matches($req)[0]);
 }