Skip to content

Commit f0a3a3b

Browse files
committed
Added tests for getHTMLBody
- Added clearer barriers and barriers between the different output options in a message
1 parent 48add92 commit f0a3a3b

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

tests/run_tests.php

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,44 @@
44
// php run_tests.php
55

66

7-
// added a clearer barrier
7+
// added a clear barrier between messages
88
function printBarrier()
99
{
1010
echo "\r\n";
1111
echo "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=";
1212
echo "\r\n";
1313
}
14+
// add in-message barrier
15+
function printInMessageBarrier()
16+
{
17+
echo "\r\n";
18+
echo "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -";
19+
echo "\r\n";
20+
}
1421
function printnl($message)
1522
{
1623
echo "$message\r\n";
1724
}
1825

26+
// include the PlancakeEmailParser class
1927
require_once(dirname(__DIR__) . DIRECTORY_SEPARATOR . "PlancakeEmailParser.php");
2028

29+
// fetch all sample emails
2130
$emails = glob(__DIR__ . DIRECTORY_SEPARATOR . "emails" . DIRECTORY_SEPARATOR . "*");
2231

32+
// start output with a barrier
2333
printBarrier();
2434

35+
// after correction, getHTMLBody doesnt include barrier in output
2536
foreach ($emails as $email) {
2637
printnl("Email $email");
2738
$emailParser = new PlancakeEmailParser(file_get_contents($email));
2839
printnl("subject: " . $emailParser->getSubject());
40+
printInMessageBarrier();
2941
printnl("body: " . $emailParser->getBody());
42+
printInMessageBarrier();
43+
printnl("plain body: " . $emailParser->getPlainBody());
44+
printInMessageBarrier();
45+
printnl("html body: " . $emailParser->getHTMLBody());
3046
printBarrier();
3147
}

0 commit comments

Comments
 (0)