<?php

namespace MintyPHP\Tests\Service\Import;

use MintyPHP\Service\Audit\ImportAuditService;
use MintyPHP\Service\Import\ImportService;
use MintyPHP\Service\Import\ImportServicesFactory;
use MintyPHP\Service\Import\ImportStateStoreService;
use PHPUnit\Framework\TestCase;

class ImportServicesFactoryTest extends TestCase
{
    public function testFactoryReturnsStableInstancesPerFactoryObject(): void
    {
        $factory = new ImportServicesFactory();

        $importServiceA = $factory->createImportService();
        $importServiceB = $factory->createImportService();
        $this->assertInstanceOf(ImportService::class, $importServiceA);
        $this->assertSame($importServiceA, $importServiceB);

        $auditServiceA = $factory->createImportAuditService();
        $auditServiceB = $factory->createImportAuditService();
        $this->assertInstanceOf(ImportAuditService::class, $auditServiceA);
        $this->assertSame($auditServiceA, $auditServiceB);

        $stateStoreA = $factory->createImportStateStoreService();
        $stateStoreB = $factory->createImportStateStoreService();
        $this->assertInstanceOf(ImportStateStoreService::class, $stateStoreA);
        $this->assertSame($stateStoreA, $stateStoreB);
    }
}

