assertSame(0, $result['status'], $result['stderr']); $this->assertCount(1, $result['mails'], $result['stderr']); $this->assertSame('', $result['log']); return $result['mails'][0]; } public function testGoesToTheEditorsFromTheQueue(): void { $mail = $this->send('A title', 'Ann', '

Hello.

'); $this->assertSame('editor@site.test', $mail['headers']['to']); $this->assertSame('x.x.x Queue ', $mail['headers']['from']); $this->assertSame('New submission: A title', $mail['subject']); } public function testSubjectKeepsNonAsciiTitles(): void { $this->assertSame('New submission: Ōmega café', $this->send('Ōmega café', 'Ann', '

x

')['subject']); } public function testBodyIsPlainTextOfTheStory(): void { $mail = $this->send('T', 'Ann', "

First & bold.

\n

Line one
line two

<b> is text “quoted”

"); $this->assertSame("Please review the queue. Ann has sent the following new submission:\n\n" . "First & bold.\n\nLine one\nline two\n\n is text “quoted”" . "\n\nhttps://site.test/publish/edit", trim($mail['body'])); } public function testLongLinesAreWrapped(): void { $body = $this->send('T', 'Ann', '

' . str_repeat('word ', 40) . '

')['body']; foreach (explode("\n", trim($body)) as $line) $this->assertLessThanOrEqual(75, strlen($line)); } public function testImageSubmissionSaysSo(): void { $body = $this->send('T', 'Ann', '')['body']; $this->assertStringContainsString("new submission:\n\n", $body); } }