diff --git a/src/Generators/HTML.php b/src/Generators/HTML.php index 0fce7c99ae..f2f2e64bdd 100644 --- a/src/Generators/HTML.php +++ b/src/Generators/HTML.php @@ -103,6 +103,10 @@ class HTML extends Generator */ public function generate() { + if (empty($this->docFiles) === true) { + return; + } + ob_start(); $this->printHeader(); $this->printToc(); diff --git a/src/Generators/Markdown.php b/src/Generators/Markdown.php index de207ec601..8739961697 100644 --- a/src/Generators/Markdown.php +++ b/src/Generators/Markdown.php @@ -27,6 +27,10 @@ class Markdown extends Generator */ public function generate() { + if (empty($this->docFiles) === true) { + return; + } + ob_start(); $this->printHeader(); diff --git a/tests/Core/Generators/Expectations/ExpectedOutputNoDocs.html b/tests/Core/Generators/Expectations/ExpectedOutputNoDocs.html deleted file mode 100644 index 060de7aa63..0000000000 --- a/tests/Core/Generators/Expectations/ExpectedOutputNoDocs.html +++ /dev/null @@ -1,78 +0,0 @@ - - - GeneratorTest Coding Standards - - - -

GeneratorTest Coding Standards

-

Table of Contents

- -
Documentation generated on #REDACTED# by PHP_CodeSniffer #VERSION#
- - diff --git a/tests/Core/Generators/Expectations/ExpectedOutputNoDocs.md b/tests/Core/Generators/Expectations/ExpectedOutputNoDocs.md deleted file mode 100644 index ece2692187..0000000000 --- a/tests/Core/Generators/Expectations/ExpectedOutputNoDocs.md +++ /dev/null @@ -1,2 +0,0 @@ -# GeneratorTest Coding Standard -Documentation generated on *REDACTED* by [PHP_CodeSniffer *VERSION*](https://github.com/PHPCSStandards/PHP_CodeSniffer) diff --git a/tests/Core/Generators/HTMLTest.php b/tests/Core/Generators/HTMLTest.php index 4140937ab7..17ef7c9bcf 100644 --- a/tests/Core/Generators/HTMLTest.php +++ b/tests/Core/Generators/HTMLTest.php @@ -62,7 +62,7 @@ public static function dataDocs() return [ 'Standard without docs' => [ 'standard' => __DIR__.'/NoDocsTest.xml', - 'pathToExpected' => __DIR__.'/Expectations/ExpectedOutputNoDocs.html', + 'pathToExpected' => __DIR__.'/Expectations/ExpectedOutputEmpty.txt', ], 'Standard with one doc file' => [ 'standard' => __DIR__.'/OneDocTest.xml', diff --git a/tests/Core/Generators/MarkdownTest.php b/tests/Core/Generators/MarkdownTest.php index 9a3e540044..1a89b7e8ee 100644 --- a/tests/Core/Generators/MarkdownTest.php +++ b/tests/Core/Generators/MarkdownTest.php @@ -62,7 +62,7 @@ public static function dataDocs() return [ 'Standard without docs' => [ 'standard' => __DIR__.'/NoDocsTest.xml', - 'pathToExpected' => __DIR__.'/Expectations/ExpectedOutputNoDocs.md', + 'pathToExpected' => __DIR__.'/Expectations/ExpectedOutputEmpty.txt', ], 'Standard with one doc file' => [ 'standard' => __DIR__.'/OneDocTest.xml',