Skip to content

Tests: move test fixtures to a "fixtures" subdirectory #108

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 7, 2022
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
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,10 @@ jobs:

- name: 'Integration test 1 - linting own code, no colors'
continue-on-error: true
run: ./parallel-lint --exclude vendor --exclude tests/examples --no-colors .
run: ./parallel-lint --exclude vendor --exclude tests/fixtures --no-colors .

- name: 'Integration test 2 - linting own code'
run: ./parallel-lint --exclude vendor --exclude tests/examples .
run: ./parallel-lint --exclude vendor --exclude tests/fixtures .

- name: 'Run unit tests PHP <= 5.5'
if: ${{ matrix.php < 5.6 }}
Expand All @@ -140,4 +140,4 @@ jobs:
name: parallel-lint-phar

- name: Run linter against codebase using the phar
run: php ./parallel-lint.phar --exclude vendor --exclude tests/examples .
run: php ./parallel-lint.phar --exclude vendor --exclude tests/fixtures .
4 changes: 2 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ install:

test_script:
- php composer.phar test
- php parallel-lint --exclude vendor --exclude tests\examples --no-colors .
- php parallel-lint --exclude vendor --exclude tests\examples .
- php parallel-lint --exclude vendor --exclude tests\fixtures --no-colors .
- php parallel-lint --exclude vendor --exclude tests\fixtures .
14 changes: 1 addition & 13 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<file>.</file>

