Skip to content

Commit e0956a5

Browse files
committed
[TEST] Convert tasks.list to tasks.get because list is a reserved word
1 parent db5d794 commit e0956a5

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tests/Elasticsearch/Tests/YamlRunnerTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@ public function testYaml()
251251
try {
252252
$tDoc = array();
253253
$tDoc['document'] = $this->checkForTimestamp($testFile, $document);
254+
$tDoc['document'] = $this->checkForList($tDoc['document']);
254255
$tDoc['document'] = $this->checkForEmptyProperty($testFile, $tDoc['document']);
255256
$tDoc['values'] = $this->yaml->parse($tDoc['document'], false, false, true);
256257

@@ -320,6 +321,7 @@ public function testFutureModeYaml()
320321
try {
321322
$tDoc = array();
322323
$tDoc['document'] = $this->checkForTimestamp($testFile, $document);
324+
$tDoc['document'] = $this->checkForList($tDoc['document']);
323325
$tDoc['document'] = $this->checkForEmptyProperty($testFile, $tDoc['document']);
324326
$tDoc['values'] = $this->yaml->parse($tDoc['document'], false, false, true);
325327

@@ -716,6 +718,17 @@ private function checkForTimestamp($file, $document)
716718
return $document;
717719
}
718720

721+
/**
722+
* Hack to rewrite the command `task.list` into `task.get`, since list is a reserved
723+
* word in PHP. :/
724+
*
725+
* @param $file
726+
* @return mixed
727+
*/
728+
private function checkForList($document) {
729+
return str_replace("tasks.list", "tasks.get", $document);
730+
}
731+
719732
private function checkForEmptyProperty($file, $document)
720733
{
721734
$pattern = "/{.*?('').*?:.*?{/";

0 commit comments

Comments
 (0)