-
-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generators: add tests for handling code sample titles
This adds dedicated tests for specific issues which can be encountered with the `title` attribute for `<code>` elements. This initial set of tests for this documents the current behaviour. This behaviour may not always be the desired behaviour, in which case, this will be fixed in follow-up commits.
- Loading branch information
Showing
13 changed files
with
527 additions
and
0 deletions.
There are no files selected for viewing
118 changes: 118 additions & 0 deletions
118
tests/Core/Generators/Expectations/ExpectedOutputCodeTitleLineWrapping.html
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,118 @@ | ||
<html> | ||
<head> | ||
<title>GeneratorTest Coding Standards</title> | ||
<style> | ||
body { | ||
background-color: #FFFFFF; | ||
font-size: 14px; | ||
font-family: Arial, Helvetica, sans-serif; | ||
color: #000000; | ||
} | ||
|
||
h1 { | ||
color: #666666; | ||
font-size: 20px; | ||
font-weight: bold; | ||
margin-top: 0px; | ||
background-color: #E6E7E8; | ||
padding: 20px; | ||
border: 1px solid #BBBBBB; | ||
} | ||
|
||
h2 { | ||
color: #00A5E3; | ||
font-size: 16px; | ||
font-weight: normal; | ||
margin-top: 50px; | ||
} | ||
|
||
.code-comparison { | ||
width: 100%; | ||
} | ||
|
||
.code-comparison td { | ||
border: 1px solid #CCCCCC; | ||
} | ||
|
||
.code-comparison-title, .code-comparison-code { | ||
font-family: Arial, Helvetica, sans-serif; | ||
font-size: 12px; | ||
color: #000000; | ||
vertical-align: top; | ||
padding: 4px; | ||
width: 50%; | ||
background-color: #F1F1F1; | ||
line-height: 15px; | ||
} | ||
|
||
.code-comparison-code { | ||
font-family: Courier; | ||
background-color: #F9F9F9; | ||
} | ||
|
||
.code-comparison-highlight { | ||
background-color: #DDF1F7; | ||
border: 1px solid #00A5E3; | ||
line-height: 15px; | ||
} | ||
|
||
.tag-line { | ||
text-align: center; | ||
width: 100%; | ||
margin-top: 30px; | ||
font-size: 12px; | ||
} | ||
|
||
.tag-line a { | ||
color: #000000; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<h1>GeneratorTest Coding Standards</h1> | ||
<a name="Code-Title,-line-wrapping" /> | ||
<h2>Code Title, line wrapping</h2> | ||
<p class="text">This is a standard block.</p> | ||
<table class="code-comparison"> | ||
<tr> | ||
<td class="code-comparison-title">Valid: exactly 45 character long description.</td> | ||
<td class="code-comparison-title">Invalid: exactly 45 char long description---.</td> | ||
</tr> | ||
<tr> | ||
<td class="code-comparison-code">// Dummy.</td> | ||
<td class="code-comparison-code">// Dummy.</td> | ||
</tr> | ||
</table> | ||
<table class="code-comparison"> | ||
<tr> | ||
<td class="code-comparison-title">Valid: exactly 46 character long description-.</td> | ||
<td class="code-comparison-title">Invalid: exactly 46 character long description</td> | ||
</tr> | ||
<tr> | ||
<td class="code-comparison-code">// Dummy.</td> | ||
<td class="code-comparison-code">// Dummy.</td> | ||
</tr> | ||
</table> | ||
<table class="code-comparison"> | ||
<tr> | ||
<td class="code-comparison-title">Valid: exactly 47 character long description--.</td> | ||
<td class="code-comparison-title">Invalid: exactly 47 character long description.</td> | ||
</tr> | ||
<tr> | ||
<td class="code-comparison-code">// Dummy.</td> | ||
<td class="code-comparison-code">// Dummy.</td> | ||
</tr> | ||
</table> | ||
<table class="code-comparison"> | ||
<tr> | ||
<td class="code-comparison-title">Valid: this description is longer than 46 characters and will wrap.</td> | ||
<td class="code-comparison-title">Invalid: this description is longer than 46 characters and will wrap.</td> | ||
</tr> | ||
<tr> | ||
<td class="code-comparison-code">// Dummy.</td> | ||
<td class="code-comparison-code">// Dummy.</td> | ||
</tr> | ||
</table> | ||
<div class="tag-line">Documentation generated on #REDACTED# by <a href="https://github.com/PHPCSStandards/PHP_CodeSniffer">PHP_CodeSniffer #VERSION#</a></div> | ||
</body> | ||
</html> |
78 changes: 78 additions & 0 deletions
78
tests/Core/Generators/Expectations/ExpectedOutputCodeTitleLineWrapping.md
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,78 @@ | ||
# GeneratorTest Coding Standard | ||
|
||
## Code Title, line wrapping | ||
This is a standard block. | ||
<table> | ||
<tr> | ||
<th>Valid: exactly 45 character long description.</th> | ||
<th>Invalid: exactly 45 char long description---.</th> | ||
</tr> | ||
<tr> | ||
<td> | ||
|
||
// Dummy. | ||
|
||
</td> | ||
<td> | ||
|
||
// Dummy. | ||
|
||
</td> | ||
</tr> | ||
</table> | ||
<table> | ||
<tr> | ||
<th>Valid: exactly 46 character long description-.</th> | ||
<th>Invalid: exactly 46 character long description</th> | ||
</tr> | ||
<tr> | ||
<td> | ||
|
||
// Dummy. | ||
|
||
</td> | ||
<td> | ||
|
||
// Dummy. | ||
|
||
</td> | ||
</tr> | ||
</table> | ||
<table> | ||
<tr> | ||
<th>Valid: exactly 47 character long description--.</th> | ||
<th>Invalid: exactly 47 character long description.</th> | ||
</tr> | ||
<tr> | ||
<td> | ||
|
||
// Dummy. | ||
|
||
</td> | ||
<td> | ||
|
||
// Dummy. | ||
|
||
</td> | ||
</tr> | ||
</table> | ||
<table> | ||
<tr> | ||
<th>Valid: this description is longer than 46 characters and will wrap.</th> | ||
<th>Invalid: this description is longer than 46 characters and will wrap.</th> | ||
</tr> | ||
<tr> | ||
<td> | ||
|
||
// Dummy. | ||
|
||
</td> | ||
<td> | ||
|
||
// Dummy. | ||
|
||
</td> | ||
</tr> | ||
</table> | ||
|
||
Documentation generated on *REDACTED* by [PHP_CodeSniffer *VERSION*](https://github.com/PHPCSStandards/PHP_CodeSniffer) |
33 changes: 33 additions & 0 deletions
33
tests/Core/Generators/Expectations/ExpectedOutputCodeTitleLineWrapping.txt
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,33 @@ | ||
|
||
------------------------------------------------------------ | ||
| GENERATORTEST CODING STANDARD: CODE TITLE, LINE WRAPPING | | ||
------------------------------------------------------------ | ||
|
||
This is a standard block. | ||
|
||
----------------------------------------- CODE COMPARISON ------------------------------------------ | ||
| Valid: exactly 45 character long description. | Invalid: exactly 45 char long description---. | | ||
---------------------------------------------------------------------------------------------------- | ||
| // Dummy. | // Dummy. | | ||
---------------------------------------------------------------------------------------------------- | ||
|
||
----------------------------------------- CODE COMPARISON ------------------------------------------ | ||
| Valid: exactly 46 character long description-. | Invalid: exactly 46 character long description | | ||
---------------------------------------------------------------------------------------------------- | ||
| // Dummy. | // Dummy. | | ||
---------------------------------------------------------------------------------------------------- | ||
|
||
----------------------------------------- CODE COMPARISON ------------------------------------------ | ||
| Valid: exactly 47 character long | Invalid: exactly 47 character long | | ||
| description--. | description. | | ||
---------------------------------------------------------------------------------------------------- | ||
| // Dummy. | // Dummy. | | ||
---------------------------------------------------------------------------------------------------- | ||
|
||
----------------------------------------- CODE COMPARISON ------------------------------------------ | ||
| Valid: this description is longer than 46 | Invalid: this description is longer than 46 | | ||
| characters and will wrap. | characters and will wrap. | | ||
---------------------------------------------------------------------------------------------------- | ||
| // Dummy. | // Dummy. | | ||
---------------------------------------------------------------------------------------------------- | ||
|
98 changes: 98 additions & 0 deletions
98
tests/Core/Generators/Expectations/ExpectedOutputCodeTitleWhitespace.html
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,98 @@ | ||
<html> | ||
<head> | ||
<title>GeneratorTest Coding Standards</title> | ||
<style> | ||
body { | ||
background-color: #FFFFFF; | ||
font-size: 14px; | ||
font-family: Arial, Helvetica, sans-serif; | ||
color: #000000; | ||
} | ||
|
||
h1 { | ||
color: #666666; | ||
font-size: 20px; | ||
font-weight: bold; | ||
margin-top: 0px; | ||
background-color: #E6E7E8; | ||
padding: 20px; | ||
border: 1px solid #BBBBBB; | ||
} | ||
|
||
h2 { | ||
color: #00A5E3; | ||
font-size: 16px; | ||
font-weight: normal; | ||
margin-top: 50px; | ||
} | ||
|
||
.code-comparison { | ||
width: 100%; | ||
} | ||
|
||
.code-comparison td { | ||
border: 1px solid #CCCCCC; | ||
} | ||
|
||
.code-comparison-title, .code-comparison-code { | ||
font-family: Arial, Helvetica, sans-serif; | ||
font-size: 12px; | ||
color: #000000; | ||
vertical-align: top; | ||
padding: 4px; | ||
width: 50%; | ||
background-color: #F1F1F1; | ||
line-height: 15px; | ||
} | ||
|
||
.code-comparison-code { | ||
font-family: Courier; | ||
background-color: #F9F9F9; | ||
} | ||
|
||
.code-comparison-highlight { | ||
background-color: #DDF1F7; | ||
border: 1px solid #00A5E3; | ||
line-height: 15px; | ||
} | ||
|
||
.tag-line { | ||
text-align: center; | ||
width: 100%; | ||
margin-top: 30px; | ||
font-size: 12px; | ||
} | ||
|
||
.tag-line a { | ||
color: #000000; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<h1>GeneratorTest Coding Standards</h1> | ||
<a name="Code-Title,-whitespace-handling" /> | ||
<h2>Code Title, whitespace handling</h2> | ||
<p class="text">This is a standard block.</p> | ||
<table class="code-comparison"> | ||
<tr> | ||
<td class="code-comparison-title"> Valid: spaces at start of description.</td> | ||
<td class="code-comparison-title">Invalid: spaces at end making line > 46 chars. </td> | ||
</tr> | ||
<tr> | ||
<td class="code-comparison-code">// Dummy.</td> | ||
<td class="code-comparison-code">// Dummy.</td> | ||
</tr> | ||
</table> | ||
<table class="code-comparison"> | ||
<tr> | ||
<td class="code-comparison-title"> Valid: spaces at start + end of description. </td> | ||
<td class="code-comparison-title">Invalid: spaces ' ' in description.</td> | ||
</tr> | ||
<tr> | ||
<td class="code-comparison-code">// Note: description above without the</br>// trailing whitespace fits in 46 chars.</td> | ||
<td class="code-comparison-code">// Dummy.</td> | ||
</tr> | ||
</table> | ||
<div class="tag-line">Documentation generated on #REDACTED# by <a href="https://github.com/PHPCSStandards/PHP_CodeSniffer">PHP_CodeSniffer #VERSION#</a></div> | ||
</body> | ||
</html> |
43 changes: 43 additions & 0 deletions
43
tests/Core/Generators/Expectations/ExpectedOutputCodeTitleWhitespace.md
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,43 @@ | ||
# GeneratorTest Coding Standard | ||
|
||
## Code Title, whitespace handling | ||
This is a standard block. | ||
<table> | ||
<tr> | ||
<th> Valid: spaces at start of description.</th> | ||
<th>Invalid: spaces at end making line > 46 chars. </th> | ||
</tr> | ||
<tr> | ||
<td> | ||
|
||
// Dummy. | ||
|
||
</td> | ||
<td> | ||
|
||
// Dummy. | ||
|
||
</td> | ||
</tr> | ||
</table> | ||
<table> | ||
<tr> | ||
<th> Valid: spaces at start + end of description. </th> | ||
<th>Invalid: spaces ' ' in description.</th> | ||
</tr> | ||
<tr> | ||
<td> | ||
|
||
// Note: description above without the | ||
// trailing whitespace fits in 46 chars. | ||
|
||
</td> | ||
<td> | ||
|
||
// Dummy. | ||
|
||
</td> | ||
</tr> | ||
</table> | ||
|
||
Documentation generated on *REDACTED* by [PHP_CodeSniffer *VERSION*](https://github.com/PHPCSStandards/PHP_CodeSniffer) |
22 changes: 22 additions & 0 deletions
22
tests/Core/Generators/Expectations/ExpectedOutputCodeTitleWhitespace.txt
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,22 @@ | ||
|
||
------------------------------------------------------------------ | ||
| GENERATORTEST CODING STANDARD: CODE TITLE, WHITESPACE HANDLING | | ||
------------------------------------------------------------------ | ||
|
||
This is a standard block. | ||
|
||
----------------------------------------- CODE COMPARISON ------------------------------------------ | ||
| Valid: spaces at start of description. | Invalid: spaces at end making line > 46 chars. | | ||
| | | | ||
---------------------------------------------------------------------------------------------------- | ||
| // Dummy. | // Dummy. | | ||
---------------------------------------------------------------------------------------------------- | ||
|
||
----------------------------------------- CODE COMPARISON ------------------------------------------ | ||
| Valid: spaces at start + end of description. | Invalid: spaces ' ' in description. | | ||
| | | | ||
---------------------------------------------------------------------------------------------------- | ||
| // Note: description above without the | // Dummy. | | ||
| // trailing whitespace fits in 46 chars. | | | ||
---------------------------------------------------------------------------------------------------- | ||
|
Oops, something went wrong.