Skip to content

Commit

Permalink
Tests/HeredocNowdocCloserTest: remove overloaded "setUpBeforeClass" m…
Browse files Browse the repository at this point in the history
…ethod

Follow up on 220 / commit 5aa4362 .

As the `tabWidth` setting is now available via the `AbstractMethodUnitTest`, the `initializeFile()` method no longer needs to be overloaded for this test.
  • Loading branch information
jrfnl committed Jan 14, 2024
1 parent 5bd0b83 commit c8d68d6
Showing 1 changed file with 0 additions and 36 deletions.
36 changes: 0 additions & 36 deletions tests/Core/Tokenizer/HeredocNowdocCloserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@

namespace PHP_CodeSniffer\Tests\Core\Tokenizer;

use PHP_CodeSniffer\Config;
use PHP_CodeSniffer\Ruleset;
use PHP_CodeSniffer\Files\DummyFile;
use PHP_CodeSniffer\Tests\Core\AbstractMethodUnitTest;

/**
Expand All @@ -23,39 +20,6 @@ final class HeredocNowdocCloserTest extends AbstractMethodUnitTest
{


/**
* Initialize & tokenize \PHP_CodeSniffer\Files\File with code from the test case file.
*
* {@internal This is a near duplicate of the original method. Only difference is that
* tab replacement is enabled for this test.}
*
* @beforeClass
*
* @return void
*/
public static function initializeFile()
{
$config = new Config();
$config->standards = ['PSR1'];
$config->tabWidth = 4;

$ruleset = new Ruleset($config);

// Default to a file with the same name as the test class. Extension is property based.
$relativeCN = str_replace(__NAMESPACE__, '', get_called_class());
$relativePath = str_replace('\\', DIRECTORY_SEPARATOR, $relativeCN);
$pathToTestFile = realpath(__DIR__).$relativePath.'.'.static::$fileExtension;

// Make sure the file gets parsed correctly based on the file type.
$contents = 'phpcs_input_file: '.$pathToTestFile.PHP_EOL;
$contents .= file_get_contents($pathToTestFile);

self::$phpcsFile = new DummyFile($contents, $ruleset, $config);
self::$phpcsFile->process();

}//end initializeFile()


/**
* Verify that leading (indent) whitespace in a heredoc/nowdoc closer token get the tab replacement treatment.
*
Expand Down

0 comments on commit c8d68d6

Please sign in to comment.