diff --git a/phpdotnet/phd/Config.php b/phpdotnet/phd/Config.php index a80a0a8b..400fca73 100644 --- a/phpdotnet/phd/Config.php +++ b/phpdotnet/phd/Config.php @@ -140,6 +140,10 @@ public static function __callStatic($name, $params) : NULL; } + public function __call($name, $params) { + return self::__callStatic($name, $params); + } + public static function getSupportedPackages() { $packageList = array(); foreach(Config::package_dirs() as $dir) { @@ -183,5 +187,3 @@ public static function copyright() { } } - - diff --git a/phpdotnet/phd/Index.php b/phpdotnet/phd/Index.php index 0181067a..e0d119d3 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 21badb29..212af20a 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 6c74f8dc..00000000 --- a/tests/TestRender.php +++ /dev/null @@ -1,56 +0,0 @@ - $v) { - $method = "set_$k"; - Config::$method($v); - } - if (count($extra) != 0) { - Config::init($extra); - } - $classname = __NAMESPACE__ . "\\" . $formatclass; - $this->format = new $classname(); - - 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 - ); - } - } - - public function run() { - $reader = new Reader(); - $render = new Render(); - if (Index::requireIndexing()) { - $format = new Index; - $render->attach($format); - $reader->open(Config::xml_file()); - $render->execute($reader); - $render->detach($format); - } - $render->attach($this->format); - $reader->open(Config::xml_file()); - $render->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 785c089a..0f80b0c6 100644 --- a/tests/xhtml/001.phpt +++ b/tests/package/generic/001.phpt @@ -4,30 +4,14 @@ CALS Table rendering true, - "xml_root" => dirname($xml_file), - "xml_file" => $xml_file, - "output_dir" => __DIR__ . "/output/", -); +Config::init(["xml_file" => $xml_file]); -$extra = array( - "lang_dir" => __PHDDIR__ . "phpdotnet/phd/data/langs/", - "phpweb_version_filename" => dirname($xml_file) . '/version.xml', - "phpweb_acronym_filename" => dirname($xml_file) . '/acronyms.xml', -); - -$render = new TestRender($formatclass, $opts, $extra); - -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/002.phpt b/tests/package/generic/002.phpt similarity index 85% rename from tests/xhtml/002.phpt rename to tests/package/generic/002.phpt index 9483f1ab..b00e65d1 100644 --- a/tests/xhtml/002.phpt +++ b/tests/package/generic/002.phpt @@ -4,30 +4,14 @@ CALS Table rendering#002 true, - "xml_root" => dirname($xml_file), - "xml_file" => $xml_file, - "output_dir" => __DIR__ . "/output/", -); +Config::init(["xml_file" => $xml_file]); -$extra = array( - "lang_dir" => __PHDDIR__ . "phpdotnet/phd/data/langs/", - "phpweb_version_filename" => dirname($xml_file) . '/version.xml', - "phpweb_acronym_filename" => dirname($xml_file) . '/acronyms.xml', -); - -$render = new TestRender($formatclass, $opts, $extra); - -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/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 becab032..512c1e3e 100644 --- a/tests/xhtml/003.phpt +++ b/tests/package/generic/003.phpt @@ -4,30 +4,14 @@ CALS Table rendering#003 true, - "xml_root" => dirname($xml_file), - "xml_file" => $xml_file, - "output_dir" => __DIR__ . "/output/", -); +Config::init(["xml_file" => $xml_file]); -$extra = array( - "lang_dir" => __PHDDIR__ . "phpdotnet/phd/data/langs/", - "phpweb_version_filename" => dirname($xml_file) . '/version.xml', - "phpweb_acronym_filename" => dirname($xml_file) . '/acronyms.xml', -); - -$render = new TestRender($formatclass, $opts, $extra); - -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/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 67% rename from tests/xhtml/simplelist_001.phpt rename to tests/package/generic/simplelist_001.phpt index ad461a05..5be5acdb 100644 --- a/tests/xhtml/simplelist_001.phpt +++ b/tests/package/generic/simplelist_001.phpt @@ -4,30 +4,14 @@ Simplelist rendering 001 - Types and columns true, - "xml_root" => dirname($xml_file), - "xml_file" => $xml_file, - "output_dir" => __DIR__ . "/output/", -); +Config::init(["xml_file" => $xml_file]); -$extra = array( - "lang_dir" => __PHDDIR__ . "phpdotnet/phd/data/langs/", - "phpweb_version_filename" => dirname($xml_file) . '/version.xml', - "phpweb_acronym_filename" => dirname($xml_file) . '/acronyms.xml', -); - -$render = new TestRender($formatclass, $opts, $extra); - -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 80% rename from tests/xhtml/whitespace_formatting_001.phpt rename to tests/package/generic/whitespace_formatting_001.phpt index 5c1aa1d6..8c698aca 100644 --- a/tests/xhtml/whitespace_formatting_001.phpt +++ b/tests/package/generic/whitespace_formatting_001.phpt @@ -4,30 +4,14 @@ Whitespace formatting 001 true, - "xml_root" => dirname($xml_file), - "xml_file" => $xml_file, - "output_dir" => __DIR__ . "/output/", -); +Config::init(["xml_file" => $xml_file]); -$extra = array( - "lang_dir" => __PHDDIR__ . "phpdotnet/phd/data/langs/", - "phpweb_version_filename" => dirname($xml_file) . '/version.xml', - "phpweb_acronym_filename" => dirname($xml_file) . '/acronyms.xml', -); - -$render = new TestRender($formatclass, $opts, $extra); - -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 64% rename from tests/php/bug49101-1.phpt rename to tests/package/php/bug49101-1.phpt index d1f3644d..b8330949 100644 --- a/tests/php/bug49101-1.phpt +++ b/tests/package/php/bug49101-1.phpt @@ -1,33 +1,17 @@ --TEST-- -Bug #49101 - Thick border again +Bug #49101-1 - Thick border again --FILE-- true, - "xml_root" => dirname($xml_file), - "xml_file" => $xml_file, - "output_dir" => __DIR__ . "/output/", -); +Config::init(["xml_file" => $xml_file]); -$extra = array( - "lang_dir" => __DIR__ . "/../../phpdotnet/phd/data/langs/", - "phpweb_version_filename" => dirname($xml_file) . '/version.xml', - "phpweb_acronym_filename" => dirname($xml_file) . '/acronyms.xml', -); - -$render = new TestRender($formatclass, $opts, $extra); - -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(); ?> @@ -91,3 +75,5 @@ Content: + + diff --git a/tests/php/bug49101-2.phpt b/tests/package/php/bug49101-2.phpt similarity index 68% rename from tests/php/bug49101-2.phpt rename to tests/package/php/bug49101-2.phpt index 6d04d116..b44dd02c 100644 --- a/tests/php/bug49101-2.phpt +++ b/tests/package/php/bug49101-2.phpt @@ -1,33 +1,17 @@ --TEST-- -Bug #49101 - Thick border again - Big XHTML +Bug #49101-2 - Thick border again - Big XHTML --FILE-- true, - "xml_root" => dirname($xml_file), - "xml_file" => $xml_file, - "output_dir" => __DIR__ . "/output/", -); +Config::init(["xml_file" => $xml_file]); -$extra = array( - "lang_dir" => __DIR__ . "/../../phpdotnet/phd/data/langs/", - "phpweb_version_filename" => dirname($xml_file) . '/version.xml', - "phpweb_acronym_filename" => dirname($xml_file) . '/acronyms.xml', -); - -$render = new TestRender($formatclass, $opts, $extra); - -if (Index::requireIndexing() && !file_exists($opts["output_dir"])) { - mkdir($opts["output_dir"], 0755); -} +$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 83% rename from tests/php/bug49102-1.phpt rename to tests/package/php/bug49102-1.phpt index dd3f7902..8b1f032d 100644 --- a/tests/php/bug49102-1.phpt +++ b/tests/package/php/bug49102-1.phpt @@ -4,33 +4,16 @@ 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' -); +Config::init(["xml_file" => $xml_file]); -$extra = array( - "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 TestPHPChunkedXHTML; +$render = new TestRender(new Reader, new Config, $format); -$test = new TestRender($formatclass, $opts, $extra); - -if (Index::requireIndexing() && !file_exists($opts["output_dir"])) { - mkdir($opts["output_dir"], 0755); -} - -$test->run(); +$render->run(); ?> --EXPECTF-- 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 00000000..68cdef2a --- /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: +