Merge pull request #2405 from jrfnl/feature/icaltest-simplify
ICalTest: minor simplifications
This commit is contained in:
commit
e0c140a127
|
|
@ -28,7 +28,7 @@ final class ICalTest extends TestCase
|
||||||
* @covers \PHPMailer\PHPMailer\PHPMailer::createBody
|
* @covers \PHPMailer\PHPMailer\PHPMailer::createBody
|
||||||
*
|
*
|
||||||
* @param string $methodLine The Ical method line to use.
|
* @param string $methodLine The Ical method line to use.
|
||||||
* @param string $expected The expected content type header.
|
* @param string $expected The expected method in the content type header.
|
||||||
*/
|
*/
|
||||||
public function testICalMethod($methodLine, $expected)
|
public function testICalMethod($methodLine, $expected)
|
||||||
{
|
{
|
||||||
|
|
@ -62,7 +62,10 @@ final class ICalTest extends TestCase
|
||||||
. "\r\nEND:VCALENDAR";
|
. "\r\nEND:VCALENDAR";
|
||||||
$this->buildBody();
|
$this->buildBody();
|
||||||
$this->Mail->preSend();
|
$this->Mail->preSend();
|
||||||
self::assertMatchesRegularExpression(
|
|
||||||
|
$expected = 'Content-Type: text/calendar; method=' . $expected . ';';
|
||||||
|
|
||||||
|
self::assertStringContainsString(
|
||||||
$expected,
|
$expected,
|
||||||
$this->Mail->getSentMIMEMessage(),
|
$this->Mail->getSentMIMEMessage(),
|
||||||
'Wrong ICal method in Content-Type header'
|
'Wrong ICal method in Content-Type header'
|
||||||
|
|
@ -79,45 +82,45 @@ final class ICalTest extends TestCase
|
||||||
return [
|
return [
|
||||||
'Valid method: request (default)' => [
|
'Valid method: request (default)' => [
|
||||||
'methodLine' => "\r\nMETHOD:REQUEST",
|
'methodLine' => "\r\nMETHOD:REQUEST",
|
||||||
'expected' => '/Content-Type: text\/calendar; method=REQUEST;/',
|
'expected' => 'REQUEST',
|
||||||
],
|
],
|
||||||
'Valid method: publish' => [
|
'Valid method: publish' => [
|
||||||
'methodLine' => "\r\nMETHOD:PUBLISH",
|
'methodLine' => "\r\nMETHOD:PUBLISH",
|
||||||
'expected' => '/Content-Type: text\/calendar; method=PUBLISH;/',
|
'expected' => 'PUBLISH',
|
||||||
],
|
],
|
||||||
'Valid method: reply' => [
|
'Valid method: reply' => [
|
||||||
'methodLine' => "\r\nMETHOD:REPLY",
|
'methodLine' => "\r\nMETHOD:REPLY",
|
||||||
'expected' => '/Content-Type: text\/calendar; method=REPLY;/',
|
'expected' => 'REPLY',
|
||||||
],
|
],
|
||||||
'Valid method: add' => [
|
'Valid method: add' => [
|
||||||
'methodLine' => "\r\nMETHOD:ADD",
|
'methodLine' => "\r\nMETHOD:ADD",
|
||||||
'expected' => '/Content-Type: text\/calendar; method=ADD;/',
|
'expected' => 'ADD',
|
||||||
],
|
],
|
||||||
'Valid method: cancel' => [
|
'Valid method: cancel' => [
|
||||||
'methodLine' => "\r\nMETHOD:CANCEL",
|
'methodLine' => "\r\nMETHOD:CANCEL",
|
||||||
'expected' => '/Content-Type: text\/calendar; method=CANCEL;/',
|
'expected' => 'CANCEL',
|
||||||
],
|
],
|
||||||
'Valid method: refresh' => [
|
'Valid method: refresh' => [
|
||||||
'methodLine' => "\r\nMETHOD:REFRESH",
|
'methodLine' => "\r\nMETHOD:REFRESH",
|
||||||
'expected' => '/Content-Type: text\/calendar; method=REFRESH;/',
|
'expected' => 'REFRESH',
|
||||||
],
|
],
|
||||||
'Valid method: counter' => [
|
'Valid method: counter' => [
|
||||||
'methodLine' => "\r\nMETHOD:COUNTER",
|
'methodLine' => "\r\nMETHOD:COUNTER",
|
||||||
'expected' => '/Content-Type: text\/calendar; method=COUNTER;/',
|
'expected' => 'COUNTER',
|
||||||
],
|
],
|
||||||
'Valid method: declinecounter' => [
|
'Valid method: declinecounter' => [
|
||||||
'methodLine' => "\r\nMETHOD:DECLINECOUNTER",
|
'methodLine' => "\r\nMETHOD:DECLINECOUNTER",
|
||||||
'expected' => '/Content-Type: text\/calendar; method=DECLINECOUNTER;/',
|
'expected' => 'DECLINECOUNTER',
|
||||||
],
|
],
|
||||||
// Test ICal invalid method to use default (REQUEST).
|
// Test ICal invalid method to use default (REQUEST).
|
||||||
'Invalid method' => [
|
'Invalid method' => [
|
||||||
'methodLine' => "\r\nMETHOD:INVALID",
|
'methodLine' => "\r\nMETHOD:INVALID",
|
||||||
'expected' => '/Content-Type: text\/calendar; method=REQUEST;/',
|
'expected' => 'REQUEST',
|
||||||
],
|
],
|
||||||
// Test ICal missing method to use default (REQUEST).
|
// Test ICal missing method to use default (REQUEST).
|
||||||
'Missing method' => [
|
'Missing method' => [
|
||||||
'methodLine' => '',
|
'methodLine' => '',
|
||||||
'expected' => '/Content-Type: text\/calendar; method=REQUEST;/',
|
'expected' => 'REQUEST',
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue