Skip to content

Commit

Permalink
Add a test
Browse files Browse the repository at this point in the history
  • Loading branch information
SakiTakamachi committed Jan 31, 2025
1 parent af50d4e commit e6aecb5
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/package/php/data/enum_link_rendering.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<chapter xml:id="enum_link_rendering" xmlns="http://docbook.org/ns/docbook">

<section>
<para>1. Existing Enum linking</para>
<enumname>Enum\Namespace\Existing_Enum</enumname>
<enumname>\Enum\Namespace\Existing_Enum</enumname>
</section>

<section>
<para>2. Nonexistent Enum</para>
<enumname>Enum\Namespace\Nonexistent_Enum</enumname>
<enumname>\Enum\Namespace\Nonexistent_Enum</enumname>
</section>

</chapter>
48 changes: 48 additions & 0 deletions tests/package/php/enum_link_rendering.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
--TEST--
Enum link rendering
--FILE--
<?php
namespace phpdotnet\phd;

require_once __DIR__ . "/../../setup.php";

$config->xmlFile = __DIR__ . "/data/enum_link_rendering.xml";

$format = new TestPHPChunkedXHTML($config, $outputHandler);
$format->SQLiteIndex(
null, // $context,
null, // $index,
"enum.enum-namespace-existing-enum", // $id,
"enumname.enumpage", // $filename,
"", // $parent,
"", // $sdesc,
"", // $ldesc,
"phpdoc:classref", // $element,
"", // $previous,
"", // $next,
0, // $chunk
);

$format->addClassname("enum.enum-namespace-existing-enum", "enum\\namespace\\existing_enum");

$render = new TestRender(new Reader($outputHandler), $config, $format);
$render->run();
?>
--EXPECTF--
Filename: enum_link_rendering.html
Content:
<div id="enum_link_rendering" class="chapter">

<div class="section">
<p class="para">1. Existing Enum linking</p>
<span class="enumname"><a href="enum.enum_link_rendering.html" class="enumname">Enum\Namespace\Existing_Enum</a></span>
<span class="enumname"><a href="enum.enum_link_rendering.html" class="enumname">\Enum\Namespace\Existing_Enum</a></span>
</div>

<div class="section">
<p class="para">2. Nonexistent Enum</p>
<span class="enumname">Enum\Namespace\Nonexistent_Enum</span>
<span class="enumname">\Enum\Namespace\Nonexistent_Enum</span>
</div>

</div>

0 comments on commit e6aecb5

Please sign in to comment.