Skip to content

Commit 9ead089

Browse files
authored
Merge pull request #1210 from PHPCSStandards/phpcs-4.0/feature/abstract-testcases-use-localfile-not-dummyfile
AbstractMethodTestCase/AbstractTokenizerTestCase: use LocalFile instead of DummyFile
2 parents 5dace4b + a869bc3 commit 9ead089

File tree

2 files changed

+4
-12
lines changed

2 files changed

+4
-12
lines changed

tests/Core/AbstractMethodTestCase.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
namespace PHP_CodeSniffer\Tests\Core;
1111

1212
use Exception;
13-
use PHP_CodeSniffer\Files\DummyFile;
1413
use PHP_CodeSniffer\Files\File;
14+
use PHP_CodeSniffer\Files\LocalFile;
1515
use PHP_CodeSniffer\Ruleset;
1616
use PHP_CodeSniffer\Tests\ConfigDouble;
1717
use PHPUnit\Framework\TestCase;
@@ -58,11 +58,7 @@ public static function setUpBeforeClass(): void
5858
$relativePath = str_replace('\\', DIRECTORY_SEPARATOR, $relativeCN);
5959
$pathToTestFile = realpath(__DIR__).$relativePath.'.inc';
6060

61-
// Make sure the file gets parsed correctly based on the file type.
62-
$contents = 'phpcs_input_file: '.$pathToTestFile.PHP_EOL;
63-
$contents .= file_get_contents($pathToTestFile);
64-
65-
self::$phpcsFile = new DummyFile($contents, $ruleset, $config);
61+
self::$phpcsFile = new LocalFile($pathToTestFile, $ruleset, $config);
6662
self::$phpcsFile->parse();
6763

6864
}//end setUpBeforeClass()

tests/Core/Tokenizers/AbstractTokenizerTestCase.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
namespace PHP_CodeSniffer\Tests\Core\Tokenizers;
1414

15-
use PHP_CodeSniffer\Files\DummyFile;
15+
use PHP_CodeSniffer\Files\LocalFile;
1616
use PHP_CodeSniffer\Ruleset;
1717
use PHP_CodeSniffer\Tests\ConfigDouble;
1818
use PHP_CodeSniffer\Tests\Core\AbstractMethodTestCase;
@@ -63,11 +63,7 @@ protected function setUp(): void
6363
$relativePath = str_replace('\\', DIRECTORY_SEPARATOR, $relativeCN);
6464
$pathToTestFile = realpath(__DIR__).$relativePath.'.inc';
6565

66-
// Make sure the file gets parsed correctly based on the file type.
67-
$contents = 'phpcs_input_file: '.$pathToTestFile.PHP_EOL;
68-
$contents .= file_get_contents($pathToTestFile);
69-
70-
$this->phpcsFile = new DummyFile($contents, $ruleset, $config);
66+
$this->phpcsFile = new LocalFile($pathToTestFile, $ruleset, $config);
7167
$this->phpcsFile->parse();
7268
}//end if
7369

0 commit comments

Comments
 (0)