diff options
Diffstat (limited to 'test/build_post_test.php')
-rw-r--r-- | test/build_post_test.php | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/test/build_post_test.php b/test/build_post_test.php new file mode 100644 index 0000000..72e28a7 --- /dev/null +++ b/test/build_post_test.php @@ -0,0 +1,34 @@ +<?php + +require_once('PHPUnit/Framework.php'); + +require_once(__DIR__ . '/../src/build_post.php'); + +class build_post_test extends PHPUnit_Framework_TestCase { + + /* @dataProvider buildPostSubjectProvider */ + public function testBuildPostSubject($ltag, $ftag, $subject, $expected) { + $this->assertEquals( + build_post_subject($listtag, $forumtag, $subject), + $expected + ); + } + + public function builtPostSubjectProvider() { + 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') + ); + } +} + +?> |