Skip to content

Commit

Permalink
Merge pull request #718 from PHPCSStandards/feature/generators-add-te…
Browse files Browse the repository at this point in the history
…sts-code-sample-titles

Generators: add tests for handling code sample titles
  • Loading branch information
jrfnl authored Nov 23, 2024
2 parents a2de7e1 + 02fe700 commit 9819deb
Show file tree
Hide file tree
Showing 13 changed files with 527 additions and 0 deletions.
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">//&nbsp;Dummy.</td>
<td class="code-comparison-code">//&nbsp;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">//&nbsp;Dummy.</td>
<td class="code-comparison-code">//&nbsp;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">//&nbsp;Dummy.</td>
<td class="code-comparison-code">//&nbsp;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">//&nbsp;Dummy.</td>
<td class="code-comparison-code">//&nbsp;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>
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)
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. |
----------------------------------------------------------------------------------------------------

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">//&nbsp;Dummy.</td>
<td class="code-comparison-code">//&nbsp;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">//&nbsp;Note:&nbsp;description&nbsp;above&nbsp;without&nbsp;the</br>//&nbsp;trailing&nbsp;whitespace&nbsp;fits&nbsp;in&nbsp;46&nbsp;chars.</td>
<td class="code-comparison-code">//&nbsp;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>
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)
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. | |
----------------------------------------------------------------------------------------------------

Loading

0 comments on commit 9819deb

Please sign in to comment.