/** * @Issue #3051 */ public function testSimilarSteps() { $pattern = 'there is a User called :arg1'; $regex = $this->loader->makePlaceholderPattern($pattern); $this->assertRegExp($regex, 'there is a User called "John"'); $this->assertNotRegExp($regex, 'there is a User called "John" and surname "Smith"'); }
public function testMatchingPatterns() { $pattern = 'hello :name, are you from :place?'; $regex = $this->loader->makePlaceholderPattern($pattern); $this->assertEquals('/hello "(.*?)", are you from "(.*?)"\\?/', $regex); $pattern = 'hello ":name", how are you'; $regex = $this->loader->makePlaceholderPattern($pattern); $this->assertEquals('/hello "(.*?)", how are you/', $regex); $pattern = 'there should be :num cow(s)'; $regex = $this->loader->makePlaceholderPattern($pattern); $this->assertRegExp($regex, 'there should be "1" cow'); $this->assertRegExp($regex, 'there should be "5" cows'); }