From 8021d7b7b4415fea601148ef1faaa6ef65a11d4b Mon Sep 17 00:00:00 2001 From: Christian Heel <66922325+heelc29@users.noreply.github.com> Date: Thu, 20 Aug 2026 18:32:56 +0200 Subject: [PATCH 1/4] convert metadata doc-comment to attribute --- Tests/AbstractControllerTest.php | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/Tests/AbstractControllerTest.php b/Tests/AbstractControllerTest.php index a1dad3f0..e4ba5e01 100644 --- a/Tests/AbstractControllerTest.php +++ b/Tests/AbstractControllerTest.php @@ -11,11 +11,14 @@ use Joomla\Controller\AbstractController; use Joomla\Input\Input; use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\TestDox; use PHPUnit\Framework\TestCase; /** * Tests for the Joomla\Controller\AbstractController class. */ +#[CoversClass(AbstractController::class)] class AbstractControllerTest extends TestCase { /** @@ -35,22 +38,14 @@ protected function setUp(): void $this->instance = new TestController(); } - /** - * @testdox Tests the controller is instantiated correctly - * - * @covers Joomla\Controller\AbstractController - */ + #[TestDox('Tests the controller is instantiated correctly')] public function test__constructDefaultBehaviour() { $this->assertNull($this->instance->getApplication()); $this->assertNull($this->instance->getInput()); } - /** - * @testdox Tests the controller is instantiated correctly - * - * @covers Joomla\Controller\AbstractController - */ + #[TestDox('Tests the controller is instantiated correctly')] public function test__constructDependencyInjection() { $mockInput = $this->createMock(Input::class); @@ -61,11 +56,7 @@ public function test__constructDependencyInjection() $this->assertSame($mockInput, $object->getInput()); } - /** - * @testdox Tests an application object is injected into the controller and retrieved correctly - * - * @covers Joomla\Controller\AbstractController - */ + #[TestDox('Tests an application object is injected into the controller and retrieved correctly')] public function testSetAndGetApplication() { $mockApp = $this->createMock(AbstractApplication::class); @@ -74,11 +65,7 @@ public function testSetAndGetApplication() $this->assertSame($mockApp, $this->instance->getApplication()); } - /** - * @testdox Tests an input object is injected into the controller and retrieved correctly - * - * @covers Joomla\Controller\AbstractController - */ + #[TestDox('Tests an input object is injected into the controller and retrieved correctly')] public function testSetAndGetInput() { $mockInput = $this->createMock(Input::class); From 3b6ee6c550d8497147fabf2a22bd31f71a9d82b2 Mon Sep 17 00:00:00 2001 From: Christian Heel <66922325+heelc29@users.noreply.github.com> Date: Thu, 20 Aug 2026 18:33:18 +0200 Subject: [PATCH 2/4] convert mock to stub if no expectations were configured --- Tests/AbstractControllerTest.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/Tests/AbstractControllerTest.php b/Tests/AbstractControllerTest.php index e4ba5e01..d26df909 100644 --- a/Tests/AbstractControllerTest.php +++ b/Tests/AbstractControllerTest.php @@ -10,7 +10,6 @@ use Joomla\Application\AbstractApplication; use Joomla\Controller\AbstractController; use Joomla\Input\Input; -use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\TestDox; use PHPUnit\Framework\TestCase; @@ -24,7 +23,7 @@ class AbstractControllerTest extends TestCase /** * Object being tested * - * @var MockObject|AbstractController + * @var AbstractController */ private $instance; @@ -48,9 +47,9 @@ public function test__constructDefaultBehaviour() #[TestDox('Tests the controller is instantiated correctly')] public function test__constructDependencyInjection() { - $mockInput = $this->createMock(Input::class); - $mockApp = $this->createMock(AbstractApplication::class); - $object = new TestController($mockInput, $mockApp); + $mockInput = $this->createStub(Input::class); + $mockApp = $this->createStub(AbstractApplication::class); + $object = new TestController($mockInput, $mockApp); $this->assertSame($mockApp, $object->getApplication()); $this->assertSame($mockInput, $object->getInput()); @@ -59,7 +58,7 @@ public function test__constructDependencyInjection() #[TestDox('Tests an application object is injected into the controller and retrieved correctly')] public function testSetAndGetApplication() { - $mockApp = $this->createMock(AbstractApplication::class); + $mockApp = $this->createStub(AbstractApplication::class); $this->assertSame($this->instance, $this->instance->setApplication($mockApp), 'The setApplication method has a fluent interface'); $this->assertSame($mockApp, $this->instance->getApplication()); @@ -68,7 +67,7 @@ public function testSetAndGetApplication() #[TestDox('Tests an input object is injected into the controller and retrieved correctly')] public function testSetAndGetInput() { - $mockInput = $this->createMock(Input::class); + $mockInput = $this->createStub(Input::class); $this->assertSame($this->instance, $this->instance->setInput($mockInput), 'The setInput method has a fluent interface'); $this->assertSame($mockInput, $this->instance->getInput()); From 5a4bbfa867da0be814993864a58b9fcefbd2eebf Mon Sep 17 00:00:00 2001 From: Christian Heel <66922325+heelc29@users.noreply.github.com> Date: Thu, 20 Aug 2026 18:41:37 +0200 Subject: [PATCH 3/4] class_definition --- Tests/AbstractControllerTest.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Tests/AbstractControllerTest.php b/Tests/AbstractControllerTest.php index d26df909..7cee25e3 100644 --- a/Tests/AbstractControllerTest.php +++ b/Tests/AbstractControllerTest.php @@ -82,7 +82,8 @@ public function testSetAndGetInput() * @package Joomla\Controller\Tests * @since 1.0 */ -class TestController extends AbstractController { +class TestController extends AbstractController +{ public function execute() { // TODO: Implement execute() method. From d4400d8ff814815bb891b0c05b6bfffd6c65fd64 Mon Sep 17 00:00:00 2001 From: Christian Heel <66922325+heelc29@users.noreply.github.com> Date: Thu, 20 Aug 2026 18:44:17 +0200 Subject: [PATCH 4/4] fix squizlabs/php_codesniffer security https://packagist.org/security-advisories/PKSA-rdkp-vv9z-mjkg --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index b533167f..cf4c1da5 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "joomla/application": "^4.0", "joomla/input": "^4.0", "phpunit/phpunit": "^12.0", - "squizlabs/php_codesniffer": "~3.10.2", + "squizlabs/php_codesniffer": "^3.10.2", "phpstan/phpstan": "^2.1.17", "phpstan/phpstan-deprecation-rules": "^2.0.3" },