From 0020cc962de08a1a1f84e422595b3d5975a01516 Mon Sep 17 00:00:00 2001 From: haszi Date: Sun, 25 Feb 2024 19:26:07 +0100 Subject: [PATCH] Refactor test helpers and test directory structure Refactor TestRender to use only constructor injected objects. Rename test format helper classes to indicate which package they belong to. Move TestRender and all format helper classes into the phpdotnet phd directory to enable autoloading. Remove all unnecessary lines from setup.php. Restructure test directory to follow the structure of the tested classes. --- phpdotnet/phd/Index.php | 3 - .../phd/TestGenericChunkedXHTML.php | 2 +- .../phd/TestPHPBigXHTML.php | 4 +- .../phd/TestPHPChunkedXHTML.php | 4 +- phpdotnet/phd/TestRender.php | 33 ++++++++++ tests/TestRender.php | 64 ------------------- tests/{xhtml => package/generic}/001.phpt | 23 ++----- tests/{xhtml => package/generic}/002.phpt | 23 ++----- tests/{xhtml => package/generic}/003.phpt | 23 ++----- .../{xhtml => package/generic}/data/001-1.xml | 0 tests/{xhtml => package/generic}/data/002.xml | 0 tests/{xhtml => package/generic}/data/003.xml | 0 .../generic}/data/simplelist.xml | 0 .../data/whitespace_formatting_001.xml | 0 .../generic}/simplelist_001.phpt | 21 ++---- .../generic}/whitespace_formatting_001.phpt | 21 ++---- tests/{ => package}/php/bug49101-1.phpt | 23 ++----- tests/{ => package}/php/bug49101-2.phpt | 23 ++----- tests/{ => package}/php/bug49102-1.phpt | 24 ++----- tests/package/php/bug_doc-en_GH-3179.phpt | 27 ++++++++ .../{ => package}/php/constant_links_001.phpt | 34 +++++----- tests/{ => package}/php/data/acronyms.xml | 0 tests/{ => package}/php/data/bug49101-1.xml | 0 tests/{ => package}/php/data/bug49102-1.xml | 0 .../php/data/bug_doc-en_GH-3197.xml | 0 .../{ => package}/php/data/constant_links.xml | 0 tests/{ => package}/php/data/faq001.xml | 0 ...torsynopsis_parameters-and-return-type.xml | 0 ...pe_rendering_methodsynopsis_parameters.xml | 0 ..._rendering_methodsynopsis_return_types.xml | 0 tests/{ => package}/php/data/version.xml | 0 tests/{ => package}/php/faq001.phpt | 21 ++---- .../{ => package}/php/type_rendering_001.phpt | 23 ++----- .../{ => package}/php/type_rendering_002.phpt | 23 ++----- .../{ => package}/php/type_rendering_003.phpt | 23 ++----- tests/php/bug_doc-en_GH-3179.phpt | 40 ------------ tests/setup.php | 16 ++--- 37 files changed, 145 insertions(+), 353 deletions(-) rename tests/xhtml/TestChunkedXHTML.php => phpdotnet/phd/TestGenericChunkedXHTML.php (92%) rename tests/php/TestBigXHTML.php => phpdotnet/phd/TestPHPBigXHTML.php (95%) rename tests/php/TestChunkedXHTML.php => phpdotnet/phd/TestPHPChunkedXHTML.php (93%) create mode 100644 phpdotnet/phd/TestRender.php delete mode 100644 tests/TestRender.php rename tests/{xhtml => package/generic}/001.phpt (66%) rename tests/{xhtml => package/generic}/002.phpt (86%) rename tests/{xhtml => package/generic}/003.phpt (90%) rename tests/{xhtml => package/generic}/data/001-1.xml (100%) rename tests/{xhtml => package/generic}/data/002.xml (100%) rename tests/{xhtml => package/generic}/data/003.xml (100%) rename tests/{xhtml => package/generic}/data/simplelist.xml (100%) rename tests/{xhtml => package/generic}/data/whitespace_formatting_001.xml (100%) rename tests/{xhtml => package/generic}/simplelist_001.phpt (68%) rename tests/{xhtml => package/generic}/whitespace_formatting_001.phpt (81%) rename tests/{ => package}/php/bug49101-1.phpt (66%) rename tests/{ => package}/php/bug49101-2.phpt (71%) rename tests/{ => package}/php/bug49102-1.phpt (84%) create mode 100644 tests/package/php/bug_doc-en_GH-3179.phpt rename tests/{ => package}/php/constant_links_001.phpt (62%) rename tests/{ => package}/php/data/acronyms.xml (100%) rename tests/{ => package}/php/data/bug49101-1.xml (100%) rename tests/{ => package}/php/data/bug49102-1.xml (100%) rename tests/{ => package}/php/data/bug_doc-en_GH-3197.xml (100%) rename tests/{ => package}/php/data/constant_links.xml (100%) rename tests/{ => package}/php/data/faq001.xml (100%) rename tests/{ => package}/php/data/type_rendering_constructorsynopsis_parameters-and-return-type.xml (100%) rename tests/{ => package}/php/data/type_rendering_methodsynopsis_parameters.xml (100%) rename tests/{ => package}/php/data/type_rendering_methodsynopsis_return_types.xml (100%) rename tests/{ => package}/php/data/version.xml (100%) rename tests/{ => package}/php/faq001.phpt (73%) rename tests/{ => package}/php/type_rendering_001.phpt (83%) rename tests/{ => package}/php/type_rendering_002.phpt (88%) rename tests/{ => package}/php/type_rendering_003.phpt (90%) delete mode 100644 tests/php/bug_doc-en_GH-3179.phpt diff --git a/phpdotnet/phd/Index.php b/phpdotnet/phd/Index.php index 0181067a0..e0d119d3a 100644 --- a/phpdotnet/phd/Index.php +++ b/phpdotnet/phd/Index.php @@ -527,6 +527,3 @@ public function setMembership($membership) { } } - - - diff --git a/tests/xhtml/TestChunkedXHTML.php b/phpdotnet/phd/TestGenericChunkedXHTML.php similarity index 92% rename from tests/xhtml/TestChunkedXHTML.php rename to phpdotnet/phd/TestGenericChunkedXHTML.php index 21badb292..212af20a7 100644 --- a/tests/xhtml/TestChunkedXHTML.php +++ b/phpdotnet/phd/TestGenericChunkedXHTML.php @@ -1,7 +1,7 @@ index && $this->index::requireIndexing()) { + if (!file_exists($this->config->output_dir())) { + mkdir($this->config->output_dir(), 0755); + } + $this->attach($this->index); + $this->reader->open($this->config->xml_file()); + $this->execute($this->reader); + $this->detach($this->index); + } + + if ($this->format !== null) { + $this->attach($this->format); + $this->reader->open($this->config->xml_file()); + $this->execute($this->reader); + } + } + + public function getIndex(): ?Index { + return $this->index; + } +} diff --git a/tests/TestRender.php b/tests/TestRender.php deleted file mode 100644 index f7217bf27..000000000 --- a/tests/TestRender.php +++ /dev/null @@ -1,64 +0,0 @@ -format = $format; - - if ($indices) { - foreach ($indices as $index) { - $this->format->SQLiteIndex( - null, // $context, - null, // $index, - $index["docbook_id"] ?? "", // $id, - $index["filename"] ?? "", // $filename, - $index["parent_id"] ?? "", // $parent, - $index["sdesc"] ?? "", // $sdesc, - $index["ldesc"] ?? "", // $ldesc, - $index["element"] ?? "", // $element, - $index["previous"] ?? "", // $previous, - $index["next"] ?? "", // $next, - $index["chunk"] ?? 0, // $chunk - ); - } - } - } - - $this->config = $config; - - if ($index !== null) { - $this->index = $index; - } - } - - public function run() { - $reader = new Reader(); - - if ($this->index !== null && $this->index::requireIndexing()) { - $this->attach($this->index); - $reader->open($this->config::xml_file()); - $this->execute($reader); - $this->detach($this->index); - } - - if ($this->format !== null) { - $this->attach($this->format); - $reader->open($this->config::xml_file()); - $this->execute($reader); - } - } -} - - diff --git a/tests/xhtml/001.phpt b/tests/package/generic/001.phpt similarity index 66% rename from tests/xhtml/001.phpt rename to tests/package/generic/001.phpt index 660079e2d..48e984cdc 100644 --- a/tests/xhtml/001.phpt +++ b/tests/package/generic/001.phpt @@ -4,27 +4,14 @@ CALS Table rendering true, - "xml_root" => dirname($xml_file), - "xml_file" => $xml_file, - "output_dir" => __DIR__ . "/output/", - "lang_dir" => __PHDDIR__ . "phpdotnet/phd/data/langs/", - "phpweb_version_filename" => dirname($xml_file) . '/version.xml', - "phpweb_acronym_filename" => dirname($xml_file) . '/acronyms.xml', -]); - -$format = new TestChunkedXHTML; -$render = new TestRender($format, new Config); - -if (Index::requireIndexing() && !file_exists($opts["output_dir"])) { - mkdir($opts["output_dir"], 0755); -} +Config::init(["xml_file" => $xml_file]); + +$format = new TestGenericChunkedXHTML; +$render = new TestRender(new Reader, new Config, $format); $render->run(); ?> diff --git a/tests/xhtml/002.phpt b/tests/package/generic/002.phpt similarity index 86% rename from tests/xhtml/002.phpt rename to tests/package/generic/002.phpt index 04953b3ee..b00e65d13 100644 --- a/tests/xhtml/002.phpt +++ b/tests/package/generic/002.phpt @@ -4,27 +4,14 @@ CALS Table rendering#002 true, - "xml_root" => dirname($xml_file), - "xml_file" => $xml_file, - "output_dir" => __DIR__ . "/output/", - "lang_dir" => __PHDDIR__ . "phpdotnet/phd/data/langs/", - "phpweb_version_filename" => dirname($xml_file) . '/version.xml', - "phpweb_acronym_filename" => dirname($xml_file) . '/acronyms.xml', -]); - -$format = new TestChunkedXHTML; -$render = new TestRender($format, new Config); - -if (Index::requireIndexing() && !file_exists($opts["output_dir"])) { - mkdir($opts["output_dir"], 0755); -} +Config::init(["xml_file" => $xml_file]); + +$format = new TestGenericChunkedXHTML; +$render = new TestRender(new Reader, new Config, $format); $render->run(); ?> diff --git a/tests/xhtml/003.phpt b/tests/package/generic/003.phpt similarity index 90% rename from tests/xhtml/003.phpt rename to tests/package/generic/003.phpt index ea548ee5d..512c1e3e2 100644 --- a/tests/xhtml/003.phpt +++ b/tests/package/generic/003.phpt @@ -4,27 +4,14 @@ CALS Table rendering#003 true, - "xml_root" => dirname($xml_file), - "xml_file" => $xml_file, - "output_dir" => __DIR__ . "/output/", - "lang_dir" => __PHDDIR__ . "phpdotnet/phd/data/langs/", - "phpweb_version_filename" => dirname($xml_file) . '/version.xml', - "phpweb_acronym_filename" => dirname($xml_file) . '/acronyms.xml', -]); - -$format = new TestChunkedXHTML; -$render = new TestRender($format, new Config); - -if (Index::requireIndexing() && !file_exists($opts["output_dir"])) { - mkdir($opts["output_dir"], 0755); -} +Config::init(["xml_file" => $xml_file]); + +$format = new TestGenericChunkedXHTML; +$render = new TestRender(new Reader, new Config, $format); $render->run(); ?> diff --git a/tests/xhtml/data/001-1.xml b/tests/package/generic/data/001-1.xml similarity index 100% rename from tests/xhtml/data/001-1.xml rename to tests/package/generic/data/001-1.xml diff --git a/tests/xhtml/data/002.xml b/tests/package/generic/data/002.xml similarity index 100% rename from tests/xhtml/data/002.xml rename to tests/package/generic/data/002.xml diff --git a/tests/xhtml/data/003.xml b/tests/package/generic/data/003.xml similarity index 100% rename from tests/xhtml/data/003.xml rename to tests/package/generic/data/003.xml diff --git a/tests/xhtml/data/simplelist.xml b/tests/package/generic/data/simplelist.xml similarity index 100% rename from tests/xhtml/data/simplelist.xml rename to tests/package/generic/data/simplelist.xml diff --git a/tests/xhtml/data/whitespace_formatting_001.xml b/tests/package/generic/data/whitespace_formatting_001.xml similarity index 100% rename from tests/xhtml/data/whitespace_formatting_001.xml rename to tests/package/generic/data/whitespace_formatting_001.xml diff --git a/tests/xhtml/simplelist_001.phpt b/tests/package/generic/simplelist_001.phpt similarity index 68% rename from tests/xhtml/simplelist_001.phpt rename to tests/package/generic/simplelist_001.phpt index 7d8f11664..5be5acdbe 100644 --- a/tests/xhtml/simplelist_001.phpt +++ b/tests/package/generic/simplelist_001.phpt @@ -4,27 +4,14 @@ Simplelist rendering 001 - Types and columns true, - "xml_root" => dirname($xml_file), - "xml_file" => $xml_file, - "output_dir" => __DIR__ . "/output/", - "lang_dir" => __PHDDIR__ . "phpdotnet/phd/data/langs/", - "phpweb_version_filename" => dirname($xml_file) . '/version.xml', - "phpweb_acronym_filename" => dirname($xml_file) . '/acronyms.xml', -]); +Config::init(["xml_file" => $xml_file]); -$format = new TestChunkedXHTML; -$render = new TestRender($format, new Config); - -if (Index::requireIndexing() && !file_exists($opts["output_dir"])) { - mkdir($opts["output_dir"], 0755); -} +$format = new TestGenericChunkedXHTML; +$render = new TestRender(new Reader, new Config, $format); $render->run(); ?> diff --git a/tests/xhtml/whitespace_formatting_001.phpt b/tests/package/generic/whitespace_formatting_001.phpt similarity index 81% rename from tests/xhtml/whitespace_formatting_001.phpt rename to tests/package/generic/whitespace_formatting_001.phpt index 0211b1968..8c698acaa 100644 --- a/tests/xhtml/whitespace_formatting_001.phpt +++ b/tests/package/generic/whitespace_formatting_001.phpt @@ -4,27 +4,14 @@ Whitespace formatting 001 true, - "xml_root" => dirname($xml_file), - "xml_file" => $xml_file, - "output_dir" => __DIR__ . "/output/", - "lang_dir" => __PHDDIR__ . "phpdotnet/phd/data/langs/", - "phpweb_version_filename" => dirname($xml_file) . '/version.xml', - "phpweb_acronym_filename" => dirname($xml_file) . '/acronyms.xml', -]); +Config::init(["xml_file" => $xml_file]); -$format = new TestChunkedXHTML; -$render = new TestRender($format, new Config); - -if (Index::requireIndexing() && !file_exists($opts["output_dir"])) { - mkdir($opts["output_dir"], 0755); -} +$format = new TestGenericChunkedXHTML; +$render = new TestRender(new Reader, new Config, $format); $render->run(); ?> diff --git a/tests/php/bug49101-1.phpt b/tests/package/php/bug49101-1.phpt similarity index 66% rename from tests/php/bug49101-1.phpt rename to tests/package/php/bug49101-1.phpt index 3497f8183..b8330949b 100644 --- a/tests/php/bug49101-1.phpt +++ b/tests/package/php/bug49101-1.phpt @@ -4,27 +4,14 @@ Bug #49101-1 - Thick border again true, - "xml_root" => dirname($xml_file), - "xml_file" => $xml_file, - "output_dir" => __DIR__ . "/output/", - "lang_dir" => __DIR__ . "/../../phpdotnet/phd/data/langs/", - "phpweb_version_filename" => dirname($xml_file) . '/version.xml', - "phpweb_acronym_filename" => dirname($xml_file) . '/acronyms.xml', -]); +Config::init(["xml_file" => $xml_file]); -$format = new TestChunkedXHTML; -$render = new TestRender($format, new Config); - -if (Index::requireIndexing() && !file_exists($opts["output_dir"])) { - mkdir($opts["output_dir"], 0755); -} +$format = new TestPHPChunkedXHTML; +$render = new TestRender(new Reader, new Config, $format); $render->run(); ?> @@ -88,3 +75,5 @@ Content: + + diff --git a/tests/php/bug49101-2.phpt b/tests/package/php/bug49101-2.phpt similarity index 71% rename from tests/php/bug49101-2.phpt rename to tests/package/php/bug49101-2.phpt index 1bbc53942..b44dd02c8 100644 --- a/tests/php/bug49101-2.phpt +++ b/tests/package/php/bug49101-2.phpt @@ -4,27 +4,14 @@ Bug #49101-2 - Thick border again - Big XHTML true, - "xml_root" => dirname($xml_file), - "xml_file" => $xml_file, - "output_dir" => __DIR__ . "/output/", - "lang_dir" => __DIR__ . "/../../phpdotnet/phd/data/langs/", - "phpweb_version_filename" => dirname($xml_file) . '/version.xml', - "phpweb_acronym_filename" => dirname($xml_file) . '/acronyms.xml', -]); - -$format = new TestBigXHTML; -$render = new TestRender($format, new Config); - -if (Index::requireIndexing() && !file_exists($opts["output_dir"])) { - mkdir($opts["output_dir"], 0755); -} +Config::init(["xml_file" => $xml_file]); + +$format = new TestPHPBigXHTML; +$render = new TestRender(new Reader, new Config, $format); $render->run(); ?> diff --git a/tests/php/bug49102-1.phpt b/tests/package/php/bug49102-1.phpt similarity index 84% rename from tests/php/bug49102-1.phpt rename to tests/package/php/bug49102-1.phpt index f95100d01..8b1f032d1 100644 --- a/tests/php/bug49102-1.phpt +++ b/tests/package/php/bug49102-1.phpt @@ -4,28 +4,14 @@ Bug #49102 - Class reference pages don't normalize the methodnames in PhD trunk/ true, - "xml_root" => dirname($xml_file), - "xml_file" => $xml_file, - "output_dir" => __DIR__ . "/output/", - 'language' => 'en', - "lang_dir" => __DIR__ . "/../../phpdotnet/phd/data/langs/", - "phpweb_version_filename" => dirname($xml_file) . '/version.xml', - "phpweb_acronym_filename" => dirname($xml_file) . '/acronyms.xml', -]); - -$format = new TestChunkedXHTML; -$render = new TestRender($format, new Config); - -if (Index::requireIndexing() && !file_exists($opts["output_dir"])) { - mkdir($opts["output_dir"], 0755); -} +Config::init(["xml_file" => $xml_file]); + +$format = new TestPHPChunkedXHTML; +$render = new TestRender(new Reader, new Config, $format); $render->run(); ?> diff --git a/tests/package/php/bug_doc-en_GH-3179.phpt b/tests/package/php/bug_doc-en_GH-3179.phpt new file mode 100644 index 000000000..68cdef2a5 --- /dev/null +++ b/tests/package/php/bug_doc-en_GH-3179.phpt @@ -0,0 +1,27 @@ +--TEST-- +Bug doc-en GH-3197 +--FILE-- + $xml_file]); + +$format = new TestPHPChunkedXHTML; +$render = new TestRender(new Reader, new Config, $format); + +$render->run(); +?> +--EXPECT-- +Filename: bug_doc-en_GH-3179.html +Content: +
+
+
method_name(): void
+ +
+ +
diff --git a/tests/php/constant_links_001.phpt b/tests/package/php/constant_links_001.phpt similarity index 62% rename from tests/php/constant_links_001.phpt rename to tests/package/php/constant_links_001.phpt index 300886ebc..6e40f8b90 100644 --- a/tests/php/constant_links_001.phpt +++ b/tests/package/php/constant_links_001.phpt @@ -4,20 +4,11 @@ Constant links 001 true, - "xml_root" => dirname($xml_file), - "xml_file" => $xml_file, - "output_dir" => __DIR__ . "/output/", - "lang_dir" => __PHDDIR__ . "phpdotnet/phd/data/langs/", - "phpweb_version_filename" => dirname($xml_file) . '/version.xml', - "phpweb_acronym_filename" => dirname($xml_file) . '/acronyms.xml', -]); +Config::init(["xml_file" => $xml_file]); $indices = [ [ @@ -30,13 +21,26 @@ $indices = [ ], ]; -$format = new TestChunkedXHTML; -$render = new TestRender($format, new Config, $indices); +$format = new TestPHPChunkedXHTML; -if (Index::requireIndexing() && !file_exists($opts["output_dir"])) { - mkdir($opts["output_dir"], 0755); +foreach ($indices as $index) { + $format->SQLiteIndex( + null, // $context, + null, // $index, + $index["docbook_id"] ?? "", // $id, + $index["filename"] ?? "", // $filename, + $index["parent_id"] ?? "", // $parent, + $index["sdesc"] ?? "", // $sdesc, + $index["ldesc"] ?? "", // $ldesc, + $index["element"] ?? "", // $element, + $index["previous"] ?? "", // $previous, + $index["next"] ?? "", // $next, + $index["chunk"] ?? 0, // $chunk + ); } +$render = new TestRender(new Reader, new Config, $format); + $render->run(); ?> --EXPECTF-- diff --git a/tests/php/data/acronyms.xml b/tests/package/php/data/acronyms.xml similarity index 100% rename from tests/php/data/acronyms.xml rename to tests/package/php/data/acronyms.xml diff --git a/tests/php/data/bug49101-1.xml b/tests/package/php/data/bug49101-1.xml similarity index 100% rename from tests/php/data/bug49101-1.xml rename to tests/package/php/data/bug49101-1.xml diff --git a/tests/php/data/bug49102-1.xml b/tests/package/php/data/bug49102-1.xml similarity index 100% rename from tests/php/data/bug49102-1.xml rename to tests/package/php/data/bug49102-1.xml diff --git a/tests/php/data/bug_doc-en_GH-3197.xml b/tests/package/php/data/bug_doc-en_GH-3197.xml similarity index 100% rename from tests/php/data/bug_doc-en_GH-3197.xml rename to tests/package/php/data/bug_doc-en_GH-3197.xml diff --git a/tests/php/data/constant_links.xml b/tests/package/php/data/constant_links.xml similarity index 100% rename from tests/php/data/constant_links.xml rename to tests/package/php/data/constant_links.xml diff --git a/tests/php/data/faq001.xml b/tests/package/php/data/faq001.xml similarity index 100% rename from tests/php/data/faq001.xml rename to tests/package/php/data/faq001.xml diff --git a/tests/php/data/type_rendering_constructorsynopsis_parameters-and-return-type.xml b/tests/package/php/data/type_rendering_constructorsynopsis_parameters-and-return-type.xml similarity index 100% rename from tests/php/data/type_rendering_constructorsynopsis_parameters-and-return-type.xml rename to tests/package/php/data/type_rendering_constructorsynopsis_parameters-and-return-type.xml diff --git a/tests/php/data/type_rendering_methodsynopsis_parameters.xml b/tests/package/php/data/type_rendering_methodsynopsis_parameters.xml similarity index 100% rename from tests/php/data/type_rendering_methodsynopsis_parameters.xml rename to tests/package/php/data/type_rendering_methodsynopsis_parameters.xml diff --git a/tests/php/data/type_rendering_methodsynopsis_return_types.xml b/tests/package/php/data/type_rendering_methodsynopsis_return_types.xml similarity index 100% rename from tests/php/data/type_rendering_methodsynopsis_return_types.xml rename to tests/package/php/data/type_rendering_methodsynopsis_return_types.xml diff --git a/tests/php/data/version.xml b/tests/package/php/data/version.xml similarity index 100% rename from tests/php/data/version.xml rename to tests/package/php/data/version.xml diff --git a/tests/php/faq001.phpt b/tests/package/php/faq001.phpt similarity index 73% rename from tests/php/faq001.phpt rename to tests/package/php/faq001.phpt index c729d2e1d..5f2216305 100644 --- a/tests/php/faq001.phpt +++ b/tests/package/php/faq001.phpt @@ -4,27 +4,14 @@ Testing a simple FAQ false, - "xml_root" => dirname($xml_file), - "xml_file" => $xml_file, - "output_dir" => __DIR__ . "/output/", - "lang_dir" => __DIR__ . "/../../phpdotnet/phd/data/langs/", - "phpweb_version_filename" => dirname($xml_file) . '/version.xml', - "phpweb_acronym_filename" => dirname($xml_file) . '/acronyms.xml', -]); +Config::init(["xml_file" => $xml_file]); -$format = new TestChunkedXHTML; -$render = new TestRender($format, new Config); - -if (Index::requireIndexing() && !file_exists($opts["output_dir"])) { - mkdir($opts["output_dir"], 0755); -} +$format = new TestPHPChunkedXHTML; +$render = new TestRender(new Reader, new Config, $format); $render->run(); ?> diff --git a/tests/php/type_rendering_001.phpt b/tests/package/php/type_rendering_001.phpt similarity index 83% rename from tests/php/type_rendering_001.phpt rename to tests/package/php/type_rendering_001.phpt index 2e223a0b7..ed29ea180 100644 --- a/tests/php/type_rendering_001.phpt +++ b/tests/package/php/type_rendering_001.phpt @@ -4,27 +4,14 @@ Type rendering 001 - Methodsynopsis return types true, - "xml_root" => dirname($xml_file), - "xml_file" => $xml_file, - "output_dir" => __DIR__ . "/output/", - "lang_dir" => __PHDDIR__ . "phpdotnet/phd/data/langs/", - "phpweb_version_filename" => dirname($xml_file) . '/version.xml', - "phpweb_acronym_filename" => dirname($xml_file) . '/acronyms.xml', -]); - -$format = new TestChunkedXHTML; -$render = new TestRender($format, new Config); - -if (Index::requireIndexing() && !file_exists($opts["output_dir"])) { - mkdir($opts["output_dir"], 0755); -} +Config::init(["xml_file" => $xml_file]); + +$format = new TestPHPChunkedXHTML; +$render = new TestRender(new Reader, new Config, $format); $render->run(); ?> diff --git a/tests/php/type_rendering_002.phpt b/tests/package/php/type_rendering_002.phpt similarity index 88% rename from tests/php/type_rendering_002.phpt rename to tests/package/php/type_rendering_002.phpt index 513f7f43e..d1a515316 100644 --- a/tests/php/type_rendering_002.phpt +++ b/tests/package/php/type_rendering_002.phpt @@ -4,27 +4,14 @@ Type rendering 002 - Methodsynopsis parameters and parameter types true, - "xml_root" => dirname($xml_file), - "xml_file" => $xml_file, - "output_dir" => __DIR__ . "/output/", - "lang_dir" => __PHDDIR__ . "phpdotnet/phd/data/langs/", - "phpweb_version_filename" => dirname($xml_file) . '/version.xml', - "phpweb_acronym_filename" => dirname($xml_file) . '/acronyms.xml', -]); - -$format = new TestChunkedXHTML; -$render = new TestRender($format, new Config); - -if (Index::requireIndexing() && !file_exists($opts["output_dir"])) { - mkdir($opts["output_dir"], 0755); -} +Config::init(["xml_file" => $xml_file]); + +$format = new TestPHPChunkedXHTML; +$render = new TestRender(new Reader, new Config, $format); $render->run(); ?> diff --git a/tests/php/type_rendering_003.phpt b/tests/package/php/type_rendering_003.phpt similarity index 90% rename from tests/php/type_rendering_003.phpt rename to tests/package/php/type_rendering_003.phpt index 0b534367b..d4467856e 100644 --- a/tests/php/type_rendering_003.phpt +++ b/tests/package/php/type_rendering_003.phpt @@ -4,27 +4,14 @@ Type rendering 003 - Constructorsynopsis parameters and parameter types true, - "xml_root" => dirname($xml_file), - "xml_file" => $xml_file, - "output_dir" => __DIR__ . "/output/", - "lang_dir" => __PHDDIR__ . "phpdotnet/phd/data/langs/", - "phpweb_version_filename" => dirname($xml_file) . '/version.xml', - "phpweb_acronym_filename" => dirname($xml_file) . '/acronyms.xml', -]); - -$format = new TestChunkedXHTML; -$render = new TestRender($format, new Config); - -if (Index::requireIndexing() && !file_exists($opts["output_dir"])) { - mkdir($opts["output_dir"], 0755); -} +Config::init(["xml_file" => $xml_file]); + +$format = new TestPHPChunkedXHTML; +$render = new TestRender(new Reader, new Config, $format); $render->run(); ?> diff --git a/tests/php/bug_doc-en_GH-3179.phpt b/tests/php/bug_doc-en_GH-3179.phpt deleted file mode 100644 index 682ffe64a..000000000 --- a/tests/php/bug_doc-en_GH-3179.phpt +++ /dev/null @@ -1,40 +0,0 @@ ---TEST-- -Bug doc-en GH-3197 ---FILE-- - true, - "xml_root" => dirname($xml_file), - "xml_file" => $xml_file, - "output_dir" => __DIR__ . "/output/", - "lang_dir" => __PHDDIR__ . "phpdotnet/phd/data/langs/", - "phpweb_version_filename" => dirname($xml_file) . '/version.xml', - "phpweb_acronym_filename" => dirname($xml_file) . '/acronyms.xml', -]); - -$format = new TestChunkedXHTML; -$render = new TestRender($format, new Config); - -if (Index::requireIndexing() && !file_exists($opts["output_dir"])) { - mkdir($opts["output_dir"], 0755); -} - -$render->run(); -?> ---EXPECT-- -Filename: bug_doc-en_GH-3179.html -Content: -
-
-
method_name(): void
- -
- -
diff --git a/tests/setup.php b/tests/setup.php index b5612000d..ea392addc 100644 --- a/tests/setup.php +++ b/tests/setup.php @@ -5,19 +5,13 @@ define("__INSTALLDIR__", "@php_dir@" == "@"."php_dir@" ? dirname(dirname(__DIR__)) : "@php_dir@"); require_once __PHDDIR__ . "phpdotnet" . DIRECTORY_SEPARATOR . "phd" . DIRECTORY_SEPARATOR . "Autoloader.php"; -require_once __PHDDIR__ . "phpdotnet" . DIRECTORY_SEPARATOR . "phd" . DIRECTORY_SEPARATOR . "functions.php"; -require_once __PHDDIR__ . "tests" . DIRECTORY_SEPARATOR . "TestRender.php"; - spl_autoload_register(["phpdotnet\\phd\\Autoloader", "autoload"]); +require_once __PHDDIR__ . "phpdotnet" . DIRECTORY_SEPARATOR . "phd" . DIRECTORY_SEPARATOR . "functions.php"; + Config::init([ - "lang_dir" => __PHDDIR__ . DIRECTORY_SEPARATOR . "phpdotnet" . DIRECTORY_SEPARATOR - . "phd" . DIRECTORY_SEPARATOR . "data" . DIRECTORY_SEPARATOR - . "langs" . DIRECTORY_SEPARATOR, - "phpweb_version_filename" => Config::xml_root() . DIRECTORY_SEPARATOR . 'version.xml', - "phpweb_acronym_filename" => Config::xml_root() . DIRECTORY_SEPARATOR . 'entities' . DIRECTORY_SEPARATOR . 'acronyms.xml', - "phpweb_sources_filename" => Config::xml_root() . DIRECTORY_SEPARATOR . 'sources.xml', + "lang_dir" => __DIR__ . DIRECTORY_SEPARATOR . ".." . DIRECTORY_SEPARATOR + . "phpdotnet" . DIRECTORY_SEPARATOR . "phd" . DIRECTORY_SEPARATOR + . "data" . DIRECTORY_SEPARATOR . "langs" . DIRECTORY_SEPARATOR, "package_dirs" => [__PHDDIR__, __INSTALLDIR__], ]); - -