repository = $this->createMock(UpdateRepository::class); $this->controller = new UpdateController($this->repository); } public function testConstructorAcceptsRepository(): void { $controller = new UpdateController($this->repository); $this->assertInstanceOf(UpdateController::class, $controller); } public function testHasMainViewMethod(): void { $this->assertTrue(method_exists($this->controller, 'main_view')); } public function testMainViewReturnsString(): void { $reflection = new \ReflectionClass($this->controller); $this->assertEquals('string', (string)$reflection->getMethod('main_view')->getReturnType()); } public function testHasUpdateMethod(): void { $this->assertTrue(method_exists($this->controller, 'update')); } public function testHasUpdateAllMethod(): void { $this->assertTrue(method_exists($this->controller, 'updateAll')); } public function testConstructorRequiresRepository(): void { $reflection = new \ReflectionClass(UpdateController::class); $constructor = $reflection->getConstructor(); $params = $constructor->getParameters(); $this->assertCount(1, $params); $this->assertEquals('Domain\Update\UpdateRepository', $params[0]->getType()->getName()); } }