diff --git a/src/Standards/Generic/Tests/Files/LowercasedFilenameUnitTest.php b/src/Standards/Generic/Tests/Files/LowercasedFilenameUnitTest.php index 894a86dfed..ea7d5aa8b2 100644 --- a/src/Standards/Generic/Tests/Files/LowercasedFilenameUnitTest.php +++ b/src/Standards/Generic/Tests/Files/LowercasedFilenameUnitTest.php @@ -9,6 +9,9 @@ namespace PHP_CodeSniffer\Standards\Generic\Tests\Files; +use PHP_CodeSniffer\Files\DummyFile; +use PHP_CodeSniffer\Ruleset; +use PHP_CodeSniffer\Tests\ConfigDouble; use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest; /** @@ -20,6 +23,24 @@ final class LowercasedFilenameUnitTest extends AbstractSniffUnitTest { + /** + * Get a list of all test files to check. + * + * @param string $testFileBase The base path that the unit tests files will have. + * + * @return string[] + */ + protected function getTestFiles($testFileBase) + { + $testFileDir = dirname($testFileBase); + $testFiles = parent::getTestFiles($testFileBase); + $testFiles[] = $testFileDir.DIRECTORY_SEPARATOR.'lowercased_filename_unit_test.inc'; + + return $testFiles; + + }//end getTestFiles() + + /** * Returns the lines where errors should occur. * @@ -58,4 +79,28 @@ public function getWarningList() }//end getWarningList() + /** + * Test the sniff bails early when handling STDIN. + * + * @return void + */ + public function testStdIn() + { + $config = new ConfigDouble(); + $config->standards = ['Generic']; + $config->sniffs = ['Generic.Files.LowercasedFilename']; + + $ruleset = new Ruleset($config); + + $content = 'process(); + + $this->assertSame(0, $file->getErrorCount()); + $this->assertSame(0, $file->getWarningCount()); + $this->assertCount(0, $file->getErrors()); + + }//end testStdIn() + + }//end class diff --git a/src/Standards/Generic/Tests/Files/lowercased_filename_unit_test.inc b/src/Standards/Generic/Tests/Files/lowercased_filename_unit_test.inc new file mode 100644 index 0000000000..b3d9bbc7f3 --- /dev/null +++ b/src/Standards/Generic/Tests/Files/lowercased_filename_unit_test.inc @@ -0,0 +1 @@ +