diff --git a/composer.json b/composer.json index 56b99435..ef2590ca 100644 --- a/composer.json +++ b/composer.json @@ -20,23 +20,23 @@ "symfony/framework-bundle": "^6.0 || ^7.0" }, "require-dev": { - "jackalope/jackalope-doctrine-dbal": "^1.3", + "doctrine/data-fixtures": "^1.0.0", + "doctrine/doctrine-bundle": "^2.0", + "doctrine/orm": "^2.9 || ^3.0", + "doctrine/phpcr-bundle": "^2.3 || ^3.0", "doctrine/phpcr-odm": "^1.4 || ^2.0", + "jackalope/jackalope-doctrine-dbal": "^1.3 || ^2.0", + "matthiasnoback/symfony-dependency-injection-test": "^4.1.0 || ^5.1.0", + "matthiasnoback/symfony-config-test": "^4.1.0 || ^5.1.0", "symfony/phpunit-bridge": "^7.0.3", - "matthiasnoback/symfony-dependency-injection-test": "^4.1.0", - "matthiasnoback/symfony-config-test": "^4.1.0", - "doctrine/orm": "^2.9", - "symfony-cmf/testing": "dev-sf7 as 4.2.0", - "doctrine/data-fixtures": "^1.0.0", "symfony/form": "^6.0 || ^7.0", + "symfony/monolog-bundle": "^3.5", + "symfony/security-bundle": "^6.0 || ^7.0", + "symfony/serializer": "^6.0 || ^7.0", "symfony/translation": "^6.0 || ^7.0", "symfony/validator": "^6.0 || ^7.0", - "symfony/security-bundle": "^6.0 || ^7.0", - "doctrine/doctrine-bundle": "^2.0", "symfony/twig-bundle": "^6.0 || ^7.0", - "symfony/monolog-bundle": "^3.5", - "doctrine/phpcr-bundle": "^2.3", - "symfony/serializer": "^6.0 || ^7.0", + "symfony-cmf/testing": "dev-sf7 as 4.2.0", "twig/twig": "^2.4.4 || ^3.0" }, "suggest": { @@ -70,5 +70,5 @@ "composer/package-versions-deprecated": true } }, - "minimum-stability": "beta" + "minimum-stability": "dev" } diff --git a/tests/Unit/Doctrine/Orm/RouteProviderTest.php b/tests/Unit/Doctrine/Orm/RouteProviderTest.php index a4a8f737..138f2331 100644 --- a/tests/Unit/Doctrine/Orm/RouteProviderTest.php +++ b/tests/Unit/Doctrine/Orm/RouteProviderTest.php @@ -201,15 +201,7 @@ public function testGetRoutesByNames(): void ]; $this->objectRepositoryMock - ->expects($this->at(0)) ->method('findOneBy') - ->with(['name' => $paths[0]]) - ->willReturn($this->routeMock) - ; - $this->objectRepositoryMock - ->expects($this->at(1)) - ->method('findOneBy') - ->with(['name' => $paths[1]]) ->willReturn($this->routeMock) ; @@ -217,22 +209,9 @@ public function testGetRoutesByNames(): void $candidatesMock = $this->createMock(CandidatesInterface::class); $candidatesMock - ->expects($this->at(0)) ->method('isCandidate') - ->with($paths[0]) - ->willReturn(true) - ; - $candidatesMock - ->expects($this->at(1)) - ->method('isCandidate') - ->with($paths[1]) - ->willReturn(true) - ; - $candidatesMock - ->expects($this->at(2)) - ->method('isCandidate') - ->with($paths[2]) - ->willReturn(false) + ->withConsecutive([$paths[0]], [$paths[1]], [$paths[2]]) + ->willReturnOnConsecutiveCalls(true, true, false) ; $routeProvider = new RouteProvider($this->managerRegistryMock, $candidatesMock, 'Route'); diff --git a/tests/Unit/Doctrine/Phpcr/RouteProviderTest.php b/tests/Unit/Doctrine/Phpcr/RouteProviderTest.php index b5a21e1c..8eb3ef4e 100644 --- a/tests/Unit/Doctrine/Phpcr/RouteProviderTest.php +++ b/tests/Unit/Doctrine/Phpcr/RouteProviderTest.php @@ -13,8 +13,8 @@ use Doctrine\Common\Collections\ArrayCollection; use Doctrine\ODM\PHPCR\DocumentManager; +use Doctrine\ODM\PHPCR\Query\Builder\From; use Doctrine\ODM\PHPCR\Query\Builder\QueryBuilder; -use Doctrine\ODM\PHPCR\Query\Builder\SourceFactory; use Doctrine\ODM\PHPCR\Query\Query; use Doctrine\ODM\PHPCR\UnitOfWork; use Doctrine\Persistence\ManagerRegistry; @@ -87,10 +87,10 @@ public function testGetRouteCollectionForRequest(): void ->willReturn($candidates) ; - $objects = [ + $objects = new ArrayCollection([ new Route('/my'), $this, - ]; + ]); $this->dmMock ->expects($this->once()) @@ -327,28 +327,9 @@ public function testGetRoutesByNames(): void ; $this->candidatesMock - ->expects($this->at(0)) ->method('isCandidate') - ->with('/cms/routes/test-route') - ->willReturn(true) - ; - $this->candidatesMock - ->expects($this->at(1)) - ->method('isCandidate') - ->with('/cms/simple/other-route') - ->willReturn(true) - ; - $this->candidatesMock - ->expects($this->at(2)) - ->method('isCandidate') - ->with('/cms/routes/not-a-route') - ->willReturn(true) - ; - $this->candidatesMock - ->expects($this->at(3)) - ->method('isCandidate') - ->with('/outside/prefix') - ->willReturn(false) + ->withConsecutive(['/cms/routes/test-route'], ['/cms/simple/other-route'], ['/cms/routes/not-a-route'], ['/outside/prefix']) + ->willReturnOnConsecutiveCalls(true, true, true, false) ; $paths[] = '/outside/prefix'; @@ -374,21 +355,8 @@ public function testGetRoutesByNamesNotCandidates(): void ; $this->candidatesMock - ->expects($this->at(0)) - ->method('isCandidate') - ->with('/cms/routes/test-route') - ->willReturn(false) - ; - $this->candidatesMock - ->expects($this->at(1)) ->method('isCandidate') - ->with('/cms/simple/other-route') - ->willReturn(false) - ; - $this->candidatesMock - ->expects($this->at(2)) - ->method('isCandidate') - ->with('/cms/routes/not-a-route') + ->withConsecutive(['/cms/routes/test-route'], ['/cms/simple/other-route'], ['/cms/routes/not-a-route']) ->willReturn(false) ; @@ -429,29 +397,15 @@ public function testGetRoutesByNamesUuid(): void ->willReturn($uow) ; $uow - ->expects($this->at(0)) ->method('getDocumentId') - ->with($route1) - ->willReturn('/cms/routes/test-route') - ; - $uow - ->expects($this->at(1)) - ->method('getDocumentId') - ->with($route2) - ->willReturn('/cms/routes/other-route') + ->withConsecutive([$route1], [$route2]) + ->willReturnOnConsecutiveCalls('/cms/routes/test-route', '/cms/routes/other-route') ; $this->candidatesMock - ->expects($this->at(0)) - ->method('isCandidate') - ->with('/cms/routes/test-route') - ->willReturn(true) - ; - $this->candidatesMock - ->expects($this->at(1)) ->method('isCandidate') - ->with('/cms/routes/other-route') - ->willReturn(false) + ->withConsecutive(['/cms/routes/test-route'], ['/cms/routes/other-route']) + ->willReturnOnConsecutiveCalls(true, false) ; $routeProvider = new RouteProvider($this->managerRegistryMock, $this->candidatesMock); @@ -463,7 +417,7 @@ public function testGetRoutesByNamesUuid(): void private function doRouteDump($limit): void { - $from = $this->createMock(SourceFactory::class); + $from = $this->createMock(From::class); $from->expects($this->once()) ->method('document') ->with(Route::class, 'd')