From 8f695d3825dbda9d7428e65552c3e9affe875a93 Mon Sep 17 00:00:00 2001 From: Jordi Kroon Date: Tue, 18 Aug 2026 21:40:37 +0200 Subject: [PATCH] Fix tests --- .gitignore | 1 + phpdotnet/phd/Package/PHP/Web.php | 2 +- tests/GH-225.phpt | 16 ++++-------- tests/helpers.php | 26 +++++++++++++++++++ tests/options/default_handler_007.phpt | 8 ++++++ tests/options/default_handler_008.phpt | 6 +++++ tests/render/data/sources.xml | 4 +++ tests/render/data/version.xml | 4 +++ .../render/en/entities/entities.acronyms.ent | 9 +++++++ tests/render/render_001.phpt | 17 +++++------- 10 files changed, 70 insertions(+), 23 deletions(-) create mode 100644 tests/helpers.php create mode 100644 tests/render/data/sources.xml create mode 100644 tests/render/data/version.xml create mode 100644 tests/render/en/entities/entities.acronyms.ent diff --git a/.gitignore b/.gitignore index 2d7e728e2..efae396c2 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ run-tests.php **/tests/**/*.diff **/tests/**/*.out* **/tests/**/*.php +!tests/helpers.php **/tests/**/*.exp **/tests/**/*.log **/tests/**/*.sh diff --git a/phpdotnet/phd/Package/PHP/Web.php b/phpdotnet/phd/Package/PHP/Web.php index 475f38706..30734ef7f 100644 --- a/phpdotnet/phd/Package/PHP/Web.php +++ b/phpdotnet/phd/Package/PHP/Web.php @@ -201,7 +201,7 @@ public function header($id) { "up" => $up, "prev" => $prev, "next" => $next, - "alternatives" => $this->cchunk["alternatives"], + "alternatives" => $this->cchunk["alternatives"] ?? [], "source" => $this->sourceInfo($id), ); $history = $this->history ?? []; diff --git a/tests/GH-225.phpt b/tests/GH-225.phpt index e8049caba..36e9a5d41 100644 --- a/tests/GH-225.phpt +++ b/tests/GH-225.phpt @@ -8,9 +8,8 @@ all isDir() ? \rmdir($file->getPathname()) : \unlink($file->getPathname()); -} -\rmdir(__DIR__ . "/../output/"); + +require_once __DIR__ . "/helpers.php"; +\phpdotnet\phd\removeOutputFolder(); ?> --EXPECTF-- %s[%d:%d:%d - Heads up ]%s Loaded config from existing file diff --git a/tests/helpers.php b/tests/helpers.php new file mode 100644 index 000000000..d1f944413 --- /dev/null +++ b/tests/helpers.php @@ -0,0 +1,26 @@ +isDir() ? \rmdir($file->getPathname()) : \unlink($file->getPathname()); + } + \rmdir($folder); +} diff --git a/tests/options/default_handler_007.phpt b/tests/options/default_handler_007.phpt index 88ee071b9..8978bc5a3 100644 --- a/tests/options/default_handler_007.phpt +++ b/tests/options/default_handler_007.phpt @@ -2,6 +2,8 @@ Default options handler 007 - Save config (short option) and quit (short option) --ARGS-- --docbook tests/options/default_handler_007.phpt -S -Q +--CONFLICTS-- +all --SKIPIF-- --CLEAN-- --EXPECTF-- %s[%d:%d:%d - Heads up ]%s Writing the config file diff --git a/tests/options/default_handler_008.phpt b/tests/options/default_handler_008.phpt index 27322cd69..607dee5af 100644 --- a/tests/options/default_handler_008.phpt +++ b/tests/options/default_handler_008.phpt @@ -14,11 +14,17 @@ if (file_exists(__DIR__ . "/../../phd.config.php")) { --CLEAN-- --EXPECTF-- %s[%d:%d:%d - Heads up ]%s Writing the config file diff --git a/tests/render/data/sources.xml b/tests/render/data/sources.xml new file mode 100644 index 000000000..4c8224ad3 --- /dev/null +++ b/tests/render/data/sources.xml @@ -0,0 +1,4 @@ + + + + diff --git a/tests/render/data/version.xml b/tests/render/data/version.xml new file mode 100644 index 000000000..9282da179 --- /dev/null +++ b/tests/render/data/version.xml @@ -0,0 +1,4 @@ + + + + diff --git a/tests/render/en/entities/entities.acronyms.ent b/tests/render/en/entities/entities.acronyms.ent new file mode 100644 index 000000000..50bad95be --- /dev/null +++ b/tests/render/en/entities/entities.acronyms.ent @@ -0,0 +1,9 @@ + + + + +Application Programming Interface + + diff --git a/tests/render/render_001.phpt b/tests/render/render_001.phpt index 1cf162bec..e6aa519b5 100644 --- a/tests/render/render_001.phpt +++ b/tests/render/render_001.phpt @@ -2,26 +2,21 @@ Render 001 - Smoke test render.php --ARGS-- --memoryindex --forceindex --package PHP --format php --docbook tests/render/data/render_001.xml +--CONFLICTS-- +all --FILE-- --CLEAN-- isDir() ? \rmdir($file->getPathname()) : \unlink($file->getPathname()); -} -\rmdir(__DIR__ . "/../../output/"); +require_once __DIR__ . "/../helpers.php"; +\phpdotnet\phd\removeOutputFolder(); ?> --EXPECTF-- %s[%d:%d:%d - Indexing ]%s Indexing...