-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix GH-3353 incorrect function tag linking
- Loading branch information
haszi
committed
May 20, 2024
1 parent
fc84db4
commit c3759b9
Showing
5 changed files
with
145 additions
and
9 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
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
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
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,101 @@ | ||
--TEST-- | ||
Bug doc-en GH-3353 - incorrect method/function linking when a method's name and a function's name are normalized to the same string | ||
--FILE-- | ||
<?php | ||
namespace phpdotnet\phd; | ||
|
||
require_once __DIR__ . "/setup.php"; | ||
|
||
$xml_file = __DIR__ . "/data/bug_doc-en_GH-3353.xml"; | ||
|
||
Config::init([ | ||
"force_index" => true, | ||
"xml_file" => $xml_file, | ||
]); | ||
|
||
$render = new Render(); | ||
|
||
$indexRepository = new IndexRepository(new \SQLite3(":memory:")); | ||
$indexRepository->init(); | ||
Config::set_indexcache($indexRepository); | ||
|
||
|
||
// Indexing | ||
$index = new TestIndex($indexRepository); | ||
$render->attach($index); | ||
|
||
$reader = new Reader; | ||
$reader->open(Config::xml_file(), null, LIBXML_PARSEHUGE | LIBXML_XINCLUDE); | ||
$render->execute($reader); | ||
|
||
$render->detach($index); | ||
|
||
|
||
// Rendering | ||
$format = new TestPHPChunkedXHTML; | ||
$render->attach($format); | ||
|
||
$reader = new Reader; | ||
$reader->open(Config::xml_file(), null, LIBXML_PARSEHUGE | LIBXML_XINCLUDE); | ||
|
||
$render->execute($reader); | ||
?> | ||
--EXPECT-- | ||
Filename: method.and.function.html | ||
Content: | ||
<div id="method.and.function" class="refentry"> | ||
<div class="refnamediv"> | ||
<h1 class="refname">ClassName::methodName</h1> | ||
<h1 class="refname">classname_methodname</h1> | ||
<p class="verinfo">(No version information available, might only be in Git)</p><p class="refpurpose"><span class="refname">ClassName::methodName</span> -- <span class="refname">classname_methodname</span> — <span class="dc-title">1. This is the first method/function description</span></p> | ||
|
||
</div> | ||
<div class="refsect1 description" id="method.and.function-description"> | ||
<p class="para"> | ||
Link to <span class="function"><a href="method.only.html" class="function">ClassName::methodName()</a></span> | ||
and to <span class="function"><a href="function.only.html" class="function">classname_methodname()</a></span> | ||
</p> | ||
</div> | ||
|
||
</div> | ||
Filename: method.only.html | ||
Content: | ||
<div id="method.only" class="refentry"> | ||
<div class="refnamediv"> | ||
<h1 class="refname">ClassName::methodName</h1> | ||
<p class="verinfo">(No version information available, might only be in Git)</p><p class="refpurpose"><span class="refname">ClassName::methodName</span> — <span class="dc-title">2. This is the second (method) description</span></p> | ||
|
||
</div> | ||
<div class="refsect1 description" id="method.only-description"> | ||
<p class="para"> | ||
Link to <span class="function"><strong>ClassName::methodName()</strong></span> | ||
and to <span class="function"><a href="function.only.html" class="function">classname_methodname()</a></span> | ||
</p> | ||
</div> | ||
|
||
</div> | ||
Filename: function.only.html | ||
Content: | ||
<div id="function.only" class="refentry"> | ||
<div class="refnamediv"> | ||
<h1 class="refname">classname_methodname</h1> | ||
<p class="verinfo">(No version information available, might only be in Git)</p><p class="refpurpose"><span class="refname">classname_methodname</span> — <span class="dc-title">3. This is the third (function) description</span></p> | ||
|
||
</div> | ||
<div class="refsect1 description" id="function.only-description"> | ||
<p class="para"> | ||
Link to <span class="function"><a href="method.only.html" class="function">ClassName::methodName()</a></span> | ||
and to <span class="function"><strong>classname_methodname()</strong></span> | ||
</p> | ||
</div> | ||
|
||
</div> | ||
Filename: function.only.html | ||
Content: | ||
<div id="bug_doc-en_GH-3353" class="refentry"> | ||
|
||
|
||
|
||
|
||
|
||
</div> |
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,41 @@ | ||
<refentry xml:id="bug_doc-en_GH-3353"> | ||
<refentry xml:id="method.and.function"> | ||
<refnamediv> | ||
<refname>ClassName::methodName</refname> | ||
<refname>classname_methodname</refname> | ||
<refpurpose>1. This is the first method/function description</refpurpose> | ||
</refnamediv> | ||
<refsect1 role="description" xml:id="method.and.function-description"> | ||
<para> | ||
Link to <function>ClassName::methodName</function> | ||
and to <function>classname_methodname</function> | ||
</para> | ||
</refsect1> | ||
</refentry> | ||
|
||
<refentry xml:id="method.only"> | ||
<refnamediv> | ||
<refname>ClassName::methodName</refname> | ||
<refpurpose>2. This is the second (method) description</refpurpose> | ||
</refnamediv> | ||
<refsect1 role="description" xml:id="method.only-description"> | ||
<para> | ||
Link to <function>ClassName::methodName</function> | ||
and to <function>classname_methodname</function> | ||
</para> | ||
</refsect1> | ||
</refentry> | ||
|
||
<refentry xml:id="function.only"> | ||
<refnamediv> | ||
<refname>classname_methodname</refname> | ||
<refpurpose>3. This is the third (function) description</refpurpose> | ||
</refnamediv> | ||
<refsect1 role="description" xml:id="function.only-description"> | ||
<para> | ||
Link to <function>ClassName::methodName</function> | ||
and to <function>classname_methodname</function> | ||
</para> | ||
</refsect1> | ||
</refentry> | ||
</refentry> |