public function testMatchWithNonMatchingValue() { $pattern = new Pattern('foo*bar.ba[zr]?'); $this->assertFalse($pattern->match('foo.bar-bazz')); $this->assertFalse($pattern->match('foo bar.baaz')); $this->assertFalse($pattern->match('foo.bar.baz')); }
public function testMatch() { $regex = '#^foo.*bar$#u'; $this->compiler->expects($this->once())->method('compile')->with($this->patternValue)->will($this->returnValue($regex)); $this->assertTrue($this->pattern->match('foo-bar')); $this->assertFalse($this->pattern->match('-foo-bar')); $this->assertFalse($this->pattern->match('foo-bar-')); }