mockRepository = $this->createMock(ArticleRepository::class); $this->controller = new ArticlesController($this->mockRepository); } public function testCanCreateController(): void { $this->assertInstanceOf(ArticlesController::class, $this->controller); } public function testConstructorAcceptsRepository(): void { $controller = new ArticlesController($this->mockRepository); $this->assertInstanceOf(ArticlesController::class, $controller); } public function testHasListMethod(): void { $this->assertTrue(method_exists($this->controller, 'list')); } public function testHasEditMethod(): void { $this->assertTrue(method_exists($this->controller, 'edit')); } public function testListMethodReturnType(): void { $reflection = new \ReflectionClass($this->controller); $this->assertEquals('string', (string)$reflection->getMethod('list')->getReturnType()); } public function testEditMethodReturnType(): void { $reflection = new \ReflectionClass($this->controller); $this->assertEquals('string', (string)$reflection->getMethod('edit')->getReturnType()); } public function testConstructorRequiresArticleRepository(): void { $reflection = new \ReflectionClass(ArticlesController::class); $constructor = $reflection->getConstructor(); $params = $constructor->getParameters(); $this->assertCount(1, $params); $this->assertEquals('Domain\Article\ArticleRepository', $params[0]->getType()->getName()); } }