Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions src/Standards/Generic/Tests/Files/LowercasedFilenameUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand All @@ -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.
*
Expand Down Expand Up @@ -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 = '<?php ';
$file = new DummyFile($content, $ruleset, $config);
$file->process();

$this->assertSame(0, $file->getErrorCount());
$this->assertSame(0, $file->getWarningCount());
$this->assertCount(0, $file->getErrors());

}//end testStdIn()


}//end class
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php