<?php

namespace MintyPHP\Tests\Service\Mail;

use MintyPHP\Repository\Mail\MailLogRepository;
use MintyPHP\Service\Mail\MailLogService;
use MintyPHP\Service\Mail\MailService;
use MintyPHP\Service\Mail\MailServicesFactory;
use PHPUnit\Framework\TestCase;

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

        $this->assertInstanceOf(MailLogRepository::class, $factory->createMailLogRepository());
        $this->assertSame($factory->createMailLogRepository(), $factory->createMailLogRepository());

        $this->assertInstanceOf(MailService::class, $factory->createMailService());
        $this->assertSame($factory->createMailService(), $factory->createMailService());

        $this->assertInstanceOf(MailLogService::class, $factory->createMailLogService());
        $this->assertSame($factory->createMailLogService(), $factory->createMailLogService());
    }
}
