From eebc45cb82c0d8ccf5570928fdd938ea93fc402a Mon Sep 17 00:00:00 2001 From: "J. King" Date: Mon, 15 Feb 2021 08:44:06 -0500 Subject: [PATCH] Patch tests to suppress root commnts --- tests/cases/TestTreeConstructor.php | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/tests/cases/TestTreeConstructor.php b/tests/cases/TestTreeConstructor.php index 6dd1fa8..ad0dad9 100644 --- a/tests/cases/TestTreeConstructor.php +++ b/tests/cases/TestTreeConstructor.php @@ -28,12 +28,12 @@ class TestTreeConstructor extends \PHPUnit\Framework\TestCase { protected $depth; /** @dataProvider provideStandardTreeTests */ - public function testStandardTreeTests(string $data, array $exp, array $errors, $fragment, ?bool $scripted): void { - if ($scripted) { - $this->markTestIncomplete("Scripting is not supported"); - } elseif ($fragment) { - $this->markTestSkipped("Fragment tests still to be implemented"); + public function testStandardTreeTests(string $data, array $exp, array $errors, $fragment): void { + if ($fragment) { + $this->markTestIncomplete("Fragment tests still to be implemented"); } + // certain tests need to be patched to ignore unavoidable limitations of PHP's DOM + $exp = $this->patchTest($data, $fragment, $exp); // convert parse error constants into standard symbols in specification $errorMap = array_map(function($str) { return strtolower(str_replace("_", "-", $str)); @@ -71,6 +71,14 @@ class TestTreeConstructor extends \PHPUnit\Framework\TestCase { // TODO: evaluate errors } + protected function patchTest(string $data, $fragment, array $exp): array { + if (strpos($exp[0], "|