summaryrefslogtreecommitdiff
path: root/test/build_postTest.php
diff options
context:
space:
mode:
authorJoel Uckelman <uckelman@nomic.net>2012-02-27 05:54:36 +0100
committerJoel Uckelman <uckelman@nomic.net>2012-02-27 05:54:36 +0100
commite66b736aa6c2e00643b9b061d7064c7991503390 (patch)
treef30b9e8b135b4785bc1b149046918668a9e67d03 /test/build_postTest.php
parent809671070efe8ff29c633e9be03d0d41a5cf6560 (diff)
Remove Edit marker from incoming mail, add it to outgoing mail.
Diffstat (limited to 'test/build_postTest.php')
-rw-r--r--test/build_postTest.php43
1 files changed, 43 insertions, 0 deletions
diff --git a/test/build_postTest.php b/test/build_postTest.php
new file mode 100644
index 0000000..be542dd
--- /dev/null
+++ b/test/build_postTest.php
@@ -0,0 +1,43 @@
+<?php
+
+require_once(__DIR__ . '/../src/build_post.php');
+
+class build_post_test extends PHPUnit_Framework_TestCase {
+
+ /** @dataProvider build_post_subject_data */
+ public function test_build_post_subject($ltag, $ftag, $subject, $expected) {
+ $this->assertEquals(
+ $expected,
+ build_post_subject($ltag, $ftag, $subject)
+ );
+ }
+
+ public function build_post_subject_data() {
+ return array(
+ array('[l]', '[f]', '', '(no subject)'),
+ array('[l]', '[f]', 'Re:', '(no subject)'),
+ array('[l]', '[f]', 'Subject', 'Subject'),
+ array('[l]', '[f]', 'Re: Subject', 'Subject'),
+ array('[l]', '[f]', 'Re: Re: Re: Subject', 'Subject'),
+ array('[l]', '[f]', '[f] Subject', 'Subject'),
+ array('[l]', '[f]', '[f] [f] Subject', 'Subject'),
+ array('[l]', '[f]', '[f] [f] Subject [f]', 'Subject'),
+ array('[l]', '[f]', '[l] [f] Re: Subject', 'Subject'),
+ array('[l]', '[f]', 'Re: [l] [f] Subject', 'Subject'),
+ array('[l]', '[f]', 'Re: Subject [l][f] Subject', 'Subject Subject'),
+ array('[l]', '[f]', 'Edit:', '(no subject)'),
+ array('[l]', '[f]', 'Edit: Re:', '(no subject)'),
+ array('[l]', '[f]', 'Edit: Subject', 'Subject'),
+ array('[l]', '[f]', 'Edit: Re: Subject', 'Subject'),
+ array('[l]', '[f]', 'Edit: Re: Re: Re: Subject', 'Subject'),
+ array('[l]', '[f]', 'Edit: [f] Subject', 'Subject'),
+ array('[l]', '[f]', 'Edit: [f] [f] Subject', 'Subject'),
+ array('[l]', '[f]', 'Edit: [f] [f] Subject [f]', 'Subject'),
+ array('[l]', '[f]', '[l] [f] Edit: Re: Subject', 'Subject'),
+ array('[l]', '[f]', 'Edit: Re: [l] [f] Subject', 'Subject'),
+ array('[l]', '[f]', 'Edit: Re: Subject [l][f] Subject', 'Subject Subject')
+ );
+ }
+}
+
+?>