From ad895dccf9c701b0ae689c28eb4c58ef2c3ab997 Mon Sep 17 00:00:00 2001 From: Ambroise Maupate Date: Tue, 12 Mar 2024 21:45:43 +0100 Subject: [PATCH] test: Fixed tests directory --- composer.json | 3 +-- lib/Models/.github/workflows/run-test.yml | 2 +- lib/RoadizCoreBundle/phpstan.neon | 5 +++++ lib/RoadizCoreBundle/tests/bootstrap.php | 11 +++++++++++ lib/RoadizCoreBundle/tests/object-manager.php | 11 +++++++++++ lib/RoadizTwoFactorBundle/composer.json | 6 +++++- lib/RoadizUserBundle/composer.json | 6 +++++- 7 files changed, 39 insertions(+), 5 deletions(-) create mode 100644 lib/RoadizCoreBundle/tests/bootstrap.php create mode 100644 lib/RoadizCoreBundle/tests/object-manager.php diff --git a/composer.json b/composer.json index 6b27d5a2..bbd5747d 100644 --- a/composer.json +++ b/composer.json @@ -194,8 +194,7 @@ "RZ\\Roadiz\\UserBundle\\": "lib/RoadizUserBundle/src/", "RZ\\Roadiz\\Utils\\": "lib/Models/src/Roadiz/Utils/", "Themes\\": "themes/", - "Themes\\Rozier\\": "lib/Rozier/src/", - "tests\\mocks\\": "lib/EntityGenerator/tests/mocks/" + "Themes\\Rozier\\": "lib/Rozier/src/" } }, "autoload-dev": { diff --git a/lib/Models/.github/workflows/run-test.yml b/lib/Models/.github/workflows/run-test.yml index a8066b39..04732cfa 100644 --- a/lib/Models/.github/workflows/run-test.yml +++ b/lib/Models/.github/workflows/run-test.yml @@ -36,7 +36,7 @@ jobs: - name: Install Dependencies run: composer install --no-scripts --no-ansi --no-interaction --no-progress - name: Run PHPUnit tests - run: vendor/bin/phpunit -v --whitelist ./src --coverage-clover ./build/logs/clover.xml tests/ + run: vendor/bin/phpunit -v --whitelist ./src --coverage-clover ./build/logs/clover.xml src/Test - name: Run PHP Code Sniffer run: vendor/bin/phpcs -p ./src - name: Run PHPStan diff --git a/lib/RoadizCoreBundle/phpstan.neon b/lib/RoadizCoreBundle/phpstan.neon index ac0e5911..941513bc 100644 --- a/lib/RoadizCoreBundle/phpstan.neon +++ b/lib/RoadizCoreBundle/phpstan.neon @@ -6,6 +6,9 @@ parameters: - */node_modules/* - */bower_components/* - */static/* + doctrine: + repositoryClass: RZ\Roadiz\CoreBundle\Repository\EntityRepository + objectManagerLoader: ./tests/object-manager.php ignoreErrors: - '#Call to an undefined method RZ\\Roadiz\\CoreBundle\\Repository#' - '#Call to an undefined method RZ\\Roadiz\\UserBundle\\Repository#' @@ -32,5 +35,7 @@ parameters: reportUnmatchedIgnoredErrors: false checkGenericClassInNonGenericObjectType: false checkMissingIterableValueType: false + treatPhpDocTypesAsCertain: false includes: - vendor/phpstan/phpstan-doctrine/extension.neon + - vendor/phpstan/phpstan-doctrine/rules.neon diff --git a/lib/RoadizCoreBundle/tests/bootstrap.php b/lib/RoadizCoreBundle/tests/bootstrap.php new file mode 100644 index 00000000..469dccee --- /dev/null +++ b/lib/RoadizCoreBundle/tests/bootstrap.php @@ -0,0 +1,11 @@ +bootEnv(dirname(__DIR__).'/.env'); +} diff --git a/lib/RoadizCoreBundle/tests/object-manager.php b/lib/RoadizCoreBundle/tests/object-manager.php new file mode 100644 index 00000000..c15dbe95 --- /dev/null +++ b/lib/RoadizCoreBundle/tests/object-manager.php @@ -0,0 +1,11 @@ +bootEnv(__DIR__ . '/../.env'); + +$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']); +$kernel->boot(); +return $kernel->getContainer()->get('doctrine')->getManager(); diff --git a/lib/RoadizTwoFactorBundle/composer.json b/lib/RoadizTwoFactorBundle/composer.json index 23652565..840ec90b 100644 --- a/lib/RoadizTwoFactorBundle/composer.json +++ b/lib/RoadizTwoFactorBundle/composer.json @@ -39,7 +39,11 @@ "phpstan/phpstan-doctrine": "^1.3", "phpunit/phpunit": "^9.5", "squizlabs/php_codesniffer": "^3.5", - "symfony/stopwatch": "6.4.*" + "symfony/stopwatch": "6.4.*", + "roadiz/entity-generator": "2.3.x-dev", + "roadiz/doc-generator": "2.3.x-dev", + "roadiz/random": "2.3.x-dev", + "roadiz/jwt": "2.3.x-dev" }, "config": { "optimize-autoloader": true, diff --git a/lib/RoadizUserBundle/composer.json b/lib/RoadizUserBundle/composer.json index 6a326de3..6fd8198e 100644 --- a/lib/RoadizUserBundle/composer.json +++ b/lib/RoadizUserBundle/composer.json @@ -31,7 +31,11 @@ "php-coveralls/php-coveralls": "^2.4", "phpstan/phpstan": "^1.5.3", "squizlabs/php_codesniffer": "^3.5", - "phpstan/phpstan-doctrine": "^1.3" + "phpstan/phpstan-doctrine": "^1.3", + "roadiz/entity-generator": "2.3.x-dev", + "roadiz/doc-generator": "2.3.x-dev", + "roadiz/random": "2.3.x-dev", + "roadiz/jwt": "2.3.x-dev" }, "config": { "optimize-autoloader": true,