da3d190216
LST-60 (3.3). Closes the modular-monolith migration. src/Entity was already
empty; this removes the last legacy residue.
- Doctrine: drop the legacy "App" mapping (empty src/Entity). resolve_target_
entities already targets modules only.
- MCP User tools (Reference/) -> Core/Infrastructure/Mcp/Tool; MCP Serializer
-> Shared/Infrastructure/Mcp (33 usages repointed).
- Controllers (mark-all-read, notification unread-count, regenerate-api-token,
user-avatar) -> Core/Infrastructure/Controller. TokenEncryptor -> Shared/
Infrastructure/Service (11 usages). AppVersion resource+provider -> Shared.
ContractType enum -> Core/Domain/Enum.
- src/{Entity,State,Controller,Service,Enum,ApiResource} now empty; routes,
MCP tool names and public API unchanged.
180 tests green, mapping valid, no route regression, cs-fixer clean.
Note: final Malio visual harmonisation (subjective) left to the PO.
50 lines
1.5 KiB
PHP
50 lines
1.5 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Tests\Unit\Mail;
|
|
|
|
use App\Module\Mail\Domain\Entity\MailConfiguration;
|
|
use App\Module\Mail\Domain\Exception\MailProviderException;
|
|
use App\Module\Mail\Domain\Repository\MailConfigurationRepositoryInterface;
|
|
use App\Module\Mail\Infrastructure\Imap\ImapMailProvider;
|
|
use App\Shared\Infrastructure\Service\TokenEncryptor;
|
|
use PHPUnit\Framework\TestCase;
|
|
use Psr\Log\NullLogger;
|
|
|
|
/**
|
|
* @internal
|
|
*/
|
|
class ImapMailProviderTest extends TestCase
|
|
{
|
|
public function testThrowsWhenConfigDisabled(): void
|
|
{
|
|
$config = new MailConfiguration();
|
|
$config->setEnabled(false);
|
|
|
|
$repo = $this->createMock(MailConfigurationRepositoryInterface::class);
|
|
$repo->method('findSingleton')->willReturn($config);
|
|
|
|
$provider = new ImapMailProvider($repo, $this->makeEncryptor(), new NullLogger());
|
|
|
|
$this->expectException(MailProviderException::class);
|
|
$provider->listFolders();
|
|
}
|
|
|
|
public function testThrowsWhenConfigMissing(): void
|
|
{
|
|
$repo = $this->createMock(MailConfigurationRepositoryInterface::class);
|
|
$repo->method('findSingleton')->willReturn(null);
|
|
|
|
$provider = new ImapMailProvider($repo, $this->makeEncryptor(), new NullLogger());
|
|
|
|
$this->expectException(MailProviderException::class);
|
|
$provider->listFolders();
|
|
}
|
|
|
|
private function makeEncryptor(): TokenEncryptor
|
|
{
|
|
return new TokenEncryptor(sodium_bin2hex(random_bytes(SODIUM_CRYPTO_SECRETBOX_KEYBYTES)));
|
|
}
|
|
}
|