refactor: wydzielenie ApiloRepository z IntegrationsRepository

IntegrationsRepository zredukowany z ~875 do ~340 linii.
Nowa klasa ApiloRepository przejmuje 19 metod apilo*.
Konsumenci (IntegrationsController, OrderAdminService, cron.php) zaktualizowani przez DI.
Suite: 818 testów, 2275 asercji.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Jacek
2026-03-12 11:52:00 +01:00
parent 5a58ab17e7
commit a484a203d4
12 changed files with 761 additions and 667 deletions

View File

@@ -4,21 +4,24 @@ namespace Tests\Unit\admin\Controllers;
use PHPUnit\Framework\TestCase;
use admin\Controllers\IntegrationsController;
use Domain\Integrations\IntegrationsRepository;
use Domain\Integrations\ApiloRepository;
class IntegrationsControllerTest extends TestCase
{
private $repository;
private $apiloRepository;
private IntegrationsController $controller;
protected function setUp(): void
{
$this->repository = $this->createMock(IntegrationsRepository::class);
$this->controller = new IntegrationsController($this->repository);
$this->apiloRepository = $this->createMock(ApiloRepository::class);
$this->controller = new IntegrationsController($this->repository, $this->apiloRepository);
}
public function testConstructorAcceptsDependencies(): void
{
$controller = new IntegrationsController($this->repository);
$controller = new IntegrationsController($this->repository, $this->apiloRepository);
$this->assertInstanceOf(IntegrationsController::class, $controller);
}
@@ -28,11 +31,15 @@ class IntegrationsControllerTest extends TestCase
$constructor = $reflection->getConstructor();
$params = $constructor->getParameters();
$this->assertCount(1, $params);
$this->assertCount(2, $params);
$this->assertEquals(
'Domain\Integrations\IntegrationsRepository',
$params[0]->getType()->getName()
);
$this->assertEquals(
'Domain\Integrations\ApiloRepository',
$params[1]->getType()->getName()
);
}
public function testHasLogsMethods(): void