diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index c0fbc53..9652006 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -15,14 +15,14 @@ jobs: - ubuntu-latest php: - - "8.2" - "8.3" - "8.4" - "8.5" + - "8.6" steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v7 - name: Install PHP uses: shivammathur/setup-php@v2 @@ -36,7 +36,7 @@ jobs: run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV - name: Cache dependencies installed with composer - uses: actions/cache@v3 + uses: actions/cache@v6 with: path: ${{ env.COMPOSER_CACHE_DIR }} key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }} @@ -50,6 +50,6 @@ jobs: run: vendor/bin/phpunit --colors=always --coverage-clover clover.xml - name: Send code coverage report to Codecov.io - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v7 with: token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index 9976515..2763b9c 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -15,14 +15,14 @@ jobs: - ubuntu-latest php: - - "8.2" - "8.3" - "8.4" - "8.5" + - "8.6" steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v7 - name: Install PHP uses: shivammathur/setup-php@v2 @@ -36,7 +36,7 @@ jobs: run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV - name: Cache dependencies installed with composer - uses: actions/cache@v4 + uses: actions/cache@v6 with: path: ${{ env.COMPOSER_CACHE_DIR }} key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }} diff --git a/composer.json b/composer.json index e34d47b..2fe6988 100644 --- a/composer.json +++ b/composer.json @@ -24,7 +24,7 @@ } }, "require": { - "php": "~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0", + "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", "dotkernel/dot-authorization": "^3.4.1", "dotkernel/dot-helpers": "^3.7.0", "laminas/laminas-escaper": "^2.13.0", @@ -37,7 +37,7 @@ "laminas/laminas-coding-standard": "^3.0.0", "phpstan/phpstan": "^2.1", "phpstan/phpstan-phpunit": "^2.0", - "phpunit/phpunit": "^10.4.2" + "phpunit/phpunit": "^12.5.22" }, "autoload": { "psr-4": { diff --git a/phpunit.xml b/phpunit.xml index 6de330b..6a5e8f8 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,6 +1,6 @@ diff --git a/test/Factory/NavigationMiddlewareFactoryTest.php b/test/Factory/NavigationMiddlewareFactoryTest.php index fed1db5..30838de 100644 --- a/test/Factory/NavigationMiddlewareFactoryTest.php +++ b/test/Factory/NavigationMiddlewareFactoryTest.php @@ -41,7 +41,7 @@ public function testWillNotCreateMiddlewareWithoutNavigationInterface(): void public function testWillCreateMiddleware(): void { $container = $this->createMock(ContainerInterface::class); - $navigation = $this->createMock(NavigationInterface::class); + $navigation = $this->createStub(NavigationInterface::class); $container->expects($this->once()) ->method('has') diff --git a/test/Factory/NavigationRendererFactoryTest.php b/test/Factory/NavigationRendererFactoryTest.php index b699ac0..86e3771 100644 --- a/test/Factory/NavigationRendererFactoryTest.php +++ b/test/Factory/NavigationRendererFactoryTest.php @@ -42,7 +42,7 @@ public function testWillNotCreateNavigationRendererWithoutNavigationInterface(): */ public function testWillNotCreateNavigationRendererWithoutTemplateRendererInterface(): void { - $container = $this->createMock(ContainerInterface::class); + $container = $this->createStub(ContainerInterface::class); $container->method('has')->willReturnMap([ [NavigationInterface::class, true], @@ -60,7 +60,7 @@ public function testWillNotCreateNavigationRendererWithoutTemplateRendererInterf */ public function testWillNotCreateNavigationRendererWithoutNavigationOptions(): void { - $container = $this->createMock(ContainerInterface::class); + $container = $this->createStub(ContainerInterface::class); $container->method('has')->willReturnMap([ [NavigationInterface::class, true], @@ -79,10 +79,10 @@ public function testWillNotCreateNavigationRendererWithoutNavigationOptions(): v */ public function testWillNotCreateNavigationRenderer(): void { - $container = $this->createMock(ContainerInterface::class); - $navigation = $this->createMock(NavigationInterface::class); - $renderer = $this->createMock(TemplateRendererInterface::class); - $options = $this->createMock(NavigationOptions::class); + $container = $this->createStub(ContainerInterface::class); + $navigation = $this->createStub(NavigationInterface::class); + $renderer = $this->createStub(TemplateRendererInterface::class); + $options = $this->createStub(NavigationOptions::class); $container->method('has')->willReturnMap([ [NavigationInterface::class, true], diff --git a/test/Factory/NavigationServiceFactoryTest.php b/test/Factory/NavigationServiceFactoryTest.php index 1af2f12..ec4f159 100644 --- a/test/Factory/NavigationServiceFactoryTest.php +++ b/test/Factory/NavigationServiceFactoryTest.php @@ -44,7 +44,7 @@ public function testWillNotCreateNavigationServiceWithoutRouteHelper(): void */ public function testWillNotCreateNavigationServiceWithoutProviderPluginManager(): void { - $container = $this->createMock(ContainerInterface::class); + $container = $this->createStub(ContainerInterface::class); $container->method('has')->willReturnMap([ [RouteHelper::class, true], @@ -62,7 +62,7 @@ public function testWillNotCreateNavigationServiceWithoutProviderPluginManager() */ public function testWillNotCreateNavigationServiceWithoutNavigationOptions(): void { - $container = $this->createMock(ContainerInterface::class); + $container = $this->createStub(ContainerInterface::class); $container->method('has')->willReturnMap([ [RouteHelper::class, true], @@ -81,10 +81,10 @@ public function testWillNotCreateNavigationServiceWithoutNavigationOptions(): vo */ public function testWillCreateNavigationServiceWithoutAuthorizationInterface(): void { - $container = $this->createMock(ContainerInterface::class); - $navigation = $this->createMock(RouteHelper::class); - $renderer = $this->createMock(TemplateRendererInterface::class); - $options = $this->createMock(NavigationOptions::class); + $container = $this->createStub(ContainerInterface::class); + $navigation = $this->createStub(RouteHelper::class); + $renderer = $this->createStub(TemplateRendererInterface::class); + $options = $this->createStub(NavigationOptions::class); $container->method('has')->willReturnMap([ [RouteHelper::class, true], @@ -111,11 +111,11 @@ public function testWillCreateNavigationServiceWithoutAuthorizationInterface(): */ public function testWillCreateNavigationServiceWithAuthorizationInterface(): void { - $container = $this->createMock(ContainerInterface::class); - $navigation = $this->createMock(RouteHelper::class); - $renderer = $this->createMock(TemplateRendererInterface::class); - $options = $this->createMock(NavigationOptions::class); - $authorization = $this->createMock(AuthorizationInterface::class); + $container = $this->createStub(ContainerInterface::class); + $navigation = $this->createStub(RouteHelper::class); + $renderer = $this->createStub(TemplateRendererInterface::class); + $options = $this->createStub(NavigationOptions::class); + $authorization = $this->createStub(AuthorizationInterface::class); $container->method('has')->willReturnMap([ [RouteHelper::class, true], diff --git a/test/Filter/IsAllowedFilterTest.php b/test/Filter/IsAllowedFilterTest.php index 0035bb6..401e98b 100644 --- a/test/Filter/IsAllowedFilterTest.php +++ b/test/Filter/IsAllowedFilterTest.php @@ -13,6 +13,7 @@ use Dot\Navigation\Provider\FactoryInterface; use Dot\Navigation\Service\Navigation; use Dot\Navigation\Service\NavigationInterface; +use PHPUnit\Framework\Attributes\AllowMockObjectsWithoutExpectations; use PHPUnit\Framework\MockObject\Exception; use PHPUnit\Framework\TestCase; use RecursiveIterator; @@ -22,12 +23,13 @@ class IsAllowedFilterTest extends TestCase /** * @throws Exception */ + #[AllowMockObjectsWithoutExpectations] public function testWillAcceptWithoutAuthorization(): void { - $iterator = $this->createMock(RecursiveIterator::class); - $factory = $this->createMock(FactoryInterface::class); - $route = $this->createMock(RouteHelper::class); - $options = $this->createMock(NavigationOptions::class); + $iterator = $this->createStub(RecursiveIterator::class); + $factory = $this->createStub(FactoryInterface::class); + $route = $this->createStub(RouteHelper::class); + $options = $this->createStub(NavigationOptions::class); $navigation = new Navigation($factory, $route, $options, null); $filter = $this->getMockBuilder(IsAllowedFilter::class) @@ -42,12 +44,13 @@ public function testWillAcceptWithoutAuthorization(): void /** * @throws Exception */ + #[AllowMockObjectsWithoutExpectations] public function testWillAcceptWithAuthorization(): void { - $iterator = $this->createMock(RecursiveIterator::class); - $factory = $this->createMock(FactoryInterface::class); - $route = $this->createMock(RouteHelper::class); - $options = $this->createMock(NavigationOptions::class); + $iterator = $this->createStub(RecursiveIterator::class); + $factory = $this->createStub(FactoryInterface::class); + $route = $this->createStub(RouteHelper::class); + $options = $this->createStub(NavigationOptions::class); $authorization = $this->createMock(AuthorizationInterface::class); $authorization->expects($this->once())->method('isGranted')->willReturn(true); @@ -71,7 +74,7 @@ public function testWillAcceptWithAuthorization(): void */ public function testGetChildren(): void { - $navigation = $this->createMock(NavigationInterface::class); + $navigation = $this->createStub(NavigationInterface::class); $filter = new IsAllowedFilter(new NavigationContainer([new Page()]), $navigation); $this->assertSame(IsAllowedFilter::class, $filter->getChildren()::class); @@ -82,8 +85,8 @@ public function testGetChildren(): void */ public function testWillCreateFilter(): void { - $iterator = $this->createMock(RecursiveIterator::class); - $navigation = $this->createMock(NavigationInterface::class); + $iterator = $this->createStub(RecursiveIterator::class); + $navigation = $this->createStub(NavigationInterface::class); $filter = new IsAllowedFilter($iterator, $navigation); $this->assertSame(IsAllowedFilter::class, $filter::class); diff --git a/test/NavigationMiddlewareTest.php b/test/NavigationMiddlewareTest.php index cb3a4e5..8da9b10 100644 --- a/test/NavigationMiddlewareTest.php +++ b/test/NavigationMiddlewareTest.php @@ -19,7 +19,7 @@ class NavigationMiddlewareTest extends TestCase */ public function testWillCreateMiddleware(): void { - $navigation = $this->createMock(NavigationInterface::class); + $navigation = $this->createStub(NavigationInterface::class); $middleware = new NavigationMiddleware($navigation); $this->assertSame(NavigationMiddleware::class, $middleware::class); @@ -30,9 +30,9 @@ public function testWillCreateMiddleware(): void */ public function testWillProcessRequest(): void { - $navigation = $this->createMock(NavigationInterface::class); - $request = $this->createMock(ServerRequestInterface::class); - $handler = $this->createMock(RequestHandlerInterface::class); + $navigation = $this->createStub(NavigationInterface::class); + $request = $this->createStub(ServerRequestInterface::class); + $handler = $this->createStub(RequestHandlerInterface::class); $middleware = new NavigationMiddleware($navigation); $response = $middleware->process($request, $handler); diff --git a/test/Provider/FactoryTest.php b/test/Provider/FactoryTest.php index 7a40130..948404c 100644 --- a/test/Provider/FactoryTest.php +++ b/test/Provider/FactoryTest.php @@ -22,7 +22,7 @@ class FactoryTest extends TestCase */ public function testWillCreateFactoryWithoutProviderPluginManager(): void { - $container = $this->createMock(ContainerInterface::class); + $container = $this->createStub(ContainerInterface::class); $factory = new Factory($container); $this->assertSame(Factory::class, $factory::class); @@ -33,8 +33,8 @@ public function testWillCreateFactoryWithoutProviderPluginManager(): void */ public function testWillCreateFactoryWithProviderPluginManager(): void { - $container = $this->createMock(ContainerInterface::class); - $manager = $this->createMock(ProviderPluginManager::class); + $container = $this->createStub(ContainerInterface::class); + $manager = $this->createStub(ProviderPluginManager::class); $factory = new Factory($container, $manager); $this->assertSame(Factory::class, $factory::class); @@ -46,7 +46,7 @@ public function testWillCreateFactoryWithProviderPluginManager(): void */ public function testFactoryWillNotCreateProviderWithoutProviderType(): void { - $container = $this->createMock(ContainerInterface::class); + $container = $this->createStub(ContainerInterface::class); $this->expectException(RuntimeException::class); $this->expectExceptionMessage('Undefined navigation provider type'); @@ -60,7 +60,7 @@ public function testFactoryWillNotCreateProviderWithoutProviderType(): void */ public function testFactoryWillNotCreateProviderWithInvalidProviderType(): void { - $container = $this->createMock(ContainerInterface::class); + $container = $this->createStub(ContainerInterface::class); $this->expectException(ServiceNotFoundException::class); $this->expectExceptionMessage( @@ -78,7 +78,7 @@ public function testFactoryWillNotCreateProviderWithInvalidProviderType(): void */ public function testFactoryWillCreateProviderWithValidProviderTypeAndNoOptions(): void { - $container = $this->createMock(ContainerInterface::class); + $container = $this->createStub(ContainerInterface::class); $factory = new Factory($container); $provider = $factory->create([ @@ -93,7 +93,7 @@ public function testFactoryWillCreateProviderWithValidProviderTypeAndNoOptions() */ public function testFactoryWillCreateProviderWithValidProviderTypeAndOptions(): void { - $container = $this->createMock(ContainerInterface::class); + $container = $this->createStub(ContainerInterface::class); $factory = new Factory($container); $provider = $factory->create([ @@ -108,7 +108,7 @@ public function testFactoryWillCreateProviderWithValidProviderTypeAndOptions(): */ public function testFactoryWillGetProviderPluginManagerWithoutInitialProviderPluginManager(): void { - $container = $this->createMock(ContainerInterface::class); + $container = $this->createStub(ContainerInterface::class); $factory = new Factory($container); $this->assertSame(ProviderPluginManager::class, $factory->getProviderPluginManager()::class); @@ -119,8 +119,8 @@ public function testFactoryWillGetProviderPluginManagerWithoutInitialProviderPlu */ public function testFactoryWillGetProviderPluginManagerWithInitialProviderPluginManager(): void { - $container = $this->createMock(ContainerInterface::class); - $manager = $this->createMock(ProviderPluginManager::class); + $container = $this->createStub(ContainerInterface::class); + $manager = $this->createStub(ProviderPluginManager::class); $factory = new Factory($container, $manager); $this->assertContainsOnlyInstancesOf(ProviderPluginManager::class, [$factory->getProviderPluginManager()]); diff --git a/test/Service/NavigationTest.php b/test/Service/NavigationTest.php index 865fb24..656cfdc 100644 --- a/test/Service/NavigationTest.php +++ b/test/Service/NavigationTest.php @@ -27,9 +27,9 @@ class NavigationTest extends TestCase */ public function testNavigationWillInitialize(): void { - $factory = $this->createMock(FactoryInterface::class); - $routeHelper = $this->createMock(RouteHelper::class); - $options = $this->createMock(NavigationOptions::class); + $factory = $this->createStub(FactoryInterface::class); + $routeHelper = $this->createStub(RouteHelper::class); + $options = $this->createStub(NavigationOptions::class); $navigation = new Navigation($factory, $routeHelper, $options); $this->assertContainsOnlyInstancesOf(NavigationInterface::class, [$navigation]); @@ -40,9 +40,9 @@ public function testNavigationWillInitialize(): void */ public function testAccessors(): void { - $factory = $this->createMock(FactoryInterface::class); - $routeHelper = $this->createMock(RouteHelper::class); - $options = $this->createMock(NavigationOptions::class); + $factory = $this->createStub(FactoryInterface::class); + $routeHelper = $this->createStub(RouteHelper::class); + $options = $this->createStub(NavigationOptions::class); $routeResult = RouteResult::fromRouteFailure([]); $navigation = new Navigation($factory, $routeHelper, $options); @@ -59,9 +59,9 @@ public function testAccessors(): void */ public function testNavigationWillNotGetInvalidContainer(): void { - $factory = $this->createMock(FactoryInterface::class); - $routeHelper = $this->createMock(RouteHelper::class); - $options = $this->createMock(NavigationOptions::class); + $factory = $this->createStub(FactoryInterface::class); + $routeHelper = $this->createStub(RouteHelper::class); + $options = $this->createStub(NavigationOptions::class); $this->expectException(RuntimeException::class); $this->expectExceptionMessage('Container `test` is not defined'); @@ -74,8 +74,8 @@ public function testNavigationWillNotGetInvalidContainer(): void */ public function testNavigationWillGetValidContainer(): void { - $factory = $this->createMock(FactoryInterface::class); - $routeHelper = $this->createMock(RouteHelper::class); + $factory = $this->createStub(FactoryInterface::class); + $routeHelper = $this->createStub(RouteHelper::class); $options = new NavigationOptions([ 'containers' => [ @@ -94,9 +94,9 @@ public function testNavigationWillGetValidContainer(): void */ public function testIsAllowedWillReturnTrueWithoutAuthorization(): void { - $factory = $this->createMock(FactoryInterface::class); - $routeHelper = $this->createMock(RouteHelper::class); - $options = $this->createMock(NavigationOptions::class); + $factory = $this->createStub(FactoryInterface::class); + $routeHelper = $this->createStub(RouteHelper::class); + $options = $this->createStub(NavigationOptions::class); $navigation = new Navigation($factory, $routeHelper, $options); $this->assertTrue($navigation->isAllowed(new Page())); @@ -107,10 +107,10 @@ public function testIsAllowedWillReturnTrueWithoutAuthorization(): void */ public function testIsAllowedWillReturnTrueWithAuthorizationWhenPageHasNoPermission(): void { - $factory = $this->createMock(FactoryInterface::class); - $routeHelper = $this->createMock(RouteHelper::class); - $options = $this->createMock(NavigationOptions::class); - $authorization = $this->createMock(AuthorizationInterface::class); + $factory = $this->createStub(FactoryInterface::class); + $routeHelper = $this->createStub(RouteHelper::class); + $options = $this->createStub(NavigationOptions::class); + $authorization = $this->createStub(AuthorizationInterface::class); $navigation = new Navigation($factory, $routeHelper, $options, $authorization); $this->assertTrue($navigation->isAllowed(new Page())); @@ -121,9 +121,9 @@ public function testIsAllowedWillReturnTrueWithAuthorizationWhenPageHasNoPermiss */ public function testIsAllowedWillReturnTrueWithAuthorizationWhenPageHasNoRoles(): void { - $factory = $this->createMock(FactoryInterface::class); - $routeHelper = $this->createMock(RouteHelper::class); - $options = $this->createMock(NavigationOptions::class); + $factory = $this->createStub(FactoryInterface::class); + $routeHelper = $this->createStub(RouteHelper::class); + $options = $this->createStub(NavigationOptions::class); $authorization = $this->createMock(AuthorizationInterface::class); $authorization->expects($this->once())->method('isGranted')->willReturn(true); @@ -139,9 +139,9 @@ public function testIsAllowedWillReturnTrueWithAuthorizationWhenPageHasNoRoles() */ public function testIsAllowedWillReturnTrueWithAuthorizationWhenPageHasPermissionsAndRoles(): void { - $factory = $this->createMock(FactoryInterface::class); - $routeHelper = $this->createMock(RouteHelper::class); - $options = $this->createMock(NavigationOptions::class); + $factory = $this->createStub(FactoryInterface::class); + $routeHelper = $this->createStub(RouteHelper::class); + $options = $this->createStub(NavigationOptions::class); $authorization = $this->createMock(AuthorizationInterface::class); $authorization->expects($this->once())->method('isGranted')->willReturn(true); @@ -158,9 +158,9 @@ public function testIsAllowedWillReturnTrueWithAuthorizationWhenPageHasPermissio */ public function testIsActiveWillCacheResults(): void { - $factory = $this->createMock(FactoryInterface::class); - $routeHelper = $this->createMock(RouteHelper::class); - $options = $this->createMock(NavigationOptions::class); + $factory = $this->createStub(FactoryInterface::class); + $routeHelper = $this->createStub(RouteHelper::class); + $options = $this->createStub(NavigationOptions::class); $navigation = new Navigation($factory, $routeHelper, $options); $this->assertIsArray($navigation->getIsActiveCache()); @@ -175,9 +175,9 @@ public function testIsActiveWillCacheResults(): void */ public function testIsActiveWillReturnFalseWithoutRouteResult(): void { - $factory = $this->createMock(FactoryInterface::class); - $routeHelper = $this->createMock(RouteHelper::class); - $options = $this->createMock(NavigationOptions::class); + $factory = $this->createStub(FactoryInterface::class); + $routeHelper = $this->createStub(RouteHelper::class); + $options = $this->createStub(NavigationOptions::class); $navigation = new Navigation($factory, $routeHelper, $options); $this->assertFalse($navigation->isActive(new Page())); @@ -188,9 +188,9 @@ public function testIsActiveWillReturnFalseWithoutRouteResult(): void */ public function testIsActiveWillReturnFalseWithoutSuccessfulRouteResult(): void { - $factory = $this->createMock(FactoryInterface::class); - $routeHelper = $this->createMock(RouteHelper::class); - $options = $this->createMock(NavigationOptions::class); + $factory = $this->createStub(FactoryInterface::class); + $routeHelper = $this->createStub(RouteHelper::class); + $options = $this->createStub(NavigationOptions::class); $routeResult = RouteResult::fromRouteFailure([]); $navigation = new Navigation($factory, $routeHelper, $options); @@ -203,13 +203,13 @@ public function testIsActiveWillReturnFalseWithoutSuccessfulRouteResult(): void */ public function testIsActiveWillReturnFalseWhenPageHasNoRoute(): void { - $factory = $this->createMock(FactoryInterface::class); - $routeHelper = $this->createMock(RouteHelper::class); - $options = $this->createMock(NavigationOptions::class); + $factory = $this->createStub(FactoryInterface::class); + $routeHelper = $this->createStub(RouteHelper::class); + $options = $this->createStub(NavigationOptions::class); $routeResult = RouteResult::fromRoute( new Route( 'path', - $this->createMock(MiddlewareInterface::class), + $this->createStub(MiddlewareInterface::class), ) ); @@ -223,13 +223,13 @@ public function testIsActiveWillReturnFalseWhenPageHasNoRoute(): void */ public function testIsActiveWillReturnTrueWhenRequestedRouteMatchesPageRoute(): void { - $factory = $this->createMock(FactoryInterface::class); - $routeHelper = $this->createMock(RouteHelper::class); - $options = $this->createMock(NavigationOptions::class); + $factory = $this->createStub(FactoryInterface::class); + $routeHelper = $this->createStub(RouteHelper::class); + $options = $this->createStub(NavigationOptions::class); $routeResult = RouteResult::fromRoute( new Route( 'path', - $this->createMock(MiddlewareInterface::class), + $this->createStub(MiddlewareInterface::class), Route::HTTP_METHOD_ANY, 'test' ) @@ -250,13 +250,13 @@ public function testIsActiveWillReturnTrueWhenRequestedRouteMatchesPageRoute(): */ public function testIsActiveWillReturnTrueWhenRequestedRouteMatchesChildPageRoute(): void { - $factory = $this->createMock(FactoryInterface::class); - $routeHelper = $this->createMock(RouteHelper::class); - $options = $this->createMock(NavigationOptions::class); + $factory = $this->createStub(FactoryInterface::class); + $routeHelper = $this->createStub(RouteHelper::class); + $options = $this->createStub(NavigationOptions::class); $routeResult = RouteResult::fromRoute( new Route( 'path', - $this->createMock(MiddlewareInterface::class), + $this->createStub(MiddlewareInterface::class), Route::HTTP_METHOD_ANY, 'child' ) @@ -282,9 +282,9 @@ public function testIsActiveWillReturnTrueWhenRequestedRouteMatchesChildPageRout */ public function testGetHrefWillCacheResults(): void { - $factory = $this->createMock(FactoryInterface::class); - $routeHelper = $this->createMock(RouteHelper::class); - $options = $this->createMock(NavigationOptions::class); + $factory = $this->createStub(FactoryInterface::class); + $routeHelper = $this->createStub(RouteHelper::class); + $options = $this->createStub(NavigationOptions::class); $navigation = new Navigation($factory, $routeHelper, $options); $this->assertIsArray($navigation->getHrefCache()); @@ -310,9 +310,9 @@ public function testGetHrefWillCacheResults(): void */ public function testWillNotGetHrefForInvalidPage(): void { - $factory = $this->createMock(FactoryInterface::class); - $routeHelper = $this->createMock(RouteHelper::class); - $options = $this->createMock(NavigationOptions::class); + $factory = $this->createStub(FactoryInterface::class); + $routeHelper = $this->createStub(RouteHelper::class); + $options = $this->createStub(NavigationOptions::class); $navigation = new Navigation($factory, $routeHelper, $options); @@ -327,9 +327,9 @@ public function testWillNotGetHrefForInvalidPage(): void */ public function testWillGetHrefForValidPage(): void { - $factory = $this->createMock(FactoryInterface::class); - $routeHelper = $this->createMock(RouteHelper::class); - $options = $this->createMock(NavigationOptions::class); + $factory = $this->createStub(FactoryInterface::class); + $routeHelper = $this->createStub(RouteHelper::class); + $options = $this->createStub(NavigationOptions::class); $navigation = new Navigation($factory, $routeHelper, $options); diff --git a/test/View/NavigationRendererTest.php b/test/View/NavigationRendererTest.php index ab2c9cb..2dbfc0f 100644 --- a/test/View/NavigationRendererTest.php +++ b/test/View/NavigationRendererTest.php @@ -19,9 +19,9 @@ class NavigationRendererTest extends TestCase */ public function testWillCreateNavigationRenderer(): void { - $navigation = $this->createMock(NavigationInterface::class); - $template = $this->createMock(TemplateRendererInterface::class); - $options = $this->createMock(NavigationOptions::class); + $navigation = $this->createStub(NavigationInterface::class); + $template = $this->createStub(TemplateRendererInterface::class); + $options = $this->createStub(NavigationOptions::class); $renderer = new NavigationRenderer($navigation, $template, $options); $this->assertSame(NavigationRenderer::class, $renderer::class); @@ -32,9 +32,9 @@ public function testWillCreateNavigationRenderer(): void */ public function testWillRenderPartial(): void { - $navigation = $this->createMock(NavigationInterface::class); - $template = $this->createMock(TemplateRendererInterface::class); - $options = $this->createMock(NavigationOptions::class); + $navigation = $this->createStub(NavigationInterface::class); + $template = $this->createStub(TemplateRendererInterface::class); + $options = $this->createStub(NavigationOptions::class); $renderer = new NavigationRenderer($navigation, $template, $options); $html = $renderer->renderPartial(new NavigationContainer(), 'partial'); @@ -46,9 +46,9 @@ public function testWillRenderPartial(): void */ public function testWillRenderTemplate(): void { - $navigation = $this->createMock(NavigationInterface::class); - $template = $this->createMock(TemplateRendererInterface::class); - $options = $this->createMock(NavigationOptions::class); + $navigation = $this->createStub(NavigationInterface::class); + $template = $this->createStub(TemplateRendererInterface::class); + $options = $this->createStub(NavigationOptions::class); $renderer = new NavigationRenderer($navigation, $template, $options); $html = $renderer->render(new NavigationContainer(), 'template');