test: Change the test to match the behavior of the MailTransport class.

see: https://github.com/kamilwylegala/cakephp2-php8/pull/20

Co-authored-by: Kenshin Okinaka <okinakak@yahoo.co.jp>
This commit is contained in:
Koji Tanaka 2023-01-08 21:07:50 +09:00 committed by Kamil Wylegala
parent 5ab5310120
commit cbf4682ad5

View file

@ -63,23 +63,23 @@ class MailTransportTest extends CakeTestCase {
$encoded = '=?UTF-8?B?Rm/DuCBCw6VyIELDqXogRm/DuCBCw6VyIELDqXogRm/DuCBCw6VyIELDqXog?='; $encoded = '=?UTF-8?B?Rm/DuCBCw6VyIELDqXogRm/DuCBCw6VyIELDqXogRm/DuCBCw6VyIELDqXog?=';
$encoded .= ' =?UTF-8?B?Rm/DuCBCw6VyIELDqXo=?='; $encoded .= ' =?UTF-8?B?Rm/DuCBCw6VyIELDqXo=?=';
$data = "From: CakePHP Test <noreply@cakephp.org>" . PHP_EOL; $data = "From: CakePHP Test <noreply@cakephp.org>" . "\r\n";
$data .= "Return-Path: CakePHP Return <pleasereply@cakephp.org>" . PHP_EOL; $data .= "Return-Path: CakePHP Return <pleasereply@cakephp.org>" . "\r\n";
$data .= "Cc: Mark Story <mark@cakephp.org>, Juan Basso <juan@cakephp.org>" . PHP_EOL; $data .= "Cc: Mark Story <mark@cakephp.org>, Juan Basso <juan@cakephp.org>" . "\r\n";
$data .= "Bcc: phpnut@cakephp.org" . PHP_EOL; $data .= "Bcc: phpnut@cakephp.org" . "\r\n";
$data .= "X-Mailer: CakePHP Email" . PHP_EOL; $data .= "X-Mailer: CakePHP Email" . "\r\n";
$data .= "Date: " . $date . PHP_EOL; $data .= "Date: " . $date . "\r\n";
$data .= "X-add: " . $encoded . PHP_EOL; $data .= "X-add: " . $encoded . "\r\n";
$data .= "Message-ID: <4d9946cf-0a44-4907-88fe-1d0ccbdd56cb@localhost>" . PHP_EOL; $data .= "Message-ID: <4d9946cf-0a44-4907-88fe-1d0ccbdd56cb@localhost>" . "\r\n";
$data .= "MIME-Version: 1.0" . PHP_EOL; $data .= "MIME-Version: 1.0" . "\r\n";
$data .= "Content-Type: text/plain; charset=UTF-8" . PHP_EOL; $data .= "Content-Type: text/plain; charset=UTF-8" . "\r\n";
$data .= "Content-Transfer-Encoding: 8bit"; $data .= "Content-Transfer-Encoding: 8bit";
$this->MailTransport->expects($this->once())->method('_mail') $this->MailTransport->expects($this->once())->method('_mail')
->with( ->with(
'CakePHP <cake@cakephp.org>', 'CakePHP <cake@cakephp.org>',
$encoded, $encoded,
implode(PHP_EOL, array('First Line', 'Second Line', '.Third Line', '')), implode("\r\n", array('First Line', 'Second Line', '.Third Line', '')),
$data, $data,
'-f' '-f'
); );