fix test issue

This commit is contained in:
John Bintz 2009-12-15 06:43:29 -05:00
parent a31d8dbd3e
commit 7b27b38ce5
2 changed files with 10 additions and 5 deletions

View File

@ -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(

View File

@ -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(); ?>
<div class="buythis"><form method="post" action="<?php echo $comicpress_options['buy_print_url']; ?>">
<input type="hidden" name="comic" value="<?php echo get_the_ID(); ?>" />
<button class="buythisbutton" type="submit" value="submit" name="submit"></button></form></div>