From 5e75fc05654c6891622137e530b1d69903250272 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=B6ller?= Date: Fri, 13 Jan 2023 13:46:39 +0100 Subject: [PATCH] Fix: Split test suite --- .github/workflows/integrate.yaml | 7 +++++-- Makefile | 5 +++-- phpunit.xml.dist | 7 +++++-- tests/{ => Functional}/Console/LintCommandTest.php | 6 +++--- tests/{ => Functional}/CorpusTest.php | 2 +- tests/{ => Functional}/Twig2FunctionalTest.php | 2 +- tests/{ => Functional}/Twig3FunctionalTest.php | 2 +- tests/{ => Unit}/Config/ConfigResolverTest.php | 4 ++-- tests/{ => Unit}/ContainerTest.php | 2 +- tests/{ => Unit}/RegEngine/ExpressionNodeTest.php | 2 +- tests/{ => Unit}/RegEngine/ScopedExpressionTest.php | 2 +- tests/{ => Unit}/Reporter/CheckstyleReporterTest.php | 2 +- tests/{ => Unit}/Reporter/ConsoleReporterTest.php | 2 +- tests/{ => Unit}/Reporter/CsvReporterTest.php | 2 +- tests/{ => Unit}/Reporter/GitLabReporterTest.php | 2 +- tests/{ => Unit}/Reporter/GithubActionReporterTest.php | 2 +- tests/{ => Unit}/Reporter/JsonReporterTest.php | 2 +- tests/{ => Unit}/Rule/ForbiddenFunctionsTest.php | 2 +- 18 files changed, 31 insertions(+), 24 deletions(-) rename tests/{ => Functional}/Console/LintCommandTest.php (98%) rename tests/{ => Functional}/CorpusTest.php (94%) rename tests/{ => Functional}/Twig2FunctionalTest.php (97%) rename tests/{ => Functional}/Twig3FunctionalTest.php (99%) rename tests/{ => Unit}/Config/ConfigResolverTest.php (98%) rename tests/{ => Unit}/ContainerTest.php (93%) rename tests/{ => Unit}/RegEngine/ExpressionNodeTest.php (94%) rename tests/{ => Unit}/RegEngine/ScopedExpressionTest.php (96%) rename tests/{ => Unit}/Reporter/CheckstyleReporterTest.php (95%) rename tests/{ => Unit}/Reporter/ConsoleReporterTest.php (95%) rename tests/{ => Unit}/Reporter/CsvReporterTest.php (93%) rename tests/{ => Unit}/Reporter/GitLabReporterTest.php (97%) rename tests/{ => Unit}/Reporter/GithubActionReporterTest.php (94%) rename tests/{ => Unit}/Reporter/JsonReporterTest.php (98%) rename tests/{ => Unit}/Rule/ForbiddenFunctionsTest.php (97%) diff --git a/.github/workflows/integrate.yaml b/.github/workflows/integrate.yaml index 8e3701f..f66dc00 100644 --- a/.github/workflows/integrate.yaml +++ b/.github/workflows/integrate.yaml @@ -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" diff --git a/Makefile b/Makefile index 185d235..0c1ff9e 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/phpunit.xml.dist b/phpunit.xml.dist index cbf4048..a6a64d7 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -19,8 +19,11 @@ - - tests + + tests/Functional/ + + + tests/Unit/ diff --git a/tests/Console/LintCommandTest.php b/tests/Functional/Console/LintCommandTest.php similarity index 98% rename from tests/Console/LintCommandTest.php rename to tests/Functional/Console/LintCommandTest.php index 9042d98..eaaf947 100644 --- a/tests/Console/LintCommandTest.php +++ b/tests/Functional/Console/LintCommandTest.php @@ -1,6 +1,6 @@ commandTester->execute([ 'paths' => null, ]); - chdir(__DIR__.'/../..'); + chdir(__DIR__.'/../../..'); $output = $this->commandTester->getDisplay(); $statusCode = $this->commandTester->getStatusCode(); diff --git a/tests/CorpusTest.php b/tests/Functional/CorpusTest.php similarity index 94% rename from tests/CorpusTest.php rename to tests/Functional/CorpusTest.php index f2dce38..1bd746b 100644 --- a/tests/CorpusTest.php +++ b/tests/Functional/CorpusTest.php @@ -1,6 +1,6 @@