repository = $this->createMock(ProductRepository::class); $this->controller = new ShopProductController($this->repository); } public function testConstructorAcceptsRepository(): void { $controller = new ShopProductController($this->repository); $this->assertInstanceOf(ShopProductController::class, $controller); } public function testHasMassEditActionMethods(): void { $this->assertTrue(method_exists($this->controller, 'mass_edit')); $this->assertTrue(method_exists($this->controller, 'mass_edit_save')); $this->assertTrue(method_exists($this->controller, 'get_products_by_category')); } public function testMassEditReturnsString(): void { $reflection = new \ReflectionClass($this->controller); $this->assertEquals('string', (string)$reflection->getMethod('mass_edit')->getReturnType()); } public function testMassEditSaveReturnsVoid(): void { $reflection = new \ReflectionClass($this->controller); $this->assertEquals('void', (string)$reflection->getMethod('mass_edit_save')->getReturnType()); } public function testGetProductsByCategoryReturnsVoid(): void { $reflection = new \ReflectionClass($this->controller); $this->assertEquals('void', (string)$reflection->getMethod('get_products_by_category')->getReturnType()); } public function testConstructorRequiresProductRepository(): void { $reflection = new \ReflectionClass(ShopProductController::class); $constructor = $reflection->getConstructor(); $params = $constructor->getParameters(); $this->assertCount(1, $params); $this->assertEquals('Domain\Product\ProductRepository', $params[0]->getType()->getName()); } }