transportRepository = $this->createMock(TransportRepository::class); $this->paymentMethodRepository = $this->createMock(PaymentMethodRepository::class); $this->controller = new ShopTransportController( $this->transportRepository, $this->paymentMethodRepository ); } public function testConstructorAcceptsRepositories(): void { $controller = new ShopTransportController( $this->transportRepository, $this->paymentMethodRepository ); $this->assertInstanceOf(ShopTransportController::class, $controller); } public function testHasMainActionMethods(): void { $this->assertTrue(method_exists($this->controller, 'list')); $this->assertTrue(method_exists($this->controller, 'edit')); $this->assertTrue(method_exists($this->controller, 'save')); } public function testHasNoLegacyAliasMethods(): void { $this->assertFalse(method_exists($this->controller, 'view_list')); $this->assertFalse(method_exists($this->controller, 'transport_edit')); $this->assertFalse(method_exists($this->controller, 'transport_save')); } public function testActionMethodReturnTypes(): void { $reflection = new \ReflectionClass($this->controller); $this->assertEquals('string', (string)$reflection->getMethod('list')->getReturnType()); $this->assertEquals('string', (string)$reflection->getMethod('edit')->getReturnType()); $this->assertEquals('void', (string)$reflection->getMethod('save')->getReturnType()); } public function testConstructorRequiresBothRepositories(): void { $reflection = new \ReflectionClass(ShopTransportController::class); $constructor = $reflection->getConstructor(); $params = $constructor->getParameters(); $this->assertCount(2, $params); $this->assertEquals('Domain\Transport\TransportRepository', $params[0]->getType()->getName()); $this->assertEquals('Domain\PaymentMethod\PaymentMethodRepository', $params[1]->getType()->getName()); } }