From 756f90e6cf3b1a06211206b413d54e238095a001 Mon Sep 17 00:00:00 2001 From: John Bintz Date: Mon, 29 Jun 2009 11:42:57 -0400 Subject: [PATCH] refactor test --- test/DailyImageWidgetTest.php | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/test/DailyImageWidgetTest.php b/test/DailyImageWidgetTest.php index 07c7796..425ff02 100644 --- a/test/DailyImageWidgetTest.php +++ b/test/DailyImageWidgetTest.php @@ -295,12 +295,22 @@ class DailyImageWidgetTest extends PHPUnit_Framework_TestCase { $this->assertEquals($parse_xml_result, is_array(get_option('hubblesite-daily-image-cache'))); } - function testWidowProtection() { - $this->assertEquals("this is fixed", $this->diw->_fix_widows("this is fixed")); - $this->assertEquals("

this is fixed

", $this->diw->_fix_widows("

this is fixed

")); - $this->assertEquals("this is fixed", $this->diw->_fix_widows("this is fixed")); - $this->assertEquals("word", $this->diw->_fix_widows("word")); - $this->assertEquals("

this is fixed

Also fixed

", $this->diw->_fix_widows("

this is fixed

Also fixed

")); + + function providerTestWidowProtection() { + return array( + array("this is fixed", "this is fixed"), + array("

this is fixed

" ,"

this is fixed

"), + array("this is fixed", "this is fixed"), + array("word", "word"), + array("

this is fixed

Also fixed

", '

this is fixed

Also fixed

') + ); + } + + /** + * @dataProvider providerTestWidowProtection + */ + function testWidowProtection($source, $result) { + $this->assertEquals($result, $this->diw->_fix_widows($source)); } }