ver. 0.291: ShopProducer frontend migration to Domain + Controllers
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
40
tests/Unit/front/Controllers/ShopProducerControllerTest.php
Normal file
40
tests/Unit/front/Controllers/ShopProducerControllerTest.php
Normal 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());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user