Skip to content

Commit a9c5b3a

Browse files
committed
fix tests
1 parent 24762b1 commit a9c5b3a

3 files changed

Lines changed: 156 additions & 4 deletions

File tree

tests/package/generic/attribute_formatting_005.phpt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ Content:
5555
<p class="para">1. Attribute with literal named arguments</p>
5656
<div class="classsynopsis"><div class="classsynopsisinfo">
5757

58-
<span class="attribute">#[<a href="class.deprecated.html">\Deprecated</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<code class="parameter">since</code>: <span class="type string">'8.5'</span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<code class="parameter">message</code>: <span class="type string">'Deprecated since PHP 8.4'</span><br>)]</span><br>
58+
<span class="attribute">#[<a href="class.deprecated.html">\Deprecated</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<code class="parameter">since</code>: <span class="type string">'8.5'</span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<code class="parameter">message</code>: <span class="type string">'Deprecated since PHP 8.4'</span>,<br>)]</span><br>
5959
<span class="modifier">final</span>
6060
<span class="modifier">class</span> <strong class="classname">Deprecated</strong>
6161
{</div>
@@ -99,7 +99,7 @@ Content:
9999
<p class="para">5. Multi-line attribute with literal class constant arguments</p>
100100
<div class="classsynopsis"><div class="classsynopsisinfo">
101101

102-
<span class="attribute">#[<a href="class.attribute.html">\Attribute</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<a href="class.attribute.html#attribute.constants.target-function">Attribute::TARGET_FUNCTION</a><br>&nbsp;&nbsp;&nbsp;&nbsp;| <a href="class.attribute.html#attribute.constants.target-method">Attribute::TARGET_METHOD</a><br>&nbsp;&nbsp;&nbsp;&nbsp;| <a href="class.attribute.html#attribute.constants.target-class">Attribute::TARGET_CLASS</a><br>)]</span><br>
102+
<span class="attribute">#[<a href="class.attribute.html">\Attribute</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<a href="class.attribute.html#attribute.constants.target-function">Attribute::TARGET_FUNCTION</a><br>&nbsp;&nbsp;&nbsp;&nbsp;| <a href="class.attribute.html#attribute.constants.target-method">Attribute::TARGET_METHOD</a><br>&nbsp;&nbsp;&nbsp;&nbsp;| <a href="class.attribute.html#attribute.constants.target-class">Attribute::TARGET_CLASS</a>,<br>)]</span><br>
103103
<span class="modifier">final</span>
104104
<span class="modifier">class</span> <strong class="classname">Deprecated</strong>
105105
{</div>
@@ -110,7 +110,7 @@ Content:
110110
<p class="para">6. Attribute with mix of known and unknown class constants</p>
111111
<div class="classsynopsis"><div class="classsynopsisinfo">
112112

113-
<span class="attribute">#[<a href="class.attribute.html">\Attribute</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<a href="class.attribute.html#attribute.constants.target-class">Attribute::TARGET_CLASS</a><br>&nbsp;&nbsp;&nbsp;&nbsp;| Unknown::CONST<br>)]</span><br>
113+
<span class="attribute">#[<a href="class.attribute.html">\Attribute</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<a href="class.attribute.html#attribute.constants.target-class">Attribute::TARGET_CLASS</a><br>&nbsp;&nbsp;&nbsp;&nbsp;| Unknown::CONST,<br>)]</span><br>
114114
<span class="modifier">final</span>
115115
<span class="modifier">class</span> <strong class="classname">Deprecated</strong>
116116
{</div>
@@ -121,7 +121,7 @@ Content:
121121
<p class="para">7. Attribute with bool, null, int and float literal arguments</p>
122122
<div class="classsynopsis"><div class="classsynopsisinfo">
123123

124-
<span class="attribute">#[\UnknownAttribute(<br>&nbsp;&nbsp;&nbsp;&nbsp;<code class="parameter">enabled</code>: <span class="type true">true</span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<code class="parameter">fallback</code>: <span class="type false">false</span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<code class="parameter">default</code>: <span class="type null">null</span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<code class="parameter">count</code>: <span class="type int">42</span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<code class="parameter">ratio</code>: <span class="type float">3.14</span><br>)]</span><br>
124+
<span class="attribute">#[\UnknownAttribute(<br>&nbsp;&nbsp;&nbsp;&nbsp;<code class="parameter">enabled</code>: <span class="type true">true</span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<code class="parameter">fallback</code>: <span class="type false">false</span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<code class="parameter">default</code>: <span class="type null">null</span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<code class="parameter">count</code>: <span class="type int">42</span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<code class="parameter">ratio</code>: <span class="type float">3.14</span>,<br>)]</span><br>
125125
<span class="modifier">final</span>
126126
<span class="modifier">class</span> <strong class="classname">Deprecated</strong>
127127
{</div>
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
--TEST--
2+
Attribute formatting 006 - methodparam attribute rendering (inline)
3+
--FILE--
4+
<?php
5+
namespace phpdotnet\phd;
6+
7+
require_once __DIR__ . "/../../setup.php";
8+
9+
$xmlFile = __DIR__ . "/data/attribute_formatting_006.xml";
10+
11+
$config->xmlFile = $xmlFile;
12+
13+
$format = new TestGenericChunkedXHTML($config, $outputHandler);
14+
15+
$format->SQLiteIndex(
16+
null, null,
17+
"class.sensitiveparameter",
18+
"class.sensitiveparameter",
19+
"", "", "", "", "", "", 0,
20+
);
21+
$format->SQLiteIndex(
22+
null, null,
23+
"class.deprecated",
24+
"class.deprecated",
25+
"", "", "", "", "", "", 0,
26+
);
27+
$format->SQLiteIndex(
28+
null, null,
29+
"class.attribute",
30+
"class.attribute",
31+
"", "", "", "", "", "", 0,
32+
);
33+
$format->SQLiteIndex(
34+
null, null,
35+
"attribute.constants.target-parameter",
36+
"class.attribute",
37+
"", "", "", "", "", "", 0,
38+
);
39+
$format->SQLiteIndex(
40+
null, null,
41+
"attribute.constants.target-property",
42+
"class.attribute",
43+
"", "", "", "", "", "", 0,
44+
);
45+
46+
$render = new TestRender(new Reader($outputHandler), $config, $format);
47+
48+
$render->run();
49+
?>
50+
--EXPECT--
51+
Filename: attribute-formatting-006.html
52+
Content:
53+
<div id="attribute-formatting-006" class="chapter">
54+
<div class="section">
55+
<p class="para">1. methodparam with unknown attribute</p>
56+
<div class="methodsynopsis dc-description"><span class="type">void</span> <span class="methodname">example1</span>(<span class="methodparam"><span class="attribute">#[\UnknownAttribute]</span><span class="type">string</span> <code class="parameter">$password</code></span>)</div>
57+
58+
</div>
59+
60+
<div class="section">
61+
<p class="para">2. methodparam with known attribute</p>
62+
<div class="methodsynopsis dc-description"><span class="type">void</span> <span class="methodname">example2</span>(<span class="methodparam"><span class="attribute"><a href="class.sensitiveparameter.html">#[\SensitiveParameter]</a> </span><span class="type">string</span> <code class="parameter">$password</code></span>)</div>
63+
64+
</div>
65+
66+
<div class="section">
67+
<p class="para">3. methodparam with attribute with named args (rendered inline)</p>
68+
<div class="methodsynopsis dc-description"><span class="type">void</span> <span class="methodname">example3</span>(<span class="methodparam"><span class="attribute">#[<a href="class.deprecated.html">\Deprecated</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<code class="parameter">since</code>: <span class="type string">'8.5'</span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<code class="parameter">message</code>: <span class="type string">'Use foo()'</span>,<br>)]</span><span class="type">string</span> <code class="parameter">$password</code></span>)</div>
69+
70+
</div>
71+
72+
<div class="section">
73+
<p class="para">4. methodparam with attribute with single constant arg</p>
74+
<div class="methodsynopsis dc-description"><span class="type">void</span> <span class="methodname">example4</span>(<span class="methodparam"><span class="attribute">#[<a href="class.attribute.html">\Attribute</a>(<a href="class.attribute.html#attribute.constants.target-parameter">Attribute::TARGET_PARAMETER</a>)]</span><span class="type">string</span> <code class="parameter">$password</code></span>)</div>
75+
76+
</div>
77+
78+
<div class="section">
79+
<p class="para">5. methodparam with attribute with pipe-separated constants (rendered inline)</p>
80+
<div class="methodsynopsis dc-description"><span class="type">void</span> <span class="methodname">example5</span>(<span class="methodparam"><span class="attribute">#[<a href="class.attribute.html">\Attribute</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<a href="class.attribute.html#attribute.constants.target-parameter">Attribute::TARGET_PARAMETER</a><br>&nbsp;&nbsp;&nbsp;&nbsp;| <a href="class.attribute.html#attribute.constants.target-property">Attribute::TARGET_PROPERTY</a>,<br>)]</span><span class="type">string</span> <code class="parameter">$password</code></span>)</div>
81+
82+
</div>
83+
84+
<div class="section">
85+
<p class="para">6. methodparam with attribute with literal args (rendered inline)</p>
86+
<div class="methodsynopsis dc-description"><span class="type">void</span> <span class="methodname">example6</span>(<span class="methodparam"><span class="attribute">#[\UnknownAttribute(<br>&nbsp;&nbsp;&nbsp;&nbsp;<code class="parameter">enabled</code>: <span class="type true">true</span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<code class="parameter">default</code>: <span class="type null">null</span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<code class="parameter">count</code>: <span class="type int">42</span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<code class="parameter">ratio</code>: <span class="type float">3.14</span>,<br>)]</span><span class="type">string</span> <code class="parameter">$password</code></span>)</div><code class="parameter">default</code>: <span class="type null">null</span>, <code class="parameter">count</code>: <span class="type int">42</span>, <code class="parameter">ratio</code>: <span class="type float">3.14</span>)]</span><span class="type">string</span> <code class="parameter">$password</code></span>)</div>
87+
88+
</div>
89+
90+
<div class="section">
91+
<p class="para">7. methodparam with multiple attributes</p>
92+
<div class="methodsynopsis dc-description"><span class="type">void</span> <span class="methodname">example7</span>(<span class="methodparam"><span class="attribute"><a href="class.sensitiveparameter.html">#[\SensitiveParameter]</a> </span><span class="attribute">#[<a href="class.deprecated.html">\Deprecated</a>(<code class="parameter">since</code>: <span class="type string">'8.5'</span>)]</span><span class="type">string</span> <code class="parameter">$password</code></span>)</div>
93+
94+
</div>
95+
</div>
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<chapter xml:id="attribute-formatting-006">
2+
<section>
3+
<para>1. methodparam with unknown attribute</para>
4+
<methodsynopsis>
5+
<type>void</type><methodname>example1</methodname>
6+
<methodparam><modifier role="attribute">#[\UnknownAttribute]</modifier><type>string</type><parameter>password</parameter></methodparam>
7+
</methodsynopsis>
8+
</section>
9+
10+
<section>
11+
<para>2. methodparam with known attribute</para>
12+
<methodsynopsis>
13+
<type>void</type><methodname>example2</methodname>
14+
<methodparam><modifier role="attribute">#[\SensitiveParameter]</modifier><type>string</type><parameter>password</parameter></methodparam>
15+
</methodsynopsis>
16+
</section>
17+
18+
<section>
19+
<para>3. methodparam with attribute with named args (rendered inline)</para>
20+
<methodsynopsis>
21+
<type>void</type><methodname>example3</methodname>
22+
<methodparam><modifier role="attribute">#[\Deprecated(since: '8.5', message: 'Use foo()')]</modifier><type>string</type><parameter>password</parameter></methodparam>
23+
</methodsynopsis>
24+
</section>
25+
26+
<section>
27+
<para>4. methodparam with attribute with single constant arg</para>
28+
<methodsynopsis>
29+
<type>void</type><methodname>example4</methodname>
30+
<methodparam><modifier role="attribute">#[\Attribute(Attribute::TARGET_PARAMETER)]</modifier><type>string</type><parameter>password</parameter></methodparam>
31+
</methodsynopsis>
32+
</section>
33+
34+
<section>
35+
<para>5. methodparam with attribute with pipe-separated constants (rendered inline)</para>
36+
<methodsynopsis>
37+
<type>void</type><methodname>example5</methodname>
38+
<methodparam><modifier role="attribute">#[\Attribute(Attribute::TARGET_PARAMETER|Attribute::TARGET_PROPERTY)]</modifier><type>string</type><parameter>password</parameter></methodparam>
39+
</methodsynopsis>
40+
</section>
41+
42+
<section>
43+
<para>6. methodparam with attribute with literal args (rendered inline)</para>
44+
<methodsynopsis>
45+
<type>void</type><methodname>example6</methodname>
46+
<methodparam><modifier role="attribute">#[\UnknownAttribute(enabled: true, default: null, count: 42, ratio: 3.14)]</modifier><type>string</type><parameter>password</parameter></methodparam>
47+
</methodsynopsis>
48+
</section>
49+
50+
<section>
51+
<para>7. methodparam with multiple attributes</para>
52+
<methodsynopsis>
53+
<type>void</type><methodname>example7</methodname>
54+
<methodparam><modifier role="attribute">#[\SensitiveParameter]</modifier><modifier role="attribute">#[\Deprecated(since: '8.5')]</modifier><type>string</type><parameter>password</parameter></methodparam>
55+
</methodsynopsis>
56+
</section>
57+
</chapter>

0 commit comments

Comments
 (0)