From 27009986d789f9e8a0976dc24afffbf83201e1d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Sat, 7 Oct 2023 21:49:29 +0200 Subject: [PATCH] Restore job with --prefer-lowest It is useful to catch misconfigured dependency constraints. It was removed in 413c33274d02ca4d320a6ec95dff8c3951c9ca5c. This implies configuring mocks so as to support psr/cache 1 psr/cache 1 does not use native return types, and phpdoc is not enough to obtain a mock that has typed methods. --- .github/workflows/continuous-integration.yml | 8 +++++++- composer.json | 4 ++-- tests/Doctrine/Tests/ORM/Query/QueryTest.php | 14 ++++++++++---- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 0b1f9c10ddf..dfba1d56b5f 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -41,6 +41,8 @@ jobs: - "pdo_sqlite" proxy: - "common" + deps: + - "highest" include: - php-version: "8.2" dbal-version: "3@dev" @@ -55,6 +57,10 @@ jobs: dbal-version: "default" proxy: "lazy-ghost" extension: "pdo_sqlite" + - php-version: "8.1" + dbal-version: "default" + deps: "lowest" + extension: "pdo_sqlite" steps: - name: "Checkout" @@ -78,6 +84,7 @@ jobs: uses: "ramsey/composer-install@v2" with: composer-options: "--ignore-platform-req=php+" + dependency-versions: "${{ matrix.deps }}" - name: "Run PHPUnit" run: "vendor/bin/phpunit -c ci/github/phpunit/${{ matrix.extension }}.xml --coverage-clover=coverage-no-cache.xml" @@ -314,7 +321,6 @@ jobs: name: "${{ github.job }}-${{ matrix.mysql-version }}-${{ matrix.extension }}-${{ matrix.php-version }}-${{ matrix.dbal-version }}-coverage" path: "coverage*.xml" - upload_coverage: name: "Upload coverage to Codecov" runs-on: "ubuntu-22.04" diff --git a/composer.json b/composer.json index 4f2b29e1aa7..a87a9251146 100644 --- a/composer.json +++ b/composer.json @@ -39,11 +39,11 @@ "doctrine/coding-standard": "^12.0", "phpbench/phpbench": "^1.0", "phpstan/phpstan": "1.10.35", - "phpunit/phpunit": "^10.0.14", + "phpunit/phpunit": "^10.4.0", "psr/log": "^1 || ^2 || ^3", "squizlabs/php_codesniffer": "3.7.2", "symfony/cache": "^5.4 || ^6.2", - "symfony/var-exporter": "^5.4 || ^6.2", + "symfony/var-exporter": "^6.2.13", "vimeo/psalm": "5.15.0" }, "suggest": { diff --git a/tests/Doctrine/Tests/ORM/Query/QueryTest.php b/tests/Doctrine/Tests/ORM/Query/QueryTest.php index 67039461394..b04621af004 100644 --- a/tests/Doctrine/Tests/ORM/Query/QueryTest.php +++ b/tests/Doctrine/Tests/ORM/Query/QueryTest.php @@ -514,11 +514,14 @@ public function testGetParameterColonNormalize(): void public function testGetQueryCacheDriverWithDefaults(): void { - $cache = $this->createMock(CacheItemPoolInterface::class); + $cache = $this->createMock(CacheItemPoolInterface::class); + $cacheItemMock = $this->createMock(CacheItemInterface::class); + $cacheItemMock->method('set')->willReturnSelf(); + $cacheItemMock->method('expiresAfter')->willReturnSelf(); $cache ->expects(self::atLeastOnce()) ->method('getItem') - ->willReturn($this->createMock(CacheItemInterface::class)); + ->willReturn($cacheItemMock); $this->entityManager->getConfiguration()->setQueryCache($cache); $this->entityManager @@ -528,11 +531,14 @@ public function testGetQueryCacheDriverWithDefaults(): void public function testGetQueryCacheDriverWithCacheExplicitlySet(): void { - $cache = $this->createMock(CacheItemPoolInterface::class); + $cache = $this->createMock(CacheItemPoolInterface::class); + $cacheItemMock = $this->createMock(CacheItemInterface::class); + $cacheItemMock->method('set')->willReturnSelf(); + $cacheItemMock->method('expiresAfter')->willReturnSelf(); $cache ->expects(self::atLeastOnce()) ->method('getItem') - ->willReturn($this->createMock(CacheItemInterface::class)); + ->willReturn($cacheItemMock); $this->entityManager ->createQuery('select u from ' . CmsUser::class . ' u')