Files
shopPRO/tests/Unit/admin/Controllers/UpdateControllerTest.php
Jacek Pyziak c8469f4371 ver. 0.277: ShopProduct factory, Dashboard, Update migration, legacy cleanup, admin\App
- ShopProduct factory: full migration (~40 ProductRepository methods, ~30 controller actions)
- Dashboard: Domain+DI migration (DashboardRepository + DashboardController)
- Update: Domain+DI migration (UpdateRepository + UpdateController, template rewrite)
- Renamed admin\Site to admin\App, removed dead fallback routing
- Removed all legacy folders: admin/controls, admin/factory, admin/view
- Newsletter: switched from admin\factory\Articles to ArticleRepository
- 414 tests, 1335 assertions passing

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 01:06:29 +01:00

56 lines
1.6 KiB
PHP

<?php
namespace Tests\Unit\admin\Controllers;
use PHPUnit\Framework\TestCase;
use admin\Controllers\UpdateController;
use Domain\Update\UpdateRepository;
class UpdateControllerTest extends TestCase
{
private $repository;
private $controller;
protected function setUp(): void
{
$this->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());
}
}