From e824925290a0fdf3852f4562dc459a4cbd4e5768 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Thu, 16 Aug 2012 13:44:28 -0400
Subject: [PATCH] Rewritten test scripts for PHPUnit
---
tests/HtmlToText.php | 32 +++++++++++++++-----------------
1 files changed, 15 insertions(+), 17 deletions(-)
diff --git a/tests/html_to_text.php b/tests/HtmlToText.php
similarity index 75%
rename from tests/html_to_text.php
rename to tests/HtmlToText.php
index aabc1a8..34e2d1a 100644
--- a/tests/html_to_text.php
+++ b/tests/HtmlToText.php
@@ -5,18 +5,12 @@
*
* @package Tests
*/
-class rcube_test_html2text extends UnitTestCase
+class HtmlToText extends PHPUnit_Framework_TestCase
{
- function __construct()
+ function data()
{
- $this->UnitTestCase("HTML-to-Text conversion tests");
-
- }
-
- function test_html2text()
- {
- $data = array(
+ return array(
0 => array(
'title' => 'Test entry',
'in' => '',
@@ -48,14 +42,18 @@
'out' => 'Ś',
),
);
-
- $ht = new html2text(null, false, false);
-
- foreach ($data as $idx => $item) {
- $ht->set_html($item['in']);
- $res = $ht->get_text();
- $this->assertEqual($item['out'], $res, $item['title'] . "($idx)");
- }
}
+ /**
+ * @dataProvider data
+ */
+ function test_html2text($title, $in, $out)
+ {
+ $ht = new html2text(null, false, false);
+
+ $ht->set_html($in);
+ $res = $ht->get_text();
+
+ $this->assertEquals($out, $res, $title);
+ }
}
--
Gitblit v1.9.1