Skip to content

Commit

Permalink
Generators: add tests for handling <standard> element
Browse files Browse the repository at this point in the history
This adds dedicated tests for specific issues which can be encountered in a `<standard>` XML element.

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
jrfnl committed Nov 23, 2024
1 parent 8b39d66 commit 3f33a50
Show file tree
Hide file tree
Showing 23 changed files with 539 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
<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="Standard-Element,-blank-line-handling" />
<h2>Standard Element, blank line handling</h2>
<p class="text">There is a blank line at the start of this standard.

And the above blank line is also deliberate to test part of the logic.

Let&#039;s also end on a blank line to test that too.</p>
<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,10 @@
# GeneratorTest Coding Standard

## Standard Element, blank line handling
There is a blank line at the start of this standard.

And the above blank line is also deliberate to test part of the logic.

Let&#039;s also end on a blank line to test that too.

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,11 @@

------------------------------------------------------------------------
| GENERATORTEST CODING STANDARD: STANDARD ELEMENT, BLANK LINE HANDLING |
------------------------------------------------------------------------

There is a blank line at the start of this standard.

And the above blank line is also deliberate to test part of the logic.

Let's also end on a blank line to test that too.

Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<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="Standard-Element,-handling-of-HTML-tags" />
<h2>Standard Element, handling of HTML tags</h2>
<p class="text">The use of <em>tags</em> in standard descriptions is allowed and their handling should be <em>safeguarded</em>.
Other tags, like &lt;a href=&quot;example.com&quot;&gt;link&lt;/a&gt;, &lt;b&gt;bold&lt;/bold&gt;, &lt;script&gt;&lt;/script&gt; are not allowed and will be encoded for display when the HTML or Markdown report is used.</p>
<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,7 @@
# GeneratorTest Coding Standard

## Standard Element, handling of HTML tags
The use of *tags* in standard descriptions is allowed and their handling should be *safeguarded*.
Other tags, like &lt;a href=&quot;example.com&quot;&gt;link&lt;/a&gt;, &lt;b&gt;bold&lt;/bold&gt;, &lt;script&gt;&lt;/script&gt; are not allowed and will be encoded for display when the HTML or Markdown report is used.

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,9 @@

--------------------------------------------------------------------------
| GENERATORTEST CODING STANDARD: STANDARD ELEMENT, HANDLING OF HTML TAGS |
--------------------------------------------------------------------------

The use of *tags* in standard descriptions is allowed and their handling should be *safeguarded*.
Other tags, like <a href="example.com">link</a>, <b>bold</bold>, <script></script> are not allowed
and will be encoded for display when the HTML or Markdown report is used.

Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<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="Standard-Element,-indentation-should-be-ignored" />
<h2>Standard Element, indentation should be ignored</h2>
<p class="text">This line has no indentation.
This line has 4 spaces indentation.
This line has 8 spaces indentation.
This line has 4 spaces indentation.</p>
<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,9 @@
# GeneratorTest Coding Standard

## Standard Element, indentation should be ignored
This line has no indentation.
This line has 4 spaces indentation.
This line has 8 spaces indentation.
This line has 4 spaces indentation.

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,10 @@

----------------------------------------------------------------------------------
| GENERATORTEST CODING STANDARD: STANDARD ELEMENT, INDENTATION SHOULD BE IGNORED |
----------------------------------------------------------------------------------

This line has no indentation.
This line has 4 spaces indentation.
This line has 8 spaces indentation.
This line has 4 spaces indentation.

Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<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="Standard-Element,-line-wrapping-handling" />
<h2>Standard Element, line wrapping handling</h2>
<p class="text">This line has to be exactly 99 chars to test part of the logic.------------------------------------
And this line has to be exactly 100 chars.----------------------------------------------------------
And here we have a line which should start wrapping as it is longer than 100 chars. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean pellentesque iaculis enim quis hendrerit. Morbi ultrices in odio pharetra commodo.</p>
<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,8 @@
# GeneratorTest Coding Standard

## Standard Element, line wrapping handling
This line has to be exactly 99 chars to test part of the logic.------------------------------------
And this line has to be exactly 100 chars.----------------------------------------------------------
And here we have a line which should start wrapping as it is longer than 100 chars. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean pellentesque iaculis enim quis hendrerit. Morbi ultrices in odio pharetra commodo.

Documentation generated on *REDACTED* by [PHP_CodeSniffer *VERSION*](https://github.com/PHPCSStandards/PHP_CodeSniffer)
Loading

0 comments on commit 3f33a50

Please sign in to comment.