refactor: rename remote mail service

Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
2026-09-26 22:00:16 -04:00
parent 54a24c9892
commit 8abd2c2c8c
7 changed files with 52 additions and 52 deletions
+3 -3
View File
@@ -9,7 +9,7 @@ use KTXM\ProviderImap\Client\Protocol\Command\CreateCommand;
use KTXM\ProviderImap\Client\Result\CommandCompletion;
use KTXM\ProviderImap\Client\Transport\{ConnectionInterface, ConnectionFactoryInterface};
use KTXM\ProviderImap\Providers\Service;
use KTXM\ProviderImap\Service\Remote\RemoteMailService;
use KTXM\ProviderImap\Service\Live\LiveMailService;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
@@ -46,9 +46,9 @@ final class CommandCompletionTest extends TestCase
return $client;
}
private function service(Client $client): RemoteMailService
private function service(Client $client): LiveMailService
{
return new class($this->createStub(Service::class), $client) extends RemoteMailService {
return new class($this->createStub(Service::class), $client) extends LiveMailService {
public function __construct(Service $service, private readonly Client $client)
{
parent::__construct($service);
@@ -5,14 +5,14 @@ declare(strict_types=1);
namespace KTXT\ProviderImap\Tests\Unit;
use KTXM\ProviderImap\Providers\Service;
use KTXM\ProviderImap\Service\Remote\RemoteMailService;
use KTXM\ProviderImap\Service\Live\LiveMailService;
use PHPUnit\Framework\TestCase;
use RuntimeException;
final class RemoteMailServiceTest extends TestCase {
final class LiveMailServiceTest extends TestCase {
public function testEntityReplaceReturnsAuthoritativeReplacementUid(): void {
$service = new RemoteMailServiceStub($this->createStub(Service::class));
$service = new LiveMailServiceStub($this->createStub(Service::class));
$service->appendUid = 202;
$service->destroyResults = [[101 => true]];
@@ -28,7 +28,7 @@ final class RemoteMailServiceTest extends TestCase {
}
public function testEntityReplaceRemovesReplacementWhenOldUidCannotBeDeleted(): void {
$service = new RemoteMailServiceStub($this->createStub(Service::class));
$service = new LiveMailServiceStub($this->createStub(Service::class));
$service->appendUid = 202;
$service->destroyResults = [
[101 => false],
@@ -49,7 +49,7 @@ final class RemoteMailServiceTest extends TestCase {
}
}
final class RemoteMailServiceStub extends RemoteMailService {
final class LiveMailServiceStub extends LiveMailService {
public ?int $appendUid = null;
public array $createCalls = [];
+6 -6
View File
@@ -5,7 +5,7 @@ declare(strict_types=1);
namespace KTXT\ProviderImap\Tests\Unit;
use KTXM\ProviderImap\Providers\Service;
use KTXM\ProviderImap\Service\Remote\RemoteMailService;
use KTXM\ProviderImap\Service\Live\LiveMailService;
use PHPUnit\Framework\TestCase;
use ReflectionProperty;
@@ -14,18 +14,18 @@ final class ServiceTest extends TestCase
public function testEntityExtantReportsExistenceOfEachIdentifier(): void
{
$service = new Service();
$remote = new ServiceTestRemoteStub($this->createStub(Service::class));
$remote->existing = [5];
(new ReflectionProperty(Service::class, 'remoteService'))->setValue($service, $remote);
$live = new ServiceTestLiveStub($this->createStub(Service::class));
$live->existing = [5];
(new ReflectionProperty(Service::class, 'liveService'))->setValue($service, $live);
$result = $service->entityExtant('INBOX', 5, '6', 'abc', 0);
$this->assertSame([5 => true, 6 => false, 'abc' => false, 0 => false], $result);
$this->assertSame([['INBOX', [5, 6]]], $remote->extantCalls);
$this->assertSame([['INBOX', [5, 6]]], $live->extantCalls);
}
}
final class ServiceTestRemoteStub extends RemoteMailService
final class ServiceTestLiveStub extends LiveMailService
{
/** @var int[] */
public array $existing = [];