<?php

namespace MintyPHP\Tests\Service\Settings;

use MintyPHP\Repository\Settings\SettingRepository;
use MintyPHP\Service\Settings\SettingCacheService;
use MintyPHP\Service\Settings\SettingGateway;
use MintyPHP\Service\Settings\SettingServicesFactory;
use MintyPHP\Service\Settings\ThemeConfigService;
use PHPUnit\Framework\TestCase;

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

        $this->assertInstanceOf(SettingRepository::class, $factory->createSettingRepository());
        $this->assertSame($factory->createSettingRepository(), $factory->createSettingRepository());

        $this->assertInstanceOf('MintyPHP\\Service\\Settings\\SettingService', $factory->createSettingService());
        $this->assertSame($factory->createSettingService(), $factory->createSettingService());

        $this->assertInstanceOf(SettingCacheService::class, $factory->createSettingCacheService());
        $this->assertSame($factory->createSettingCacheService(), $factory->createSettingCacheService());

        $this->assertInstanceOf(ThemeConfigService::class, $factory->createThemeConfigService());
        $this->assertSame($factory->createThemeConfigService(), $factory->createThemeConfigService());

        $this->assertInstanceOf(SettingGateway::class, $factory->createSettingGateway());
        $this->assertSame($factory->createSettingGateway(), $factory->createSettingGateway());
    }
}
