ce que le client a ecrit, dans l'ordre */ public array $writes = []; public bool $cryptoEnabled = false; public bool $closed = false; public bool $opened = false; /** @var list reponses a rendre, dans l'ordre des readReply() */ private array $replies; /** @param list $replies */ public function __construct(array $replies) { $this->replies = $replies; } public function open(string $host, int $port, int $timeoutSeconds): void { $this->opened = true; } public function write(string $raw): void { $this->writes[] = $raw; } public function readReply(): string { if ($this->replies === []) { throw new RuntimeException('FakeSmtpTransport : plus de reponse scriptee'); } return array_shift($this->replies); } public function enableCrypto(): void { $this->cryptoEnabled = true; } public function close(): void { $this->closed = true; } /** Concatene toutes les ecritures (pratique pour assertions sur le message). */ public function written(): string { return implode('', $this->writes); } }