Skip to content

Commit

Permalink
[TEST] Fix for unescaped regex in tests
Browse files Browse the repository at this point in the history
PHP doesn't like unescaped forward slashes that some tests use.  This
commit removes the beginning/end slash and replaces them with a new
delimeter
  • Loading branch information
polyfractal committed Mar 24, 2014
1 parent 78cdf38 commit 146397c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion tests/Elasticsearch/Tests/YamlRunnerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,13 @@ private function assertFalsey($value)
}

private function assertRegex($pattern, $actual) {
$pattern .= "mx";
$pattern = trim($pattern);

// PHP doesn't like unescaped forward slashes, switch to a new delimeter
// to make life easier
$pattern = substr($pattern, 1, strlen($pattern)-2);
$pattern = "%$pattern%mx";
ob_flush();
$result = preg_match($pattern, $actual, $matches);
$this->assertEquals(1, $result);

Expand Down
2 changes: 1 addition & 1 deletion util/elasticsearch

0 comments on commit 146397c

Please sign in to comment.