From 7b27b38ce587f5d101fdfe150d462c4705430064 Mon Sep 17 00:00:00 2001 From: John Bintz Date: Tue, 15 Dec 2009 06:43:29 -0500 Subject: [PATCH] fix test issue --- test/widgets/BuyThisPrintWidgetTest.php | 10 ++++++---- widgets/BuyThisPrintWidget.inc | 5 ++++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/test/widgets/BuyThisPrintWidgetTest.php b/test/widgets/BuyThisPrintWidgetTest.php index 7eb99f1..fc27f15 100644 --- a/test/widgets/BuyThisPrintWidgetTest.php +++ b/test/widgets/BuyThisPrintWidgetTest.php @@ -35,16 +35,18 @@ class BuyThisPrintWidgetTest extends PHPUnit_Framework_TestCase { } function testBuyThisPrintStructure() { - global $post, $buy_print_url; + global $post; + + $w = $this->getMock('BuyThisPrintWidget', array('_load_options')); + $w->expects($this->once())->method('_load_options')->will($this->returnValue(array('buy_print_url' => 'buy_print_url_value'))); - $buy_print_url = 'buy print url'; $post = (object)array('ID' => 10); - $result = $this->w->buy_print_structure(); + $result = $w->buy_print_structure(); $this->assertTag(array( 'tag' => 'form', - 'attributes' => array('action' => $buy_print_url) + 'attributes' => array('action' => 'buy_print_url_value') ), $result); $this->assertTag(array( diff --git a/widgets/BuyThisPrintWidget.inc b/widgets/BuyThisPrintWidget.inc index 7681aa7..139e044 100644 --- a/widgets/BuyThisPrintWidget.inc +++ b/widgets/BuyThisPrintWidget.inc @@ -35,8 +35,11 @@ class BuyThisPrintWidget extends WP_Widget { echo $after_widget; } + function _load_options() { return comicpress_load_options(); } + function buy_print_structure($content = '') { - $comicpress_options = comicpress_load_options(); ?> + $comicpress_options = $this->_load_options(); + ob_start(); ?>