Skip to content

Commit

Permalink
Fix: Split test suite
Browse files Browse the repository at this point in the history
  • Loading branch information
localheinz committed Jan 13, 2023
1 parent 8821fa1 commit 5e75fc0
Show file tree
Hide file tree
Showing 18 changed files with 31 additions and 24 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/integrate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -170,5 +170,8 @@ jobs:
- name: "Install dependencies with composer"
run: "composer install --ansi --no-progress"

- name: "Run tests with phpunit/phpunit"
run: "vendor/bin/phpunit --colors=always"
- name: "Run unit tests with phpunit/phpunit"
run: "vendor/bin/phpunit --colors=always --testsuite=unit"

- name: "Run functional tests with phpunit/phpunit"
run: "vendor/bin/phpunit --colors=always --testsuite=functional"
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ static-code-analysis-baseline: vendor ## Generates a baseline for static code an
.phive/psalm --config=psalm.xml --set-baseline=psalm-baseline.xml

.PHONY: tests
tests: vendor ## Runs tests with phpunit/phpunit
vendor/bin/phpunit
tests: vendor ## Runs unit and functional tests with phpunit/phpunit
vendor/bin/phpunit --testsuite=unit
vendor/bin/phpunit --testsuite=functional

vendor: composer.json
composer install --no-progress
7 changes: 5 additions & 2 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,11 @@
<env name="SYMFONY_DEPRECATIONS_HELPER" value="max[self]=0"/>
</php>
<testsuites>
<testsuite name="Project Test Suite">
<directory>tests</directory>
<testsuite name="functional">
<directory>tests/Functional/</directory>
</testsuite>
<testsuite name="unit">
<directory>tests/Unit/</directory>
</testsuite>
</testsuites>
</phpunit>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace FriendsOfTwig\Twigcs\Tests\Console;
namespace FriendsOfTwig\Twigcs\Tests\Functional\Console;

use FriendsOfTwig\Twigcs\Config\ConfigInterface;
use FriendsOfTwig\Twigcs\Console\LintCommand;
Expand Down Expand Up @@ -242,11 +242,11 @@ public function testConfigFileWithDisplayAndSeverity(): void

public function testConfigFileSamePathWithRulesetOverrides(): void
{
chdir(__DIR__.'/../Fixture/config/local');
chdir(__DIR__.'/../../Fixture/config/local');
$this->commandTester->execute([
'paths' => null,
]);
chdir(__DIR__.'/../..');
chdir(__DIR__.'/../../..');

$output = $this->commandTester->getDisplay();
$statusCode = $this->commandTester->getStatusCode();
Expand Down
2 changes: 1 addition & 1 deletion tests/CorpusTest.php → tests/Functional/CorpusTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace FriendsOfTwig\Twigcs\Tests;
namespace FriendsOfTwig\Twigcs\Tests\Functional;

use FriendsOfTwig\Twigcs\Console\LintCommand;
use FriendsOfTwig\Twigcs\Container;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace FriendsOfTwig\Twigcs\Tests;
namespace FriendsOfTwig\Twigcs\Tests\Functional;

use FriendsOfTwig\Twigcs\Lexer;
use FriendsOfTwig\Twigcs\Rule\RegEngineRule;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace FriendsOfTwig\Twigcs\Tests;
namespace FriendsOfTwig\Twigcs\Tests\Functional;

use FriendsOfTwig\Twigcs\Lexer;
use FriendsOfTwig\Twigcs\Rule\RegEngineRule;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace FriendsOfTwig\Twigcs\Tests\Config;
namespace FriendsOfTwig\Twigcs\Tests\Unit\Config;

use FriendsOfTwig\Twigcs;
use PHPUnit\Framework;
Expand Down Expand Up @@ -319,6 +319,6 @@ private static function fileSystem(): Filesystem\Filesystem

private static function temporaryDirectory(): string
{
return __DIR__.'/../../.build/test';
return __DIR__.'/../../../.build/test';
}
}
2 changes: 1 addition & 1 deletion tests/ContainerTest.php → tests/Unit/ContainerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace FriendsOfTwig\Twigcs\Tests;
namespace FriendsOfTwig\Twigcs\Tests\Unit;

use FriendsOfTwig\Twigcs;
use PHPUnit\Framework;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace FriendsOfTwig\Twigcs\Tests\RegEngine;
namespace FriendsOfTwig\Twigcs\Tests\Unit\RegEngine;

use FriendsOfTwig\Twigcs\RegEngine\ExpressionNode;
use PHPUnit\Framework\TestCase;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace FriendsOfTwig\Twigcs\Tests\RegEngine;
namespace FriendsOfTwig\Twigcs\Tests\Unit\RegEngine;

use FriendsOfTwig\Twigcs\RegEngine\ScopedExpression;
use PHPUnit\Framework\TestCase;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace FriendsOfTwig\Twigcs\Tests\Reporter;
namespace FriendsOfTwig\Twigcs\Tests\Unit\Reporter;

use FriendsOfTwig\Twigcs\Reporter\CheckstyleReporter;
use FriendsOfTwig\Twigcs\Validator\Violation;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace FriendsOfTwig\Twigcs\Tests\Reporter;
namespace FriendsOfTwig\Twigcs\Tests\Unit\Reporter;

use FriendsOfTwig\Twigcs\Reporter\ConsoleReporter;
use FriendsOfTwig\Twigcs\Validator\Violation;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace FriendsOfTwig\Twigcs\Tests\Reporter;
namespace FriendsOfTwig\Twigcs\Tests\Unit\Reporter;

use FriendsOfTwig\Twigcs\Reporter\CsvReporter;
use FriendsOfTwig\Twigcs\Validator\Violation;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace FriendsOfTwig\Twigcs\Tests\Reporter;
namespace FriendsOfTwig\Twigcs\Tests\Unit\Reporter;

use FriendsOfTwig\Twigcs\Reporter\GitLabReporter;
use FriendsOfTwig\Twigcs\Validator\Violation;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace FriendsOfTwig\Twigcs\Tests\Reporter;
namespace FriendsOfTwig\Twigcs\Tests\Unit\Reporter;

use FriendsOfTwig\Twigcs\Reporter\GithubActionReporter;
use FriendsOfTwig\Twigcs\Reporter\ReporterInterface;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace FriendsOfTwig\Twigcs\Tests\Reporter;
namespace FriendsOfTwig\Twigcs\Tests\Unit\Reporter;

use FriendsOfTwig\Twigcs\Reporter\JsonReporter;
use FriendsOfTwig\Twigcs\Validator\Violation;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace FriendsOfTwig\Twigcs\Tests\Rule;
namespace FriendsOfTwig\Twigcs\Tests\Unit\Rule;

use FriendsOfTwig\Twigcs\Lexer;
use FriendsOfTwig\Twigcs\Rule\ForbiddenFunctions;
Expand Down

0 comments on commit 5e75fc0

Please sign in to comment.