Esempio n. 1
0
 function testDoesMatchingWithConditionsFunction()
 {
     // Rule does not match, since port != 1337
     $rule = new Rule(".+", "test.php", "");
     $rule->addCondition(new Condition('%{SERVER_ADMIN}', '=info@example.org', ''));
     $rule->addCondition(new Condition('%{SERVER_PORT}', '=1337', ''));
     $result = $rule->rewrite($this->_request);
     $this->assertEquals(0, $result->rc);
     $this->assertEquals("/test.php", $this->_request->getFilename());
     // Rule matches, since info@example.org is correct, and we need OR
     $rule = new Rule(".+", "test.php", "");
     $rule->addCondition(new Condition('%{SERVER_ADMIN}', '=info@example.org', '[OR]'));
     $rule->addCondition(new Condition('%{SERVER_PORT}', '=1337', ''));
     $result = $rule->rewrite($this->_request);
     //$this->assertTrue($rule->matches());
     // Rule matches, since both conditions are true
     $rule = new Rule(".+", "test.php", "");
     $rule->addCondition(new Condition('%{SERVER_ADMIN}', '=info@example.org', ''));
     $rule->addCondition(new Condition('%{SERVER_PORT}', '=80', ''));
     $result = $rule->rewrite($this->_request);
     //$this->assertTrue($rule->matches());
 }