-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes GH-170
- Loading branch information
haszi
committed
Jan 1, 2025
1 parent
f128079
commit 80c2cd3
Showing
3 changed files
with
115 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
tests/package/php/class_and_method_link_rendering_001.phpt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
--TEST-- | ||
Class and method link rendering 001 | ||
--FILE-- | ||
<?php | ||
namespace phpdotnet\phd; | ||
|
||
require_once __DIR__ . "/../../setup.php"; | ||
|
||
$config->setXml_file( | ||
__DIR__ . "/data/class_and_method_link_rendering_001.xml" | ||
); | ||
|
||
$indices = [ | ||
[ | ||
"docbook_id" => "class.extension-namespace-existing-class", | ||
"filename" => "extensionname.classpage", | ||
"element" => "phpdoc:classref", | ||
], | ||
[ | ||
"docbook_id" => "extension-namespace-classname.existingmethodname", | ||
"filename" => "extension-namespace-classname.methodpage", | ||
], | ||
]; | ||
|
||
$format = new TestPHPChunkedXHTML($config, $outputHandler); | ||
|
||
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 | ||
); | ||
} | ||
|
||
$format->addClassname("class.extension-namespace-existing-class", "extension\\namespace\\existing_class"); | ||
$format->addRefname("extension-namespace-classname.existingmethodname", "extension\\namespace\\classname::existingmethodname"); | ||
|
||
$render = new TestRender(new Reader($outputHandler), $config, $format); | ||
|
||
$render->run(); | ||
?> | ||
--EXPECTF-- | ||
Filename: class_and_method_link_rendering.html | ||
Content: | ||
<div id="class_and_method_link_rendering" class="chapter"> | ||
|
||
<div class="section"> | ||
<p class="para">1. Class linking</p> | ||
<span class="classname"><a href="class.extension-namespace-existing-class.html" class="classname">Extension\Namespace\Existing_Class</a></span> | ||
<span class="classname"><a href="class.extension-namespace-existing-class.html" class="classname">\Extension\Namespace\Existing_Class</a></span> | ||
</div> | ||
|
||
<div class="section"> | ||
<p class="para">2. Method/Function linking</p> | ||
<span class="methodname"><a href="extension-namespace-classname.existingmethodname.html" class="methodname">Extension\Namespace\Classname::existingMethodName()</a></span> | ||
<span class="methodname"><a href="extension-namespace-classname.existingmethodname.html" class="methodname">\Extension\Namespace\Classname::existingMethodName()</a></span> | ||
</div> | ||
|
||
<div class="section"> | ||
<p class="para">3. Class linking (non-FQN) in method/function parameter and return type</p> | ||
<div class="methodsynopsis dc-description"><span class="methodname"><strong>method_name</strong></span>(<span class="methodparam"><span class="type"><a href="extensionname.classpage.html" class="type Extension\Namespace\Existing_Class">Extension\Namespace\Existing_Class</a></span> <code class="parameter">$paramName</code></span>): <span class="type"><a href="extensionname.classpage.html" class="type Extension\Namespace\Existing_Class">Extension\Namespace\Existing_Class</a></span></div> | ||
|
||
</div> | ||
|
||
<div class="section"> | ||
<p class="para">4. Class linking (FQN) in method/function parameter and return type</p> | ||
<div class="methodsynopsis dc-description"><span class="methodname"><strong>method_name</strong></span>(<span class="methodparam"><span class="type"><a href="extensionname.classpage.html" class="type Extension\Namespace\Existing_Class">\Extension\Namespace\Existing_Class</a></span> <code class="parameter">$paramName</code></span>): <span class="type"><a href="extensionname.classpage.html" class="type Extension\Namespace\Existing_Class">\Extension\Namespace\Existing_Class</a></span></div> | ||
|
||
</div> | ||
|
||
</div> |
32 changes: 32 additions & 0 deletions
32
tests/package/php/data/class_and_method_link_rendering_001.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<chapter xml:id="class_and_method_link_rendering" xmlns="http://docbook.org/ns/docbook"> | ||
|
||
<section> | ||
<para>1. Class linking</para> | ||
<classname>Extension\Namespace\Existing_Class</classname> | ||
<classname>\Extension\Namespace\Existing_Class</classname> | ||
</section> | ||
|
||
<section> | ||
<para>2. Method/Function linking</para> | ||
<methodname>Extension\Namespace\Classname::existingMethodName</methodname> | ||
<methodname>\Extension\Namespace\Classname::existingMethodName</methodname> | ||
</section> | ||
|
||
<section> | ||
<para>3. Class linking (non-FQN) in method/function parameter and return type</para> | ||
<methodsynopsis> | ||
<type>Extension\Namespace\Existing_Class</type><methodname>method_name</methodname> | ||
<methodparam><type>Extension\Namespace\Existing_Class</type><parameter>paramName</parameter></methodparam> | ||
</methodsynopsis> | ||
</section> | ||
|
||
<section> | ||
<para>4. Class linking (FQN) in method/function parameter and return type</para> | ||
<methodsynopsis> | ||
<type>\Extension\Namespace\Existing_Class</type><methodname>method_name</methodname> | ||
<methodparam><type>\Extension\Namespace\Existing_Class</type><parameter>paramName</parameter></methodparam> | ||
</methodsynopsis> | ||
</section> | ||
|
||
</chapter> |