14 use PHPUnit\Framework\Constraint\Constraint;
20 private $expectedValue;
22 public function __construct(
string $headerName,
string $expectedValue)
24 $this->headerName = $headerName;
25 $this->expectedValue = $expectedValue;
33 return sprintf(
'has header "%s" with value "%s"', $this->headerName, $this->expectedValue);
41 protected function matches($message): bool
43 if (RawMessage::class === \get_class($message)) {
44 throw new \LogicException(
'Unable to test a message header on a RawMessage instance.');
47 return $this->expectedValue === $message->getHeaders()->get($this->headerName)->getBodyAsString();
57 return sprintf(
'the Email %s (value is %s)', $this->
toString(), $message->getHeaders()->get($this->headerName)->getBodyAsString());