[phd] master: Fix run-tests.php after a php-src change (#266)

From: Date: Tue, 18 Aug 2026 19:44:14 +0000
Subject: [phd] master: Fix run-tests.php after a php-src change (#266)
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-23575@lists.php.net to get a copy of this message
Author: Jordi Kroon (jordikroon) Committer: GitHub (web-flow) Pusher: jordikroon Date: 2026-08-18T21:44:12+02:00 Commit: https://github.com/php/phd/commit/2b41825e06deb55c86fe7acfac3aea4443eb2daf Raw diff: https://github.com/php/phd/commit/2b41825e06deb55c86fe7acfac3aea4443eb2daf.diff Fix run-tests.php after a php-src change (#266) Changed paths: A tests/helpers.php A tests/render/data/sources.xml A tests/render/data/version.xml A tests/render/en/entities/entities.acronyms.ent M .gitignore M phpdotnet/phd/Package/PHP/Web.php M tests/GH-225.phpt M tests/options/default_handler_007.phpt M tests/options/default_handler_008.phpt M tests/render/render_001.phpt Diff: diff --git a/.gitignore b/.gitignore index 2d7e728e..efae396c 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 475f3870..30734ef7 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 e8049cab..36e9a5d4 100644 --- a/tests/GH-225.phpt +++ b/tests/GH-225.phpt @@ -8,9 +8,8 @@ all <?php namespace phpdotnet\phd; -if (!\file_exists(__DIR__ . "/../output/")) { - \mkdir(__DIR__ . "/../output/", 0777, true); -} +require_once __DIR__ . "/helpers.php"; +ensureOutputFolder(); if (\file_exists(__DIR__ . "/../phd.config.php")) { \unlink(__DIR__ . "/../phd.config.php"); @@ -27,14 +26,9 @@ require_once __DIR__ . "/../render.php"; --CLEAN-- <?php \unlink(__DIR__ . "/../phd.config.php"); -$iterator = new \RecursiveIteratorIterator( - new \RecursiveDirectoryIterator(__DIR__ . "/../output/", \FilesystemIterator::SKIP_DOTS), - \RecursiveIteratorIterator::CHILD_FIRST -); -foreach ($iterator as $file) { - $file->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 00000000..d1f94441 --- /dev/null +++ b/tests/helpers.php @@ -0,0 +1,26 @@ +<?php +namespace phpdotnet\phd; + +function ensureOutputFolder(): void +{ + if (!\file_exists(\dirname(__DIR__) . "/output/")) { + \mkdir(\dirname(__DIR__) . "/output/", 0777, true); + } +} + +function removeOutputFolder(): void +{ + $folder = \dirname(__DIR__) . "/output/"; + if (!\file_exists($folder)) { + return; + } + + $iterator = new \RecursiveIteratorIterator( + new \RecursiveDirectoryIterator($folder, \FilesystemIterator::SKIP_DOTS), + \RecursiveIteratorIterator::CHILD_FIRST + ); + foreach ($iterator as $file) { + $file->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 88ee071b..8978bc5a 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-- <?php if (file_exists(__DIR__ . "/../../phd.config.php")) { @@ -12,11 +14,17 @@ if (file_exists(__DIR__ . "/../../phd.config.php")) { <?php namespace phpdotnet\phd; +require_once __DIR__ . "/../helpers.php"; +ensureOutputFolder(); + require_once __DIR__ . "/../../render.php"; ?> --CLEAN-- <?php unlink(__DIR__ . "/../../phd.config.php"); + +require_once __DIR__ . "/../helpers.php"; +\phpdotnet\phd\removeOutputFolder(); ?> --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 27322cd6..607dee5a 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")) { <?php namespace phpdotnet\phd; +require_once __DIR__ . "/../helpers.php"; +ensureOutputFolder(); + require_once __DIR__ . "/../../render.php"; ?> --CLEAN-- <?php unlink(__DIR__ . "/../../phd.config.php"); + +require_once __DIR__ . "/../helpers.php"; +\phpdotnet\phd\removeOutputFolder(); ?> --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 00000000..4c8224ad --- /dev/null +++ b/tests/render/data/sources.xml @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<sources> + <file id="index" lang="en" path="index.xml"/> +</sources> diff --git a/tests/render/data/version.xml b/tests/render/data/version.xml new file mode 100644 index 00000000..9282da17 --- /dev/null +++ b/tests/render/data/version.xml @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<versions> + <function name="strlen" from="PHP 4, PHP 5, PHP 7, PHP 8"/> +</versions> diff --git a/tests/render/en/entities/entities.acronyms.ent b/tests/render/en/entities/entities.acronyms.ent new file mode 100644 index 00000000..50bad95b --- /dev/null +++ b/tests/render/en/entities/entities.acronyms.ent @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="utf-8"?> + +<entities xmlns = "http://docbook.org/ns/docbook" + xmlns:xlink = "http://www.w3.org/1999/xlink" + translate = "yes"> + +<entity name="acronym.expansion.API">Application Programming Interface</entity> + +</entities> diff --git a/tests/render/render_001.phpt b/tests/render/render_001.phpt index 1cf162be..e6aa519b 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-- <?php namespace phpdotnet\phd; -if (!\file_exists(__DIR__ . "/../../output/")) { - \mkdir(__DIR__ . "/../../output/", 0777, true); -} +require_once __DIR__ . "/../helpers.php"; +ensureOutputFolder(); require_once __DIR__ . "/../../render.php"; ?> --CLEAN-- <?php -$iterator = new \RecursiveIteratorIterator( - new \RecursiveDirectoryIterator(__DIR__ . "/../../output/", \FilesystemIterator::SKIP_DOTS), - \RecursiveIteratorIterator::CHILD_FIRST -); -foreach ($iterator as $file) { - $file->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...

« previous php.doc.cvs (#23575) next »