Skip to content

Commit

Permalink
Merge branch '4.4' into 5.0
Browse files Browse the repository at this point in the history
* 4.4:
  Connect to RedisCluster with password auth
  Fix PHPUnit 8.5 deprecations.
  Fix EmailHeaderSame to make use of decoded value
  Allow same middleware to be used multiple times with different arguments
  • Loading branch information
nicolas-grekas committed Jul 23, 2020
2 parents 6543f86 + cb00d72 commit aa2b201
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions Test/Constraint/EmailHeaderSame.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
namespace Symfony\Component\Mime\Test\Constraint;

use PHPUnit\Framework\Constraint\Constraint;
use Symfony\Component\Mime\Header\UnstructuredHeader;
use Symfony\Component\Mime\RawMessage;

final class EmailHeaderSame extends Constraint
Expand Down Expand Up @@ -44,7 +45,7 @@ protected function matches($message): bool
throw new \LogicException('Unable to test a message header on a RawMessage instance.');
}

return $this->expectedValue === $message->getHeaders()->get($this->headerName)->getBodyAsString();
return $this->expectedValue === $this->getHeaderValue($message);
}

/**
Expand All @@ -54,6 +55,13 @@ protected function matches($message): bool
*/
protected function failureDescription($message): string
{
return sprintf('the Email %s (value is %s)', $this->toString(), $message->getHeaders()->get($this->headerName)->getBodyAsString());
return sprintf('the Email %s (value is %s)', $this->toString(), $this->getHeaderValue($message));
}

private function getHeaderValue($message): string
{
$header = $message->getHeaders()->get($this->headerName);

return $header instanceof UnstructuredHeader ? $header->getValue() : $header->getBodyAsString();
}
}

0 comments on commit aa2b201

Please sign in to comment.