ver. 0.291: ShopProducer frontend migration to Domain + Controllers

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-17 20:32:07 +01:00
parent 1ba0c12327
commit 6181ef958d
19 changed files with 267 additions and 119 deletions

View File

@@ -0,0 +1,40 @@
<?php
namespace Tests\Unit\front\Controllers;
use PHPUnit\Framework\TestCase;
use front\Controllers\ShopProducerController;
use Domain\Producer\ProducerRepository;
class ShopProducerControllerTest extends TestCase
{
private $repository;
private $controller;
protected function setUp(): void
{
$this->repository = $this->createMock(ProducerRepository::class);
$this->controller = new ShopProducerController($this->repository);
}
public function testConstructorAcceptsRepository(): void
{
$controller = new ShopProducerController($this->repository);
$this->assertInstanceOf(ShopProducerController::class, $controller);
}
public function testHasMainActionMethods(): void
{
$this->assertTrue(method_exists($this->controller, 'products'));
$this->assertTrue(method_exists($this->controller, 'list'));
}
public function testConstructorRequiresProducerRepository(): void
{
$reflection = new \ReflectionClass(ShopProducerController::class);
$constructor = $reflection->getConstructor();
$params = $constructor->getParameters();
$this->assertCount(1, $params);
$this->assertEquals('Domain\Producer\ProducerRepository', $params[0]->getType()->getName());
}
}