From f10686b5ee5fb6f45e181aca4018a92de3793a67 Mon Sep 17 00:00:00 2001 From: OStefan2001 Date: Fri, 27 Nov 2026 09:56:55 +0200 Subject: [PATCH 1/2] updated codebase, composer, workflow and tests --- .github/workflows/codecov.yml | 11 ++++---- .github/workflows/static-analysis.yml | 9 ++++--- composer.json | 4 +-- phpunit.xml | 2 +- test/DebugBarTest.php | 26 +++++++++---------- test/Extension/DebugBarExtensionTest.php | 14 +++++----- test/Factory/DebugBarExtensionFactoryTest.php | 10 +++---- test/Factory/DebugBarFactoryTest.php | 14 +++++----- .../Factory/DebugBarMiddlewareFactoryTest.php | 6 ++--- test/Middleware/DebugBarMiddlewareTest.php | 6 ++--- 10 files changed, 52 insertions(+), 50 deletions(-) diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index 190b4da..9652006 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -15,13 +15,14 @@ jobs: - ubuntu-latest php: - - "8.1" - - "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 @@ -35,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') }} @@ -49,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 2423564..2763b9c 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -15,13 +15,14 @@ jobs: - ubuntu-latest php: - - "8.1" - - "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 @@ -35,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 28745c5..42e4f00 100644 --- a/composer.json +++ b/composer.json @@ -27,7 +27,7 @@ } }, "require": { - "php": "~8.1.0 || ~8.2.0 || ~8.3.0", + "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", "doctrine/dbal": "^2.13.9", "doctrine/orm": "^2.17.3", "dotkernel/dot-twigrenderer": "^3.4.2", @@ -47,7 +47,7 @@ "laminas/laminas-coding-standard": "^3.0", "phpstan/phpstan": "^2.1", "phpstan/phpstan-phpunit": "^2.0", - "phpunit/phpunit": "^10.5.7" + "phpunit/phpunit": "^12.5.22" }, "scripts": { "check": [ diff --git a/phpunit.xml b/phpunit.xml index 555b100..998feeb 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,6 +1,6 @@ diff --git a/test/DebugBarTest.php b/test/DebugBarTest.php index 41e13c3..39f291b 100644 --- a/test/DebugBarTest.php +++ b/test/DebugBarTest.php @@ -20,7 +20,7 @@ class DebugBarTest extends TestCase */ public function testCanCreate(): void { - $configuration = $this->createMock(Configuration::class); + $configuration = $this->createStub(Configuration::class); $dotDebugBar = new DebugBar($configuration, $this->config); $this->assertSame(DebugBar::class, $dotDebugBar::class); } @@ -33,7 +33,7 @@ public function testWillNotEnableIfConfigDisabled(): void { $config = $this->config; $config[DebugBar::class]['enabled'] = false; - $configuration = $this->createMock(Configuration::class); + $configuration = $this->createStub(Configuration::class); $dotDebugBar = new DebugBar($configuration, $config); $this->assertFalse($dotDebugBar->shouldEnable('')); } @@ -44,7 +44,7 @@ public function testWillNotEnableIfConfigDisabled(): void */ public function testWillNotEnableIfConfigEnabledButIpAddressIsInvalid(): void { - $configuration = $this->createMock(Configuration::class); + $configuration = $this->createStub(Configuration::class); $dotDebugBar = new DebugBar($configuration, $this->config); $this->assertFalse($dotDebugBar->shouldEnable('test')); } @@ -55,7 +55,7 @@ public function testWillNotEnableIfConfigEnabledButIpAddressIsInvalid(): void */ public function testWillNotEnableIfConfigEnabledAndValidIpv4AddressNotWhitelisted(): void { - $configuration = $this->createMock(Configuration::class); + $configuration = $this->createStub(Configuration::class); $dotDebugBar = new DebugBar($configuration, $this->config); $this->assertFalse($dotDebugBar->shouldEnable('127.0.0.1')); } @@ -66,7 +66,7 @@ public function testWillNotEnableIfConfigEnabledAndValidIpv4AddressNotWhiteliste */ public function testWillNotEnableIfConfigEnabledAndValidIpv6AddressNotWhitelisted(): void { - $configuration = $this->createMock(Configuration::class); + $configuration = $this->createStub(Configuration::class); $dotDebugBar = new DebugBar($configuration, $this->config); $this->assertFalse( $dotDebugBar->shouldEnable('::1') @@ -81,7 +81,7 @@ public function testWillEnableIfConfigEnabledAndValidWhitelistedIpv4Address(): v { $config = $this->config; $config[DebugBar::class]['ipv4Whitelist'][] = '127.0.0.1'; - $configuration = $this->createMock(Configuration::class); + $configuration = $this->createStub(Configuration::class); $dotDebugBar = new DebugBar($configuration, $config); $this->assertTrue($dotDebugBar->shouldEnable('127.0.0.1')); } @@ -94,7 +94,7 @@ public function testWillEnableIfConfigEnabledAndValidWhitelistedIpv6Address(): v { $config = $this->config; $config[DebugBar::class]['ipv6Whitelist'][] = '::1'; - $configuration = $this->createMock(Configuration::class); + $configuration = $this->createStub(Configuration::class); $dotDebugBar = new DebugBar($configuration, $config); $this->assertTrue($dotDebugBar->shouldEnable('::1')); } @@ -107,7 +107,7 @@ public function testWillEnableIfConfigEnabledAndAllowAnyValidIpv4Address(): void { $config = $this->config; $config[DebugBar::class]['ipv4Whitelist'][] = '*'; - $configuration = $this->createMock(Configuration::class); + $configuration = $this->createStub(Configuration::class); $dotDebugBar = new DebugBar($configuration, $config); $this->assertTrue($dotDebugBar->shouldEnable('127.0.0.1')); } @@ -120,7 +120,7 @@ public function testWillEnableIfConfigEnabledAndAllowAnyValidIpv6Address(): void { $config = $this->config; $config[DebugBar::class]['ipv6Whitelist'][] = '*'; - $configuration = $this->createMock(Configuration::class); + $configuration = $this->createStub(Configuration::class); $dotDebugBar = new DebugBar($configuration, $config); $this->assertTrue($dotDebugBar->shouldEnable('::1')); } @@ -131,7 +131,7 @@ public function testWillEnableIfConfigEnabledAndAllowAnyValidIpv6Address(): void */ public function testWillToggle(): void { - $configuration = $this->createMock(Configuration::class); + $configuration = $this->createStub(Configuration::class); $dotDebugBar = new DebugBar($configuration, $this->config); $this->assertFalse($dotDebugBar->isEnabled()); $dotDebugBar->enable(); @@ -148,7 +148,7 @@ public function testWillToggle(): void */ public function testWillAddMessage(): void { - $configuration = $this->createMock(Configuration::class); + $configuration = $this->createStub(Configuration::class); $dotDebugBar = new DebugBar($configuration, $this->config); $this->assertCount(0, $dotDebugBar->getMessagesCollector()->getMessages()); $dotDebugBar->addMessage('test'); @@ -162,7 +162,7 @@ public function testWillAddMessage(): void */ public function testWillStartStopMeasureTimer(): void { - $configuration = $this->createMock(Configuration::class); + $configuration = $this->createStub(Configuration::class); $dotDebugBar = new DebugBar($configuration, $this->config); $this->assertFalse($dotDebugBar->getTimeDataCollector()->hasStartedMeasure('test')); $dotDebugBar->startTimer('test'); @@ -179,7 +179,7 @@ public function testWillStartStopMeasureTimer(): void */ public function testWillAddThrowable(): void { - $configuration = $this->createMock(Configuration::class); + $configuration = $this->createStub(Configuration::class); $dotDebugBar = new DebugBar($configuration, $this->config); $this->assertCount(0, $dotDebugBar->getExceptionsCollector()->getExceptions()); $dotDebugBar->addThrowable(new \Exception('test')); diff --git a/test/Extension/DebugBarExtensionTest.php b/test/Extension/DebugBarExtensionTest.php index f0aaeae..2b3ea59 100644 --- a/test/Extension/DebugBarExtensionTest.php +++ b/test/Extension/DebugBarExtensionTest.php @@ -22,7 +22,7 @@ class DebugBarExtensionTest extends TestCase */ public function testGetFunctions(): void { - $dotDebugBar = $this->createMock(DebugBar::class); + $dotDebugBar = $this->createStub(DebugBar::class); $extension = new DebugBarExtension($dotDebugBar, $this->config['application']['url']); $functions = $extension->getFunctions(); $this->assertIsArray($functions); @@ -41,7 +41,7 @@ public function testGetFunctions(): void */ public function testRenderDebugBarEnabledReturnsTrueWhenEnabled(): void { - $configuration = $this->createMock(Configuration::class); + $configuration = $this->createStub(Configuration::class); $dotDebugBar = new DebugBar($configuration, [ DebugBar::class => [], ]); @@ -57,7 +57,7 @@ public function testRenderDebugBarEnabledReturnsTrueWhenEnabled(): void */ public function testRenderDebugBarEnabledReturnsFalseWhenDisabled(): void { - $configuration = $this->createMock(Configuration::class); + $configuration = $this->createStub(Configuration::class); $dotDebugBar = new DebugBar($configuration, [ DebugBar::class => [], ]); @@ -73,7 +73,7 @@ public function testRenderDebugBarEnabledReturnsFalseWhenDisabled(): void */ public function testWillNotRenderDebugBarCssWhenDisabled(): void { - $configuration = $this->createMock(Configuration::class); + $configuration = $this->createStub(Configuration::class); $dotDebugBar = new DebugBar($configuration, [ DebugBar::class => [], ]); @@ -89,7 +89,7 @@ public function testWillNotRenderDebugBarCssWhenDisabled(): void */ public function testWillRenderDebugBarCssWhenEnabled(): void { - $configuration = $this->createMock(Configuration::class); + $configuration = $this->createStub(Configuration::class); $dotDebugBar = new DebugBar($configuration, [ DebugBar::class => [], ]); @@ -107,7 +107,7 @@ public function testWillRenderDebugBarCssWhenEnabled(): void */ public function testWillNotRenderDebugBarJsWhenDisabled(): void { - $configuration = $this->createMock(Configuration::class); + $configuration = $this->createStub(Configuration::class); $dotDebugBar = new DebugBar($configuration, [ DebugBar::class => [], ]); @@ -123,7 +123,7 @@ public function testWillNotRenderDebugBarJsWhenDisabled(): void */ public function testWillRenderDebugBarJsWhenEnabled(): void { - $configuration = $this->createMock(Configuration::class); + $configuration = $this->createStub(Configuration::class); $dotDebugBar = new DebugBar($configuration, [ DebugBar::class => [], ]); diff --git a/test/Factory/DebugBarExtensionFactoryTest.php b/test/Factory/DebugBarExtensionFactoryTest.php index 07e00f7..559df1e 100644 --- a/test/Factory/DebugBarExtensionFactoryTest.php +++ b/test/Factory/DebugBarExtensionFactoryTest.php @@ -26,7 +26,7 @@ class DebugBarExtensionFactoryTest extends TestCase */ public function testWillNotCreateExtensionWithoutConfig(): void { - $container = $this->createMock(ContainerInterface::class); + $container = $this->createStub(ContainerInterface::class); $container->method('has')->willReturnMap([ [DebugBarInterface::class, true], @@ -44,7 +44,7 @@ public function testWillNotCreateExtensionWithoutConfig(): void */ public function testWillNotCreateExtensionWithoutPackageConfig(): void { - $container = $this->createMock(ContainerInterface::class); + $container = $this->createStub(ContainerInterface::class); $container->method('has')->willReturnMap([ [DebugBarInterface::class, true], @@ -66,7 +66,7 @@ public function testWillNotCreateExtensionWithoutPackageConfig(): void */ public function testWillNotCreateExtensionWithoutDebugBar(): void { - $container = $this->createMock(ContainerInterface::class); + $container = $this->createStub(ContainerInterface::class); $container->method('has')->willReturnMap([ ['config', true], @@ -84,8 +84,8 @@ public function testWillNotCreateExtensionWithoutDebugBar(): void */ public function testWillCreateExtension(): void { - $container = $this->createMock(ContainerInterface::class); - $debugBar = $this->createMock(DebugBarInterface::class); + $container = $this->createStub(ContainerInterface::class); + $debugBar = $this->createStub(DebugBarInterface::class); $container->method('has')->willReturnMap([ ['config', true], diff --git a/test/Factory/DebugBarFactoryTest.php b/test/Factory/DebugBarFactoryTest.php index 51b95c4..6e1b281 100644 --- a/test/Factory/DebugBarFactoryTest.php +++ b/test/Factory/DebugBarFactoryTest.php @@ -49,7 +49,7 @@ public function testWillNotCreateServiceWithoutEntityManager(): void */ public function testWillNotCreateServiceWithoutConfig(): void { - $container = $this->createMock(ContainerInterface::class); + $container = $this->createStub(ContainerInterface::class); $container->method('has')->willReturnMap([ [EntityManager::class, true], @@ -68,7 +68,7 @@ public function testWillNotCreateServiceWithoutConfig(): void */ public function testWillNotCreateServiceWithoutMissingConfigEnabled(): void { - $container = $this->createMock(ContainerInterface::class); + $container = $this->createStub(ContainerInterface::class); $container->method('has')->willReturnMap([ [EntityManager::class, true], @@ -99,7 +99,7 @@ public function testWillNotCreateServiceWithoutMissingConfigEnabled(): void */ public function testWillNotCreateServiceWithoutMissingConfigIPv4Whitelist(): void { - $container = $this->createMock(ContainerInterface::class); + $container = $this->createStub(ContainerInterface::class); $container->method('has')->willReturnMap([ [EntityManager::class, true], @@ -130,7 +130,7 @@ public function testWillNotCreateServiceWithoutMissingConfigIPv4Whitelist(): voi */ public function testWillNotCreateServiceWithoutMissingConfigIPv6Whitelist(): void { - $container = $this->createMock(ContainerInterface::class); + $container = $this->createStub(ContainerInterface::class); $container->method('has')->willReturnMap([ [EntityManager::class, true], @@ -162,7 +162,7 @@ public function testWillNotCreateServiceWithoutMissingConfigIPv6Whitelist(): voi */ public function testWillNotCreateServiceWithoutMissingConfigJavaScriptRenderer(): void { - $container = $this->createMock(ContainerInterface::class); + $container = $this->createStub(ContainerInterface::class); $container->method('has')->willReturnMap([ [EntityManager::class, true], @@ -195,9 +195,9 @@ public function testWillNotCreateServiceWithoutMissingConfigJavaScriptRenderer() */ public function testWillCreateService(): void { - $configuration = $this->createMock(Configuration::class); + $configuration = $this->createStub(Configuration::class); $connection = $this->createMock(Connection::class); - $container = $this->createMock(ContainerInterface::class); + $container = $this->createStub(ContainerInterface::class); $em = $this->createMock(EntityManager::class); $container->method('has')->willReturnMap([ diff --git a/test/Factory/DebugBarMiddlewareFactoryTest.php b/test/Factory/DebugBarMiddlewareFactoryTest.php index 8967c17..5a9ce13 100644 --- a/test/Factory/DebugBarMiddlewareFactoryTest.php +++ b/test/Factory/DebugBarMiddlewareFactoryTest.php @@ -46,7 +46,7 @@ public function testWillNotCreateServiceWithoutDebugBar(): void */ public function testWillNotCreateServiceWithoutResponseInterface(): void { - $container = $this->createMock(ContainerInterface::class); + $container = $this->createStub(ContainerInterface::class); $container->method('has')->willReturnMap([ [DebugBarInterface::class, true], @@ -64,8 +64,8 @@ public function testWillNotCreateServiceWithoutResponseInterface(): void */ public function testWillCreateMiddleware(): void { - $container = $this->createMock(ContainerInterface::class); - $debugBar = $this->createMock(DebugBarInterface::class); + $container = $this->createStub(ContainerInterface::class); + $debugBar = $this->createStub(DebugBarInterface::class); $container->method('has')->willReturnMap([ [DebugBarInterface::class, true], diff --git a/test/Middleware/DebugBarMiddlewareTest.php b/test/Middleware/DebugBarMiddlewareTest.php index 32a197a..28db4ae 100644 --- a/test/Middleware/DebugBarMiddlewareTest.php +++ b/test/Middleware/DebugBarMiddlewareTest.php @@ -23,7 +23,7 @@ class DebugBarMiddlewareTest extends TestCase */ public function testCanCreateMiddleware(): void { - $debugBar = $this->createMock(DebugBarInterface::class); + $debugBar = $this->createStub(DebugBarInterface::class); $middleware = new DebugBarMiddleware($debugBar, new DummyResponse()); $this->assertContainsOnlyInstancesOf(DebugBarMiddlewareInterface::class, [$middleware]); } @@ -35,7 +35,7 @@ public function testCanProcess(): void { $debugBar = $this->createMock(DebugBarInterface::class); $request = $this->createMock(ServerRequestInterface::class); - $handler = $this->createMock(RequestHandlerInterface::class); + $handler = $this->createStub(RequestHandlerInterface::class); $request->expects($this->once())->method('getServerParams')->willReturn([ 'REMOTE_ADDR' => '127.0.0.1', @@ -54,7 +54,7 @@ public function testCanProcess(): void */ public function testCreateErrorHandler(): void { - $debugBar = $this->createMock(DebugBarInterface::class); + $debugBar = $this->createStub(DebugBarInterface::class); $middleware = new DebugBarMiddleware($debugBar, new DummyResponse()); $reflection = new ReflectionMethod(DebugBarMiddleware::class, 'createErrorHandler'); From e4b6efe2a6c0fe2ab04326e678648652da240610 Mon Sep 17 00:00:00 2001 From: OStefan2001 Date: Fri, 27 Nov 2026 16:57:57 +0200 Subject: [PATCH 2/2] updated overview and readme --- README.md | 4 ++-- docs/book/v1/overview.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 1dfb37b..165e78a 100644 --- a/README.md +++ b/README.md @@ -18,10 +18,10 @@ Documentation is available at: https://docs.dotkernel.org/dot-debugbar/. [![GitHub stars](https://img.shields.io/github/stars/dotkernel/dot-debugbar)](https://github.com/dotkernel/dot-debugbar/stargazers) [![GitHub license](https://img.shields.io/github/license/dotkernel/dot-debugbar)](https://github.com/dotkernel/dot-debugbar/blob/1.0/LICENSE.md) -[![Build Static](https://github.com/dotkernel/dot-debugbar/actions/workflows/continuous-integration.yml/badge.svg?branch=1.0)](https://github.com/dotkernel/dot-debugbar/actions/workflows/continuous-integration.yml) +[![Build Static](https://github.com/dotkernel/dot-debugbar/actions/workflows/continuous-integration.yml/badge.svg?branch=1.x)](https://github.com/dotkernel/dot-debugbar/actions/workflows/continuous-integration.yml) [![codecov](https://codecov.io/gh/dotkernel/dot-debugbar/graph/badge.svg?token=F0N8VWKTDW)](https://codecov.io/gh/dotkernel/dot-debugbar) [![docs-build](https://github.com/dotkernel/dot-debugbar/actions/workflows/docs-build.yml/badge.svg)](https://github.com/dotkernel/dot-debugbar/actions/workflows/docs-build.yml) -[![PHPStan](https://github.com/dotkernel/dot-debugbar/actions/workflows/static-analysis.yml/badge.svg?branch=1.0)](https://github.com/dotkernel/dot-debugbar/actions/workflows/static-analysis.yml) +[![PHPStan](https://github.com/dotkernel/dot-debugbar/actions/workflows/static-analysis.yml/badge.svg?branch=1.x)](https://github.com/dotkernel/dot-debugbar/actions/workflows/static-analysis.yml) ## Install diff --git a/docs/book/v1/overview.md b/docs/book/v1/overview.md index 0b93730..625dc3b 100644 --- a/docs/book/v1/overview.md +++ b/docs/book/v1/overview.md @@ -14,7 +14,7 @@ Dotkernel's debug bar component [![GitHub stars](https://img.shields.io/github/stars/dotkernel/dot-debugbar)](https://github.com/dotkernel/dot-debugbar/stargazers) [![GitHub license](https://img.shields.io/github/license/dotkernel/dot-debugbar)](https://github.com/dotkernel/dot-debugbar/blob/1.0/LICENSE.md) -[![Build Static](https://github.com/dotkernel/dot-debugbar/actions/workflows/continuous-integration.yml/badge.svg?branch=1.0)](https://github.com/dotkernel/dot-debugbar/actions/workflows/continuous-integration.yml) +[![Build Static](https://github.com/dotkernel/dot-debugbar/actions/workflows/continuous-integration.yml/badge.svg?branch=1.x)](https://github.com/dotkernel/dot-debugbar/actions/workflows/continuous-integration.yml) [![codecov](https://codecov.io/gh/dotkernel/dot-debugbar/graph/badge.svg?token=F0N8VWKTDW)](https://codecov.io/gh/dotkernel/dot-debugbar) [![docs-build](https://github.com/dotkernel/dot-debugbar/actions/workflows/docs-build.yml/badge.svg)](https://github.com/dotkernel/dot-debugbar/actions/workflows/docs-build.yml) -[![PHPStan](https://github.com/dotkernel/dot-debugbar/actions/workflows/static-analysis.yml/badge.svg?branch=1.0)](https://github.com/dotkernel/dot-debugbar/actions/workflows/static-analysis.yml) +[![PHPStan](https://github.com/dotkernel/dot-debugbar/actions/workflows/static-analysis.yml/badge.svg?branch=1.x)](https://github.com/dotkernel/dot-debugbar/actions/workflows/static-analysis.yml)