/** * @expectedException InvalidArgumentException */ public function testSettingInvalidMethodsTriggersError() { $this->req->setMethod('invalid'); }
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()); }
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]); }