summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJoel Uckelman <uckelman@nomic.net>2012-02-27 03:16:45 +0100
committerJoel Uckelman <uckelman@nomic.net>2012-02-27 03:16:45 +0100
commit7750ae52e7b73af2f7d4f4964dfb2ac007f9c6b6 (patch)
tree00bef105e5acb4fbc7fbcc7a32aedfe306b18422 /test
parent94ee47fd7f300085b4dd340329c18c87b7d14b98 (diff)
Converted some tests to use dataProviders.
Diffstat (limited to 'test')
-rw-r--r--test/build_email_test.php45
1 files changed, 17 insertions, 28 deletions
diff --git a/test/build_email_test.php b/test/build_email_test.php
index ae88388..51ccb44 100644
--- a/test/build_email_test.php
+++ b/test/build_email_test.php
@@ -3,20 +3,17 @@
require_once(__DIR__ . '/../src/build_email.php');
class build_email_test extends PHPUnit_Framework_TestCase {
-
- public function test_build_text_edit() {
- $this->assertEquals(
- "[This message has been edited.]
-
-foo bar",
- build_text('foo bar', true)
- );
+ /** @dataProvider build_text_data */
+ public function test_build_text($text, $edit, $expected) {
+ $this->assertEquals($expected, build_text($text, $edit));
}
- public function test_build_text_no_edit() {
- $this->assertEquals(
- 'foo bar',
- build_text('foo bar', false)
+ public function build_text_data() {
+ return array(
+ array('foo bar', false, 'foo bar'),
+ array('foo bar', true, "[This message has been edited.]
+
+foo bar")
);
}
@@ -30,24 +27,16 @@ http://www.example.com/viewtopic.php?p=42#p42",
);
}
- public function test_build_from_nonascii() {
- $this->assertEquals(
- '=?UTF-8?B?SGVpesO2bHLDvGNrc3Rvw59hYmTDpG1wZnVuZw==?= <foo@example.com>',
- build_from('Heizölrückstoßabdämpfung', 'foo@example.com')
- );
- }
-
- public function test_build_from_ascii() {
- $this->assertEquals(
- 'Joel Uckelman <uckelman@nomic.net>',
- build_from('Joel Uckelman', 'uckelman@nomic.net')
- );
+ /** @dataProvider build_from_data */
+ public function test_build_from($name, $email, $expected) {
+ $this->assertEquals($expected, build_from($name, $email));
}
- public function test_build_from_rfc822_specials() {
- $this->assertEquals(
- '"L.Tankersley" <leland53@comcast.net>',
- build_from('L.Tankersley', 'leland53@comcast.net')
+ public function build_from_data() {
+ return array(
+ array('Heizölrückstoßabdämpfung', 'foo@example.com', '=?UTF-8?B?SGVpesO2bHLDvGNrc3Rvw59hYmTDpG1wZnVuZw==?= <foo@example.com>'),
+ array('Joel Uckelman', 'uckelman@nomic.net', 'Joel Uckelman <uckelman@nomic.net>'),
+ array('L.Tankersley', 'leland53@comcast.net', '"L.Tankersley" <leland53@comcast.net>')
);
}