public function testToRegex() { $expected = '#foo.*bar#u'; $this->compiler->expects($this->once())->method('compile')->with($this->patternValue)->will($this->returnValue($expected)); $this->assertEquals($expected, $this->pattern->toRegex()); // Repeated call should not trigger another compile; the invocation counts enforce this assertion $this->assertEquals($expected, $this->pattern->toRegex()); }
/** * @param string $pattern * @param string $expected * @param array $options * @dataProvider regexDataProvider */ public function testToRegex($pattern, $expected, array $options = []) { $pattern = new Pattern($pattern, $options); $regex = $pattern->toRegex(); $this->assertEquals($expected, $regex); }