Skip to content

Commit

Permalink
[TEST] Convert tasks.list to tasks.get because list is a reserv…
Browse files Browse the repository at this point in the history
…ed word
  • Loading branch information
polyfractal committed Apr 1, 2016
1 parent db5d794 commit e0956a5
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/Elasticsearch/Tests/YamlRunnerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ public function testYaml()
try {
$tDoc = array();
$tDoc['document'] = $this->checkForTimestamp($testFile, $document);
$tDoc['document'] = $this->checkForList($tDoc['document']);
$tDoc['document'] = $this->checkForEmptyProperty($testFile, $tDoc['document']);
$tDoc['values'] = $this->yaml->parse($tDoc['document'], false, false, true);

Expand Down Expand Up @@ -320,6 +321,7 @@ public function testFutureModeYaml()
try {
$tDoc = array();
$tDoc['document'] = $this->checkForTimestamp($testFile, $document);
$tDoc['document'] = $this->checkForList($tDoc['document']);
$tDoc['document'] = $this->checkForEmptyProperty($testFile, $tDoc['document']);
$tDoc['values'] = $this->yaml->parse($tDoc['document'], false, false, true);

Expand Down Expand Up @@ -716,6 +718,17 @@ private function checkForTimestamp($file, $document)
return $document;
}

/**
* Hack to rewrite the command `task.list` into `task.get`, since list is a reserved
* word in PHP. :/
*
* @param $file
* @return mixed
*/
private function checkForList($document) {
return str_replace("tasks.list", "tasks.get", $document);
}

private function checkForEmptyProperty($file, $document)
{
$pattern = "/{.*?('').*?:.*?{/";
Expand Down

0 comments on commit e0956a5

Please sign in to comment.