14 use PHPUnit\Framework\Constraint\Constraint;
20 private $expectedValue;
23 public function __construct(
int $expectedValue,
string $transport =
null)
25 $this->expectedValue = $expectedValue;
26 $this->transport = $transport;
34 return sprintf(
'has sent "%d" attachment(s)', $this->expectedValue);
42 protected function matches($message): bool
44 if (RawMessage::class === \get_class($message) || Message::class === \get_class($message)) {
45 throw new \LogicException(
'Unable to test a message attachment on a RawMessage or Message instance.');
48 return $this->expectedValue === \count($message->getAttachments());
58 return 'the Email '.$this->toString();