diff --git a/tests/Core/Generators/Expectations/ExpectedOutputCodeComparisonBlankLines.html b/tests/Core/Generators/Expectations/ExpectedOutputCodeComparisonBlankLines.html
new file mode 100644
index 0000000000..788ef612d8
--- /dev/null
+++ b/tests/Core/Generators/Expectations/ExpectedOutputCodeComparisonBlankLines.html
@@ -0,0 +1,88 @@
+
+
+ GeneratorTest Coding Standards
+
+
+
+ GeneratorTest Coding Standards
+
+ Code Comparison, blank lines
+ This is a standard block.
+
+
+ Valid: Checking handling of blank lines. |
+ Invalid: Checking handling of blank lines. |
+
+
+ // First line of the code sample is// deliberately empty.// We also have a blank line in the middle.// And a blank line at the end. |
+ // First line of the code sample is// deliberately empty.// We also have a blank line in the middle.// And a blank line at the end. |
+
+
+
+
+
diff --git a/tests/Core/Generators/Expectations/ExpectedOutputCodeComparisonBlankLines.md b/tests/Core/Generators/Expectations/ExpectedOutputCodeComparisonBlankLines.md
new file mode 100644
index 0000000000..79efd01775
--- /dev/null
+++ b/tests/Core/Generators/Expectations/ExpectedOutputCodeComparisonBlankLines.md
@@ -0,0 +1,34 @@
+# GeneratorTest Coding Standard
+
+## Code Comparison, blank lines
+This is a standard block.
+
+
+ Valid: Checking handling of blank lines. |
+ Invalid: Checking handling of blank lines. |
+
+
+
+
+ // First line of the code sample is
+ // deliberately empty.
+
+ // We also have a blank line in the middle.
+
+ // And a blank line at the end.
+
+ |
+
+
+ // First line of the code sample is
+ // deliberately empty.
+
+ // We also have a blank line in the middle.
+
+ // And a blank line at the end.
+
+ |
+
+
+
+Documentation generated on *REDACTED* by [PHP_CodeSniffer *VERSION*](https://github.com/PHPCSStandards/PHP_CodeSniffer)
diff --git a/tests/Core/Generators/Expectations/ExpectedOutputCodeComparisonBlankLines.txt b/tests/Core/Generators/Expectations/ExpectedOutputCodeComparisonBlankLines.txt
new file mode 100644
index 0000000000..a7fd41d901
--- /dev/null
+++ b/tests/Core/Generators/Expectations/ExpectedOutputCodeComparisonBlankLines.txt
@@ -0,0 +1,18 @@
+
+---------------------------------------------------------------
+| GENERATORTEST CODING STANDARD: CODE COMPARISON, BLANK LINES |
+---------------------------------------------------------------
+
+This is a standard block.
+
+----------------------------------------- CODE COMPARISON ------------------------------------------
+| Valid: Checking handling of blank lines. | Invalid: Checking handling of blank lines. |
+----------------------------------------------------------------------------------------------------
+| // First line of the code sample is | // First line of the code sample is |
+| // deliberately empty. | // deliberately empty. |
+| | |
+| // We also have a blank line in the middle. | // We also have a blank line in the middle. |
+| | |
+| // And a blank line at the end. | // And a blank line at the end. |
+----------------------------------------------------------------------------------------------------
+
diff --git a/tests/Core/Generators/Expectations/ExpectedOutputCodeComparisonBlockLength.html b/tests/Core/Generators/Expectations/ExpectedOutputCodeComparisonBlockLength.html
new file mode 100644
index 0000000000..a8bfc97f7c
--- /dev/null
+++ b/tests/Core/Generators/Expectations/ExpectedOutputCodeComparisonBlockLength.html
@@ -0,0 +1,98 @@
+
+
+ GeneratorTest Coding Standards
+
+
+
+ GeneratorTest Coding Standards
+
+ Code Comparison, block length
+ This is a standard block.
+
+
+ Valid: code sample A has more lines than B. |
+ Invalid: shorter. |
+
+
+ // This code sample has more lines// than the "invalid" one.$one = 10; |
+ $a = 10; |
+
+
+
+
+ Valid: shorter. |
+ Invalid: code sample B has more lines than A. |
+
+
+ echo $foo; |
+ // This code sample has more lines// than the "valid" one.print $foo; |
+
+
+
+
+
diff --git a/tests/Core/Generators/Expectations/ExpectedOutputCodeComparisonBlockLength.md b/tests/Core/Generators/Expectations/ExpectedOutputCodeComparisonBlockLength.md
new file mode 100644
index 0000000000..b9b64b31c6
--- /dev/null
+++ b/tests/Core/Generators/Expectations/ExpectedOutputCodeComparisonBlockLength.md
@@ -0,0 +1,46 @@
+# GeneratorTest Coding Standard
+
+## Code Comparison, block length
+This is a standard block.
+
+
+ Valid: code sample A has more lines than B. |
+ Invalid: shorter. |
+
+
+
+
+ // This code sample has more lines
+ // than the "invalid" one.
+ $one = 10;
+
+ |
+
+
+ $a = 10;
+
+ |
+
+
+
+
+ Valid: shorter. |
+ Invalid: code sample B has more lines than A. |
+
+
+
+
+ echo $foo;
+
+ |
+
+
+ // This code sample has more lines
+ // than the "valid" one.
+ print $foo;
+
+ |
+
+
+
+Documentation generated on *REDACTED* by [PHP_CodeSniffer *VERSION*](https://github.com/PHPCSStandards/PHP_CodeSniffer)
diff --git a/tests/Core/Generators/Expectations/ExpectedOutputCodeComparisonBlockLength.txt b/tests/Core/Generators/Expectations/ExpectedOutputCodeComparisonBlockLength.txt
new file mode 100644
index 0000000000..c2fb737f45
--- /dev/null
+++ b/tests/Core/Generators/Expectations/ExpectedOutputCodeComparisonBlockLength.txt
@@ -0,0 +1,23 @@
+
+----------------------------------------------------------------
+| GENERATORTEST CODING STANDARD: CODE COMPARISON, BLOCK LENGTH |
+----------------------------------------------------------------
+
+This is a standard block.
+
+----------------------------------------- CODE COMPARISON ------------------------------------------
+| Valid: code sample A has more lines than B. | Invalid: shorter. |
+----------------------------------------------------------------------------------------------------
+| // This code sample has more lines | $a = 10; |
+| // than the "invalid" one. | |
+| $one = 10; | |
+----------------------------------------------------------------------------------------------------
+
+----------------------------------------- CODE COMPARISON ------------------------------------------
+| Valid: shorter. | Invalid: code sample B has more lines than A. |
+----------------------------------------------------------------------------------------------------
+| echo $foo; | // This code sample has more lines |
+| | // than the "valid" one. |
+| | print $foo; |
+----------------------------------------------------------------------------------------------------
+
diff --git a/tests/Core/Generators/Expectations/ExpectedOutputCodeComparisonEncoding.html b/tests/Core/Generators/Expectations/ExpectedOutputCodeComparisonEncoding.html
new file mode 100644
index 0000000000..ff9f6df12b
--- /dev/null
+++ b/tests/Core/Generators/Expectations/ExpectedOutputCodeComparisonEncoding.html
@@ -0,0 +1,88 @@
+
+
+ GeneratorTest Coding Standards
+
+
+
+ GeneratorTest Coding Standards
+
+ Code Comparison, char encoding
+ This is a standard block.
+
+
+ Valid: Vestibulum et orci condimentum. |
+ Invalid: Donec in nisl ut tortor convallis interdum. |
+
+
+ <?php// The above PHP tag is specifically testing// handling of that in generated HTML doc.// Now let's also check the handling of// comparison operators in code samples...$a = $b < $c;$d = $e > $f;$g = $h <= $i;$j = $k >= $l;$m = $n <=> $o; |
+ <?php// The above PHP tag is specifically testing// handling of that in generated HTML doc.// Now let's also check the handling of// comparison operators in code samples// in combination with "em" tags.$a = $b < $c;$d = $e > $f;$g = $h <= $i;$j = $k >= $l;$m = $n <=> $o; |
+
+
+
+
+
diff --git a/tests/Core/Generators/Expectations/ExpectedOutputCodeComparisonEncoding.md b/tests/Core/Generators/Expectations/ExpectedOutputCodeComparisonEncoding.md
new file mode 100644
index 0000000000..4c3832fa3f
--- /dev/null
+++ b/tests/Core/Generators/Expectations/ExpectedOutputCodeComparisonEncoding.md
@@ -0,0 +1,47 @@
+# GeneratorTest Coding Standard
+
+## Code Comparison, char encoding
+This is a standard block.
+
+
+ Valid: Vestibulum et orci condimentum. |
+ Invalid: Donec in nisl ut tortor convallis interdum. |
+
+
+
+
+ $f;
+ $g = $h <= $i;
+ $j = $k >= $l;
+ $m = $n <=> $o;
+
+ |
+
+
+ $f;
+ $g = $h <= $i;
+ $j = $k >= $l;
+ $m = $n <=> $o;
+
+ |
+
+
+
+Documentation generated on *REDACTED* by [PHP_CodeSniffer *VERSION*](https://github.com/PHPCSStandards/PHP_CodeSniffer)
diff --git a/tests/Core/Generators/Expectations/ExpectedOutputCodeComparisonEncoding.txt b/tests/Core/Generators/Expectations/ExpectedOutputCodeComparisonEncoding.txt
new file mode 100644
index 0000000000..7ffcf4df51
--- /dev/null
+++ b/tests/Core/Generators/Expectations/ExpectedOutputCodeComparisonEncoding.txt
@@ -0,0 +1,26 @@
+
+-----------------------------------------------------------------
+| GENERATORTEST CODING STANDARD: CODE COMPARISON, CHAR ENCODING |
+-----------------------------------------------------------------
+
+This is a standard block.
+
+----------------------------------------- CODE COMPARISON ------------------------------------------
+| Valid: Vestibulum et orci condimentum. | Invalid: Donec in nisl ut tortor convallis |
+| | interdum. |
+----------------------------------------------------------------------------------------------------
+| $f; | $a = $b < $c; |
+| $g = $h <= $i; | $d = $e > $f; |
+| $j = $k >= $l; | $g = $h <= $i; |
+| $m = $n <=> $o; | $j = $k >= $l; |
+| | $m = $n <=> $o; |
+----------------------------------------------------------------------------------------------------
+
diff --git a/tests/Core/Generators/Expectations/ExpectedOutputCodeComparisonLineLength.html b/tests/Core/Generators/Expectations/ExpectedOutputCodeComparisonLineLength.html
new file mode 100644
index 0000000000..2f7abc69a4
--- /dev/null
+++ b/tests/Core/Generators/Expectations/ExpectedOutputCodeComparisonLineLength.html
@@ -0,0 +1,89 @@
+
+
+ GeneratorTest Coding Standards
+
+
+
+ GeneratorTest Coding Standards
+
+ Code Comparison, line length
+ Ensure there is no PHP "Warning: str_repeat(): Second argument has to be greater than or equal to 0".
+ Ref: squizlabs/PHP_CodeSniffer#2522
+
+
+ Valid: contains line which is too long. |
+ Invalid: contains line which is too long. |
+
+
+ class Foo extends Bar implements Countable, Serializable{} |
+ class Foo extends Bar{ public static function foobar($param1, $param2) {}} |
+
+
+
+
+
diff --git a/tests/Core/Generators/Expectations/ExpectedOutputCodeComparisonLineLength.md b/tests/Core/Generators/Expectations/ExpectedOutputCodeComparisonLineLength.md
new file mode 100644
index 0000000000..f695814ba8
--- /dev/null
+++ b/tests/Core/Generators/Expectations/ExpectedOutputCodeComparisonLineLength.md
@@ -0,0 +1,30 @@
+# GeneratorTest Coding Standard
+
+## Code Comparison, line length
+Ensure there is no PHP "Warning: str_repeat(): Second argument has to be greater than or equal to 0".
+ Ref: squizlabs/PHP_CodeSniffer#2522
+
+
+ Valid: contains line which is too long. |
+ Invalid: contains line which is too long. |
+
+
+
+
+ class Foo extends Bar implements Countable, Serializable
+ {
+ }
+
+ |
+
+
+ class Foo extends Bar
+ {
+ public static function foobar($param1, $param2) {}
+ }
+
+ |
+
+
+
+Documentation generated on *REDACTED* by [PHP_CodeSniffer *VERSION*](https://github.com/PHPCSStandards/PHP_CodeSniffer)
diff --git a/tests/Core/Generators/Expectations/ExpectedOutputCodeComparisonLineLength.txt b/tests/Core/Generators/Expectations/ExpectedOutputCodeComparisonLineLength.txt
new file mode 100644
index 0000000000..e8a665cd45
--- /dev/null
+++ b/tests/Core/Generators/Expectations/ExpectedOutputCodeComparisonLineLength.txt
@@ -0,0 +1,18 @@
+
+---------------------------------------------------------------
+| GENERATORTEST CODING STANDARD: CODE COMPARISON, LINE LENGTH |
+---------------------------------------------------------------
+
+Ensure there is no PHP "Warning: str_repeat(): Second argument has to be greater than or equal to
+0".
+Ref: squizlabs/PHP_CodeSniffer#2522
+
+----------------------------------------- CODE COMPARISON ------------------------------------------
+| Valid: contains line which is too long. | Invalid: contains line which is too long. |
+----------------------------------------------------------------------------------------------------
+| class Foo extends Bar implements Countable, Serializable| class Foo extends Bar |
+| { | { |
+| } | public static function foobar($param1, $param2) {}|
+| | } |
+----------------------------------------------------------------------------------------------------
+
diff --git a/tests/Core/Generators/Fixtures/StandardWithDocs/Docs/Content/CodeComparisonBlankLinesStandard.xml b/tests/Core/Generators/Fixtures/StandardWithDocs/Docs/Content/CodeComparisonBlankLinesStandard.xml
new file mode 100644
index 0000000000..bcaf82bbb6
--- /dev/null
+++ b/tests/Core/Generators/Fixtures/StandardWithDocs/Docs/Content/CodeComparisonBlankLinesStandard.xml
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/Core/Generators/Fixtures/StandardWithDocs/Docs/Content/CodeComparisonBlockLengthStandard.xml b/tests/Core/Generators/Fixtures/StandardWithDocs/Docs/Content/CodeComparisonBlockLengthStandard.xml
new file mode 100644
index 0000000000..c479a7fd0f
--- /dev/null
+++ b/tests/Core/Generators/Fixtures/StandardWithDocs/Docs/Content/CodeComparisonBlockLengthStandard.xml
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+ $one = 10;
+ ]]>
+
+
+ $a = 10;
+ ]]>
+
+
+
+
+ echo $foo;
+ ]]>
+
+
+ print $foo;
+ ]]>
+
+
+
diff --git a/tests/Core/Generators/Fixtures/StandardWithDocs/Docs/Content/CodeComparisonEncodingStandard.xml b/tests/Core/Generators/Fixtures/StandardWithDocs/Docs/Content/CodeComparisonEncodingStandard.xml
new file mode 100644
index 0000000000..c366553f3e
--- /dev/null
+++ b/tests/Core/Generators/Fixtures/StandardWithDocs/Docs/Content/CodeComparisonEncodingStandard.xml
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+ $f;
+$g = $h <= $i;
+$j = $k >= $l;
+$m = $n <=> $o;
+ ]]>
+
+
+
+
+// The above PHP tag is specifically testing
+// handling of that in generated HTML doc.
+
+// Now let's also check the handling of
+// comparison operators in code samples
+// in combination with "em" tags.
+$a = $b < $c;
+$d = $e > $f;
+$g = $h <= $i;
+$j = $k >= $l;
+$m = $n <=> $o;
+ ]]>
+
+
+
diff --git a/tests/Core/Generators/Fixtures/StandardWithDocs/Docs/Content/CodeComparisonLineLengthStandard.xml b/tests/Core/Generators/Fixtures/StandardWithDocs/Docs/Content/CodeComparisonLineLengthStandard.xml
new file mode 100644
index 0000000000..b4431ea84d
--- /dev/null
+++ b/tests/Core/Generators/Fixtures/StandardWithDocs/Docs/Content/CodeComparisonLineLengthStandard.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+ Countable, Serializable
+{
+}
+ ]]>
+
+
+ foobar($param1, $param2) {}
+}
+ ]]>
+
+
+
diff --git a/tests/Core/Generators/Fixtures/StandardWithDocs/Sniffs/Content/CodeComparisonBlankLinesSniff.php b/tests/Core/Generators/Fixtures/StandardWithDocs/Sniffs/Content/CodeComparisonBlankLinesSniff.php
new file mode 100644
index 0000000000..1e56bf9cf8
--- /dev/null
+++ b/tests/Core/Generators/Fixtures/StandardWithDocs/Sniffs/Content/CodeComparisonBlankLinesSniff.php
@@ -0,0 +1,12 @@
+ 'StandardWithDocs.Content.CodeTitleWhitespace',
'pathToExpected' => __DIR__.'/Expectations/ExpectedOutputCodeTitleWhitespace.html',
],
+ 'Code Comparison: blank line handling' => [
+ 'sniffs' => 'StandardWithDocs.Content.CodeComparisonBlankLines',
+ 'pathToExpected' => __DIR__.'/Expectations/ExpectedOutputCodeComparisonBlankLines.html',
+ ],
+ 'Code Comparison: different block lengths' => [
+ 'sniffs' => 'StandardWithDocs.Content.CodeComparisonBlockLength',
+ 'pathToExpected' => __DIR__.'/Expectations/ExpectedOutputCodeComparisonBlockLength.html',
+ ],
+ 'Code Comparison: encoding of special characters' => [
+ 'sniffs' => 'StandardWithDocs.Content.CodeComparisonEncoding',
+ 'pathToExpected' => __DIR__.'/Expectations/ExpectedOutputCodeComparisonEncoding.html',
+ ],
+ 'Code Comparison: line length handling' => [
+ 'sniffs' => 'StandardWithDocs.Content.CodeComparisonLineLength',
+ 'pathToExpected' => __DIR__.'/Expectations/ExpectedOutputCodeComparisonLineLength.html',
+ ],
];
}//end dataDocSpecifics()
diff --git a/tests/Core/Generators/MarkdownTest.php b/tests/Core/Generators/MarkdownTest.php
index 9612b36b84..515b832c59 100644
--- a/tests/Core/Generators/MarkdownTest.php
+++ b/tests/Core/Generators/MarkdownTest.php
@@ -157,6 +157,22 @@ public static function dataDocSpecifics()
'sniffs' => 'StandardWithDocs.Content.CodeTitleWhitespace',
'pathToExpected' => __DIR__.'/Expectations/ExpectedOutputCodeTitleWhitespace.md',
],
+ 'Code Comparison: blank line handling' => [
+ 'sniffs' => 'StandardWithDocs.Content.CodeComparisonBlankLines',
+ 'pathToExpected' => __DIR__.'/Expectations/ExpectedOutputCodeComparisonBlankLines.md',
+ ],
+ 'Code Comparison: different block lengths' => [
+ 'sniffs' => 'StandardWithDocs.Content.CodeComparisonBlockLength',
+ 'pathToExpected' => __DIR__.'/Expectations/ExpectedOutputCodeComparisonBlockLength.md',
+ ],
+ 'Code Comparison: encoding of special characters' => [
+ 'sniffs' => 'StandardWithDocs.Content.CodeComparisonEncoding',
+ 'pathToExpected' => __DIR__.'/Expectations/ExpectedOutputCodeComparisonEncoding.md',
+ ],
+ 'Code Comparison: line length handling' => [
+ 'sniffs' => 'StandardWithDocs.Content.CodeComparisonLineLength',
+ 'pathToExpected' => __DIR__.'/Expectations/ExpectedOutputCodeComparisonLineLength.md',
+ ],
];
}//end dataDocSpecifics()
diff --git a/tests/Core/Generators/TextTest.php b/tests/Core/Generators/TextTest.php
index 2e0c48035e..fd7388d256 100644
--- a/tests/Core/Generators/TextTest.php
+++ b/tests/Core/Generators/TextTest.php
@@ -157,6 +157,22 @@ public static function dataDocSpecifics()
'sniffs' => 'StandardWithDocs.Content.CodeTitleWhitespace',
'pathToExpected' => __DIR__.'/Expectations/ExpectedOutputCodeTitleWhitespace.txt',
],
+ 'Code Comparison: blank line handling' => [
+ 'sniffs' => 'StandardWithDocs.Content.CodeComparisonBlankLines',
+ 'pathToExpected' => __DIR__.'/Expectations/ExpectedOutputCodeComparisonBlankLines.txt',
+ ],
+ 'Code Comparison: different block lengths' => [
+ 'sniffs' => 'StandardWithDocs.Content.CodeComparisonBlockLength',
+ 'pathToExpected' => __DIR__.'/Expectations/ExpectedOutputCodeComparisonBlockLength.txt',
+ ],
+ 'Code Comparison: encoding of special characters' => [
+ 'sniffs' => 'StandardWithDocs.Content.CodeComparisonEncoding',
+ 'pathToExpected' => __DIR__.'/Expectations/ExpectedOutputCodeComparisonEncoding.txt',
+ ],
+ 'Code Comparison: line length handling' => [
+ 'sniffs' => 'StandardWithDocs.Content.CodeComparisonLineLength',
+ 'pathToExpected' => __DIR__.'/Expectations/ExpectedOutputCodeComparisonLineLength.txt',
+ ],
];
}//end dataDocSpecifics()