Skip to content

Commit 9819deb

Browse files
authored
Merge pull request #718 from PHPCSStandards/feature/generators-add-tests-code-sample-titles
Generators: add tests for handling code sample titles
2 parents a2de7e1 + 02fe700 commit 9819deb

13 files changed

+527
-0
lines changed
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
<html>
2+
<head>
3+
<title>GeneratorTest Coding Standards</title>
4+
<style>
5+
body {
6+
background-color: #FFFFFF;
7+
font-size: 14px;
8+
font-family: Arial, Helvetica, sans-serif;
9+
color: #000000;
10+
}
11+
12+
h1 {
13+
color: #666666;
14+
font-size: 20px;
15+
font-weight: bold;
16+
margin-top: 0px;
17+
background-color: #E6E7E8;
18+
padding: 20px;
19+
border: 1px solid #BBBBBB;
20+
}
21+
22+
h2 {
23+
color: #00A5E3;
24+
font-size: 16px;
25+
font-weight: normal;
26+
margin-top: 50px;
27+
}
28+
29+
.code-comparison {
30+
width: 100%;
31+
}
32+
33+
.code-comparison td {
34+
border: 1px solid #CCCCCC;
35+
}
36+
37+
.code-comparison-title, .code-comparison-code {
38+
font-family: Arial, Helvetica, sans-serif;
39+
font-size: 12px;
40+
color: #000000;
41+
vertical-align: top;
42+
padding: 4px;
43+
width: 50%;
44+
background-color: #F1F1F1;
45+
line-height: 15px;
46+
}
47+
48+
.code-comparison-code {
49+
font-family: Courier;
50+
background-color: #F9F9F9;
51+
}
52+
53+
.code-comparison-highlight {
54+
background-color: #DDF1F7;
55+
border: 1px solid #00A5E3;
56+
line-height: 15px;
57+
}
58+
59+
.tag-line {
60+
text-align: center;
61+
width: 100%;
62+
margin-top: 30px;
63+
font-size: 12px;
64+
}
65+
66+
.tag-line a {
67+
color: #000000;
68+
}
69+
</style>
70+
</head>
71+
<body>
72+
<h1>GeneratorTest Coding Standards</h1>
73+
<a name="Code-Title,-line-wrapping" />
74+
<h2>Code Title, line wrapping</h2>
75+
<p class="text">This is a standard block.</p>
76+
<table class="code-comparison">
77+
<tr>
78+
<td class="code-comparison-title">Valid: exactly 45 character long description.</td>
79+
<td class="code-comparison-title">Invalid: exactly 45 char long description---.</td>
80+
</tr>
81+
<tr>
82+
<td class="code-comparison-code">//&nbsp;Dummy.</td>
83+
<td class="code-comparison-code">//&nbsp;Dummy.</td>
84+
</tr>
85+
</table>
86+
<table class="code-comparison">
87+
<tr>
88+
<td class="code-comparison-title">Valid: exactly 46 character long description-.</td>
89+
<td class="code-comparison-title">Invalid: exactly 46 character long description</td>
90+
</tr>
91+
<tr>
92+
<td class="code-comparison-code">//&nbsp;Dummy.</td>
93+
<td class="code-comparison-code">//&nbsp;Dummy.</td>
94+
</tr>
95+
</table>
96+
<table class="code-comparison">
97+
<tr>
98+
<td class="code-comparison-title">Valid: exactly 47 character long description--.</td>
99+
<td class="code-comparison-title">Invalid: exactly 47 character long description.</td>
100+
</tr>
101+
<tr>
102+
<td class="code-comparison-code">//&nbsp;Dummy.</td>
103+
<td class="code-comparison-code">//&nbsp;Dummy.</td>
104+
</tr>
105+
</table>
106+
<table class="code-comparison">
107+
<tr>
108+
<td class="code-comparison-title">Valid: this description is longer than 46 characters and will wrap.</td>
109+
<td class="code-comparison-title">Invalid: this description is longer than 46 characters and will wrap.</td>
110+
</tr>
111+
<tr>
112+
<td class="code-comparison-code">//&nbsp;Dummy.</td>
113+
<td class="code-comparison-code">//&nbsp;Dummy.</td>
114+
</tr>
115+
</table>
116+
<div class="tag-line">Documentation generated on #REDACTED# by <a href="https://github.com/PHPCSStandards/PHP_CodeSniffer">PHP_CodeSniffer #VERSION#</a></div>
117+
</body>
118+
</html>
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# GeneratorTest Coding Standard
2+
3+
## Code Title, line wrapping
4+
This is a standard block.
5+
<table>
6+
<tr>
7+
<th>Valid: exactly 45 character long description.</th>
8+
<th>Invalid: exactly 45 char long description---.</th>
9+
</tr>
10+
<tr>
11+
<td>
12+
13+
// Dummy.
14+
15+
</td>
16+
<td>
17+
18+
// Dummy.
19+
20+
</td>
21+
</tr>
22+
</table>
23+
<table>
24+
<tr>
25+
<th>Valid: exactly 46 character long description-.</th>
26+
<th>Invalid: exactly 46 character long description</th>
27+
</tr>
28+
<tr>
29+
<td>
30+
31+
// Dummy.
32+
33+
</td>
34+
<td>
35+
36+
// Dummy.
37+
38+
</td>
39+
</tr>
40+
</table>
41+
<table>
42+
<tr>
43+
<th>Valid: exactly 47 character long description--.</th>
44+
<th>Invalid: exactly 47 character long description.</th>
45+
</tr>
46+
<tr>
47+
<td>
48+
49+
// Dummy.
50+
51+
</td>
52+
<td>
53+
54+
// Dummy.
55+
56+
</td>
57+
</tr>
58+
</table>
59+
<table>
60+
<tr>
61+
<th>Valid: this description is longer than 46 characters and will wrap.</th>
62+
<th>Invalid: this description is longer than 46 characters and will wrap.</th>
63+
</tr>
64+
<tr>
65+
<td>
66+
67+
// Dummy.
68+
69+
</td>
70+
<td>
71+
72+
// Dummy.
73+
74+
</td>
75+
</tr>
76+
</table>
77+
78+
Documentation generated on *REDACTED* by [PHP_CodeSniffer *VERSION*](https://github.com/PHPCSStandards/PHP_CodeSniffer)
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
2+
------------------------------------------------------------
3+
| GENERATORTEST CODING STANDARD: CODE TITLE, LINE WRAPPING |
4+
------------------------------------------------------------
5+
6+
This is a standard block.
7+
8+
----------------------------------------- CODE COMPARISON ------------------------------------------
9+
| Valid: exactly 45 character long description. | Invalid: exactly 45 char long description---. |
10+
----------------------------------------------------------------------------------------------------
11+
| // Dummy. | // Dummy. |
12+
----------------------------------------------------------------------------------------------------
13+
14+
----------------------------------------- CODE COMPARISON ------------------------------------------
15+
| Valid: exactly 46 character long description-. | Invalid: exactly 46 character long description |
16+
----------------------------------------------------------------------------------------------------
17+
| // Dummy. | // Dummy. |
18+
----------------------------------------------------------------------------------------------------
19+
20+
----------------------------------------- CODE COMPARISON ------------------------------------------
21+
| Valid: exactly 47 character long | Invalid: exactly 47 character long |
22+
| description--. | description. |
23+
----------------------------------------------------------------------------------------------------
24+
| // Dummy. | // Dummy. |
25+
----------------------------------------------------------------------------------------------------
26+
27+
----------------------------------------- CODE COMPARISON ------------------------------------------
28+
| Valid: this description is longer than 46 | Invalid: this description is longer than 46 |
29+
| characters and will wrap. | characters and will wrap. |
30+
----------------------------------------------------------------------------------------------------
31+
| // Dummy. | // Dummy. |
32+
----------------------------------------------------------------------------------------------------
33+
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
<html>
2+
<head>
3+
<title>GeneratorTest Coding Standards</title>
4+
<style>
5+
body {
6+
background-color: #FFFFFF;
7+
font-size: 14px;
8+
font-family: Arial, Helvetica, sans-serif;
9+
color: #000000;
10+
}
11+
12+
h1 {
13+
color: #666666;
14+
font-size: 20px;
15+
font-weight: bold;
16+
margin-top: 0px;
17+
background-color: #E6E7E8;
18+
padding: 20px;
19+
border: 1px solid #BBBBBB;
20+
}
21+
22+
h2 {
23+
color: #00A5E3;
24+
font-size: 16px;
25+
font-weight: normal;
26+
margin-top: 50px;
27+
}
28+
29+
.code-comparison {
30+
width: 100%;
31+
}
32+
33+
.code-comparison td {
34+
border: 1px solid #CCCCCC;
35+
}
36+
37+
.code-comparison-title, .code-comparison-code {
38+
font-family: Arial, Helvetica, sans-serif;
39+
font-size: 12px;
40+
color: #000000;
41+
vertical-align: top;
42+
padding: 4px;
43+
width: 50%;
44+
background-color: #F1F1F1;
45+
line-height: 15px;
46+
}
47+
48+
.code-comparison-code {
49+
font-family: Courier;
50+
background-color: #F9F9F9;
51+
}
52+
53+
.code-comparison-highlight {
54+
background-color: #DDF1F7;
55+
border: 1px solid #00A5E3;
56+
line-height: 15px;
57+
}
58+
59+
.tag-line {
60+
text-align: center;
61+
width: 100%;
62+
margin-top: 30px;
63+
font-size: 12px;
64+
}
65+
66+
.tag-line a {
67+
color: #000000;
68+
}
69+
</style>
70+
</head>
71+
<body>
72+
<h1>GeneratorTest Coding Standards</h1>
73+
<a name="Code-Title,-whitespace-handling" />
74+
<h2>Code Title, whitespace handling</h2>
75+
<p class="text">This is a standard block.</p>
76+
<table class="code-comparison">
77+
<tr>
78+
<td class="code-comparison-title"> Valid: spaces at start of description.</td>
79+
<td class="code-comparison-title">Invalid: spaces at end making line > 46 chars. </td>
80+
</tr>
81+
<tr>
82+
<td class="code-comparison-code">//&nbsp;Dummy.</td>
83+
<td class="code-comparison-code">//&nbsp;Dummy.</td>
84+
</tr>
85+
</table>
86+
<table class="code-comparison">
87+
<tr>
88+
<td class="code-comparison-title"> Valid: spaces at start + end of description. </td>
89+
<td class="code-comparison-title">Invalid: spaces ' ' in description.</td>
90+
</tr>
91+
<tr>
92+
<td class="code-comparison-code">//&nbsp;Note:&nbsp;description&nbsp;above&nbsp;without&nbsp;the</br>//&nbsp;trailing&nbsp;whitespace&nbsp;fits&nbsp;in&nbsp;46&nbsp;chars.</td>
93+
<td class="code-comparison-code">//&nbsp;Dummy.</td>
94+
</tr>
95+
</table>
96+
<div class="tag-line">Documentation generated on #REDACTED# by <a href="https://github.com/PHPCSStandards/PHP_CodeSniffer">PHP_CodeSniffer #VERSION#</a></div>
97+
</body>
98+
</html>
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# GeneratorTest Coding Standard
2+
3+
## Code Title, whitespace handling
4+
This is a standard block.
5+
<table>
6+
<tr>
7+
<th> Valid: spaces at start of description.</th>
8+
<th>Invalid: spaces at end making line > 46 chars. </th>
9+
</tr>
10+
<tr>
11+
<td>
12+
13+
// Dummy.
14+
15+
</td>
16+
<td>
17+
18+
// Dummy.
19+
20+
</td>
21+
</tr>
22+
</table>
23+
<table>
24+
<tr>
25+
<th> Valid: spaces at start + end of description. </th>
26+
<th>Invalid: spaces ' ' in description.</th>
27+
</tr>
28+
<tr>
29+
<td>
30+
31+
// Note: description above without the
32+
// trailing whitespace fits in 46 chars.
33+
34+
</td>
35+
<td>
36+
37+
// Dummy.
38+
39+
</td>
40+
</tr>
41+
</table>
42+
43+
Documentation generated on *REDACTED* by [PHP_CodeSniffer *VERSION*](https://github.com/PHPCSStandards/PHP_CodeSniffer)
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
------------------------------------------------------------------
3+
| GENERATORTEST CODING STANDARD: CODE TITLE, WHITESPACE HANDLING |
4+
------------------------------------------------------------------
5+
6+
This is a standard block.
7+
8+
----------------------------------------- CODE COMPARISON ------------------------------------------
9+
| Valid: spaces at start of description. | Invalid: spaces at end making line > 46 chars. |
10+
| | |
11+
----------------------------------------------------------------------------------------------------
12+
| // Dummy. | // Dummy. |
13+
----------------------------------------------------------------------------------------------------
14+
15+
----------------------------------------- CODE COMPARISON ------------------------------------------
16+
| Valid: spaces at start + end of description. | Invalid: spaces ' ' in description. |
17+
| | |
18+
----------------------------------------------------------------------------------------------------
19+
| // Note: description above without the | // Dummy. |
20+
| // trailing whitespace fits in 46 chars. | |
21+
----------------------------------------------------------------------------------------------------
22+

0 commit comments

Comments
 (0)