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')); }
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(); }