<!-- Exclude dependencies, test fixtures. -->
<exclude-pattern>*/tests/examples/*</exclude-pattern>
<exclude-pattern>*/tests/fixtures/*</exclude-pattern>
<exclude-pattern>*/vendor/*</exclude-pattern>

<!-- Only check PHP files. -->
Expand Down Expand Up @@ -87,17 +87,5 @@
<rule ref="PSR1.Files.SideEffects.FoundWithSymbols">
<exclude-pattern>/tests/*\.php$</exclude-pattern>
</rule>
<rule ref="PSR1.Classes.ClassDeclaration.MissingNamespace">
<exclude-pattern>/tests/skip-on-5\.3/*\.php$</exclude-pattern>
</rule>
<rule ref="PSR12.Files.FileHeader.SpacingAfterBlock">
<exclude-pattern>/tests/skip-on-5.3/trait\.php$</exclude-pattern>
</rule>
<rule ref="PSR12.Files.OpenTag.NotAlone">
<exclude-pattern>/tests/skip-on-5.3/trait\.php$</exclude-pattern>
</rule>
<rule ref="PHPCompatibility.Keywords.NewKeywords.t_traitFound">
<exclude-pattern>/tests/skip-on-5.3/trait\.php$</exclude-pattern>
</rule>

</ruleset>
16 changes: 8 additions & 8 deletions tests/ManagerRunTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function testBadPath()
public function testFilesNotFound()
{
$settings = $this->prepareSettings();
$settings->paths = array('examples/example-01/');
$settings->paths = array('fixtures/fixture-01/');
$manager = $this->getManager($settings);
Assert::exception(function () use ($manager, $settings) {
$manager->run($settings);
Expand All @@ -41,7 +41,7 @@ public function testFilesNotFound()
public function testSuccess()
{
$settings = $this->prepareSettings();
$settings->paths = array('examples/example-02/');
$settings->paths = array('fixtures/fixture-02/');

$manager = $this->getManager($settings);
$result = $manager->run($settings);
Expand All @@ -51,7 +51,7 @@ public function testSuccess()
public function testError()
{
$settings = $this->prepareSettings();
$settings->paths = array('examples/example-03/');
$settings->paths = array('fixtures/fixture-03/');

$manager = $this->getManager($settings);
$result = $manager->run($settings);
Expand All @@ -61,13 +61,13 @@ public function testError()
public function testExcludeRelativeSubdirectory()
{
$settings = $this->prepareSettings();
$settings->paths = array('examples/example-04/');
$settings->paths = array('fixtures/fixture-04/');

$manager = $this->getManager($settings);
$result = $manager->run($settings);
Assert::true($result->hasError());

$settings->excluded = array('examples/example-04/dir1/dir2');
$settings->excluded = array('fixtures/fixture-04/dir1/dir2');

$manager = $this->getManager($settings);
$result = $manager->run($settings);
Expand All @@ -78,14 +78,14 @@ public function testExcludeAbsoluteSubdirectory()
{
$settings = $this->prepareSettings();
$cwd = getcwd();
$settings->paths = array($cwd . '/examples/example-04/');
$settings->paths = array($cwd . '/fixtures/fixture-04/');
$settings->excluded = array();

$manager = $this->getManager($settings);
$result = $manager->run($settings);
Assert::true($result->hasError());

$settings->excluded = array($cwd . '/examples/example-04/dir1/dir2');
$settings->excluded = array($cwd . '/fixtures/fixture-04/dir1/dir2');

$manager = $this->getManager($settings);
$result = $manager->run($settings);
Expand All @@ -100,7 +100,7 @@ public function testExcludeAbsoluteSubdirectory()
public function testMultiPartExtensions()
{
$settings = $this->prepareSettings();
$settings->paths = array('examples/example-06/');
$settings->paths = array('fixtures/fixture-06/');

$settings->extensions = array('php', 'php.dist');

Expand Down
14 changes: 7 additions & 7 deletions tests/ParallelLintLintTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function testNotExistsFile()
public function testEmptyFile()
{
$parallelLint = new ParallelLint($this->getPhpExecutable());
$result = $parallelLint->lint(array(__DIR__ . '/examples/example-01/empty-file'));
$result = $parallelLint->lint(array(__DIR__ . '/fixtures/fixture-01/empty-file'));

Assert::equal(1, $result->getCheckedFilesCount());
Assert::equal(0, $result->getFilesWithSyntaxErrorCount());
Expand All @@ -80,7 +80,7 @@ public function testEmptyFile()
public function testValidFile()
{
$parallelLint = new ParallelLint($this->getPhpExecutable());
$result = $parallelLint->lint(array(__DIR__ . '/examples/example-02/example.php'));
$result = $parallelLint->lint(array(__DIR__ . '/fixtures/fixture-02/example.php'));

Assert::equal(1, $result->getCheckedFilesCount());
Assert::equal(0, $result->getFilesWithSyntaxErrorCount());
Expand All @@ -90,7 +90,7 @@ public function testValidFile()
public function testInvalidFile()
{
$parallelLint = new ParallelLint($this->getPhpExecutable());
$result = $parallelLint->lint(array(__DIR__ . '/examples/example-03/example.php'));
$result = $parallelLint->lint(array(__DIR__ . '/fixtures/fixture-03/example.php'));

Assert::equal(1, $result->getCheckedFilesCount());
Assert::equal(1, $result->getFilesWithSyntaxErrorCount());
Expand All @@ -101,7 +101,7 @@ public function testInvalidFile()
public function testDeprecated()
{
$parallelLint = new ParallelLint($this->getPhpExecutable());
$result = $parallelLint->lint(array(__DIR__ . '/examples/example-05/Foo.php'));
$result = $parallelLint->lint(array(__DIR__ . '/fixtures/fixture-05/Foo.php'));
Assert::equal(1, $result->getCheckedFilesCount());
Assert::equal(0, $result->getFilesWithSyntaxErrorCount());
Assert::false($result->hasSyntaxError());
Expand All @@ -113,7 +113,7 @@ public function testDeprecated()

$parallelLint = new ParallelLint($this->getPhpExecutable());
$parallelLint->setShowDeprecated(true);
$result = $parallelLint->lint(array(__DIR__ . '/examples/example-05/Foo.php'));
$result = $parallelLint->lint(array(__DIR__ . '/fixtures/fixture-05/Foo.php'));
Assert::equal(1, $result->getCheckedFilesCount());
Assert::equal(1, $result->getFilesWithSyntaxErrorCount());
Assert::true($result->hasSyntaxError());
Expand All @@ -124,8 +124,8 @@ public function testValidAndInvalidFiles()
{
$parallelLint = new ParallelLint($this->getPhpExecutable());
$result = $parallelLint->lint(array(
__DIR__ . '/examples/example-02/example.php',
__DIR__ . '/examples/example-03/example.php',
__DIR__ . '/fixtures/fixture-02/example.php',
__DIR__ . '/fixtures/fixture-03/example.php',
));

Assert::equal(2, $result->getCheckedFilesCount());
Expand Down
4 changes: 2 additions & 2 deletions tests/SkipLintProcessTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ class SkipLintProcessTest extends TestCase
public function testLargeInput()
{
$filesToCheck = array(
__DIR__ . '/skip-on-5.3/class.php',
__DIR__ . '/skip-on-5.3/trait.php',
__DIR__ . '/fixtures/skip-on-5.3/class.php',
__DIR__ . '/fixtures/skip-on-5.3/trait.php',
);

for ($i = 0; $i < 15; $i++) {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.