From bd8187cbbbd09b5c47ad31c74023597c8005f7d6 Mon Sep 17 00:00:00 2001 From: Joel Uckelman Date: Thu, 1 Mar 2012 03:35:38 +0100 Subject: build_post should prepend Re: for replies. --- src/PhpBB3Impl.php | 2 +- src/build_post.php | 6 ++++- test/build_postTest.php | 70 ++++++++++++++++++++++++++++++++----------------- 3 files changed, 52 insertions(+), 26 deletions(-) diff --git a/src/PhpBB3Impl.php b/src/PhpBB3Impl.php index 59f052f..7e8595a 100644 --- a/src/PhpBB3Impl.php +++ b/src/PhpBB3Impl.php @@ -206,7 +206,7 @@ class PhpBB3Impl implements PhpBB3 { $listTag = '[messages]'; $forumName = $this->getForumName($forumId); $forumTag = '[' . html_entity_decode($forumName, ENT_QUOTES) . ']'; - $subject = build_post_subject($listTag, $forumTag, $subject); + $subject = build_post_subject($listTag, $forumTag, $subject, $postType == 'reply'); list($message, $attachments) = $msg->getFlattenedParts(); diff --git a/src/build_post.php b/src/build_post.php index 9039dcb..d889b92 100644 --- a/src/build_post.php +++ b/src/build_post.php @@ -1,6 +1,6 @@ assertEquals( $expected, - build_post_subject($ltag, $ftag, $subject) + build_post_subject($ltag, $ftag, $subject, $reply) ); } 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') + array('[l]', '[f]', '', false, '(no subject)'), + array('[l]', '[f]', 'Re:', false, '(no subject)'), + array('[l]', '[f]', 'Subject', false, 'Subject'), + array('[l]', '[f]', 'Re: Subject', false, 'Subject'), + array('[l]', '[f]', 'Re: Re: Re: Subject', false, 'Subject'), + array('[l]', '[f]', '[f] Subject', false, 'Subject'), + array('[l]', '[f]', '[f] [f] Subject', false, 'Subject'), + array('[l]', '[f]', '[f] [f] Subject [f]', false, 'Subject'), + array('[l]', '[f]', '[l] [f] Re: Subject', false, 'Subject'), + array('[l]', '[f]', 'Re: [l] [f] Subject', false, 'Subject'), + array('[l]', '[f]', 'Re: Subject [l][f] Subject', false, 'Subject Subject'), + array('[l]', '[f]', 'Edit:', false, '(no subject)'), + array('[l]', '[f]', 'Edit: Re:', false, '(no subject)'), + array('[l]', '[f]', 'Edit: Subject', false, 'Subject'), + array('[l]', '[f]', 'Edit: Re: Subject', false, 'Subject'), + array('[l]', '[f]', 'Edit: Re: Re: Re: Subject', false, 'Subject'), + array('[l]', '[f]', 'Edit: [f] Subject', false, 'Subject'), + array('[l]', '[f]', 'Edit: [f] [f] Subject', false, 'Subject'), + array('[l]', '[f]', 'Edit: [f] [f] Subject [f]', false, 'Subject'), + array('[l]', '[f]', '[l] [f] Edit: Re: Subject', false, 'Subject'), + array('[l]', '[f]', 'Edit: Re: [l] [f] Subject', false, 'Subject'), + array('[l]', '[f]', 'Edit: Re: Subject [l][f] Subject', false, 'Subject Subject'), + array('[l]', '[f]', '', true, 'Re: (no subject)'), + array('[l]', '[f]', 'Re:', true, 'Re: (no subject)'), + array('[l]', '[f]', 'Subject', true, 'Re: Subject'), + array('[l]', '[f]', 'Re: Subject', true, 'Re: Subject'), + array('[l]', '[f]', 'Re: Re: Re: Subject', true, 'Re: Subject'), + array('[l]', '[f]', '[f] Subject', true, 'Re: Subject'), + array('[l]', '[f]', '[f] [f] Subject', true, 'Re: Subject'), + array('[l]', '[f]', '[f] [f] Subject [f]', true, 'Re: Subject'), + array('[l]', '[f]', '[l] [f] Re: Subject', true, 'Re: Subject'), + array('[l]', '[f]', 'Re: [l] [f] Subject', true, 'Re: Subject'), + array('[l]', '[f]', 'Re: Subject [l][f] Subject', true, 'Re: Subject Subject'), + array('[l]', '[f]', 'Edit:', true, 'Re: (no subject)'), + array('[l]', '[f]', 'Edit: Re:', true, 'Re: (no subject)'), + array('[l]', '[f]', 'Edit: Subject', true, 'Re: Subject'), + array('[l]', '[f]', 'Edit: Re: Subject', true, 'Re: Subject'), + array('[l]', '[f]', 'Edit: Re: Re: Re: Subject', true, 'Re: Subject'), + array('[l]', '[f]', 'Edit: [f] Subject', true, 'Re: Subject'), + array('[l]', '[f]', 'Edit: [f] [f] Subject', true, 'Re: Subject'), + array('[l]', '[f]', 'Edit: [f] [f] Subject [f]', true, 'Re: Subject'), + array('[l]', '[f]', '[l] [f] Edit: Re: Subject', true, 'Re: Subject'), + array('[l]', '[f]', 'Edit: Re: [l] [f] Subject', true, 'Re: Subject'), + array('[l]', '[f]', 'Edit: Re: Subject [l][f] Subject', true, 'Re: Subject Subject') ); } } -- cgit v1.2.3