diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 68436bd..a1b413c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,20 +20,20 @@ jobs: strategy: fail-fast: false matrix: - php: [7.4, 8.0, 8.1] - symfony: [4.4.*, 5.4.*, 6.0.*] - phpunit: [^8.0, ^9.0] - php-matcher: [^5.0, ^6.0] + php: [8.0, 8.1, 8.2] + symfony: [5.4.*, 6.2.*, 6.3.*] + phpunit: [^9.0, ^10.0] + php-matcher: [^6.0] exclude: - php: 8.0 - php-matcher: ^5.0 + phpunit: ^10.0 - - php: 8.1 - php-matcher: ^5.0 + php: 8.0 + symfony: 6.2.* - - php: 7.4 - symfony: 6.0.* + php: 8.0 + symfony: 6.3.* steps: - uses: "actions/checkout@v2" @@ -48,7 +48,8 @@ jobs: - name: "Restrict Symfony version" run: | - composer global require --no-progress --no-scripts --no-plugins "symfony/flex:^1.10" + composer global config --no-plugins allow-plugins.symfony/flex true + composer global require --no-progress --no-scripts --no-plugins symfony/flex composer config extra.symfony.require "${{ matrix.symfony }}" - diff --git a/composer.json b/composer.json index 0cf0256..7b467ac 100644 --- a/composer.json +++ b/composer.json @@ -24,31 +24,31 @@ } ], "require": { - "php": "^7.3 || ^8.0", + "php": "^8.0", "ext-json": "*", - "coduo/php-matcher": "^5.0 || ^6.0", + "coduo/php-matcher": "^6.0", "openlss/lib-array2xml": "^1.0", "doctrine/data-fixtures": "^1.2", - "doctrine/doctrine-bundle": "^1.6 || ^2.0", + "doctrine/doctrine-bundle": "^2.0", "doctrine/orm": "^2.5", "nelmio/alice": "^3.6", "phpspec/php-diff": "^1.1", - "phpunit/phpunit": "^8.0 || ^9.0", - "symfony/browser-kit": "^4.4 || ^5.4 || ^6.0", - "symfony/finder": "^4.4 || ^5.4 || ^6.0", - "symfony/framework-bundle": "^4.4 || ^5.4 || ^6.0", + "phpunit/phpunit": "^9.0 || ^10.0", + "symfony/browser-kit": "^5.4 || ^6.0", + "symfony/finder": "^5.4 || ^6.0", + "symfony/framework-bundle": "^5.4 || ^6.0", "theofidry/alice-data-fixtures": "^1.0" }, "require-dev": { - "phpstan/phpstan-strict-rules": "^0.12", - "phpstan/phpstan-webmozart-assert": "^0.12", - "symfony/serializer": "^4.4 || ^5.4 || ^6.0", - "phpstan/phpstan": "^0.12" + "phpstan/phpstan-strict-rules": "^1.0", + "phpstan/phpstan-webmozart-assert": "^1.0", + "symfony/serializer": "^5.4 || ^6.0", + "phpstan/phpstan": "^1.8" }, "scripts": { "analyse": [ - "vendor/bin/phpstan.phar analyse --ansi --no-progress -l 5 src" + "vendor/bin/phpstan analyse --ansi --no-progress src" ] }, "conflict": { @@ -72,5 +72,10 @@ "branch-alias": { "dev-master": "5.2-dev" } + }, + "config": { + "allow-plugins": { + "dealerdirect/phpcodesniffer-composer-installer": true + } } } diff --git a/phpstan.neon b/phpstan.neon index 6f0dd3b..f63c18f 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -2,4 +2,7 @@ includes: - vendor/phpstan/phpstan-webmozart-assert/extension.neon parameters: - level: max + level: 5 + paths: + - src + - test/src/ diff --git a/src/ApiTestCase.php b/src/ApiTestCase.php index 31baa51..c9f3cd2 100644 --- a/src/ApiTestCase.php +++ b/src/ApiTestCase.php @@ -19,7 +19,6 @@ use Doctrine\ORM\EntityManager; use Fidry\AliceDataFixtures\LoaderInterface; use Fidry\AliceDataFixtures\ProcessorInterface; -use InvalidArgumentException; use Symfony\Bundle\FrameworkBundle\KernelBrowser; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; use Symfony\Component\Finder\Finder; @@ -51,9 +50,9 @@ abstract class ApiTestCase extends WebTestCase /** @var EntityManager|null */ private $entityManager; - public function __construct(?string $name = null, array $data = [], $dataName = '') + public function __construct(?string $name = null) { - parent::__construct($name, $data, $dataName); + parent::__construct($name); $this->matcherFactory = new MatcherFactory(); } diff --git a/test/src/Controller/SampleController.php b/test/src/Controller/SampleController.php index c3f0561..b9262c1 100644 --- a/test/src/Controller/SampleController.php +++ b/test/src/Controller/SampleController.php @@ -14,6 +14,7 @@ namespace ApiTestCase\Test\Controller; use ApiTestCase\Test\Entity\Product; +use ApiTestCase\Test\Entity\Category; use Doctrine\ORM\EntityManagerInterface; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; @@ -61,7 +62,7 @@ public function helloWorldAction(Request $request): Response public function productIndexAction(Request $request): Response { - $productRepository = $this->objectManager->getRepository('ApiTestCase:Product'); + $productRepository = $this->objectManager->getRepository(Product::class); $products = $productRepository->findAll(); return $this->respond($request, $products); @@ -69,7 +70,7 @@ public function productIndexAction(Request $request): Response public function categoryIndexAction(Request $request): Response { - $categoryRepository = $this->objectManager->getRepository('ApiTestCase:Category'); + $categoryRepository = $this->objectManager->getRepository(Category::class); $categories = $categoryRepository->findAll(); return $this->respond($request, $categories); @@ -77,7 +78,7 @@ public function categoryIndexAction(Request $request): Response public function showAction(Request $request): Response { - $productRepository = $this->objectManager->getRepository('ApiTestCase:Product'); + $productRepository = $this->objectManager->getRepository(Product::class); $product = $productRepository->find($request->get('id')); if (!$product) {