示例#1
0
 public function testPatternSetAndMatch()
 {
     $object = new Rule();
     $object->disallow('/section*');
     $this->assertFalse($object->match('/section/tout/cetuqiadjoa.jpg'));
     $object->allow('/toto*.php$');
     $this->assertTrue($object->match('/toto/tata.PHP'));
     $this->assertTrue($object->match('/toto/tata.php'));
     $object->allow('/truite');
     $this->assertTrue($object->match('/truite/et/tout/cetuqiadjoa.jpg'));
     $object->disallow('/');
     $this->assertFalse($object->match('/to/tata.php'));
 }
示例#2
0
文件: Rule.php 项目: bee4/robots.txt
 public function testMultipleExpression()
 {
     $this->given($sut = new SUT(''), $sut->disallow('/foo/bar'), $sut->allow('/foo/bar/baz$'), $sut->allow('/foo$'))->when($match = $sut->match('/foo/bar'))->then->boolean($match)->isFalse()->when($match = $sut->match('/foo/bar/baz/'))->then->boolean($match)->isFalse()->when($match = $sut->match('/foo/bar/baz'))->then->boolean($match)->isTrue();
 }