fix test issue
This commit is contained in:
parent
a31d8dbd3e
commit
7b27b38ce5
|
@ -35,16 +35,18 @@ class BuyThisPrintWidgetTest extends PHPUnit_Framework_TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
function testBuyThisPrintStructure() {
|
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);
|
$post = (object)array('ID' => 10);
|
||||||
|
|
||||||
$result = $this->w->buy_print_structure();
|
$result = $w->buy_print_structure();
|
||||||
|
|
||||||
$this->assertTag(array(
|
$this->assertTag(array(
|
||||||
'tag' => 'form',
|
'tag' => 'form',
|
||||||
'attributes' => array('action' => $buy_print_url)
|
'attributes' => array('action' => 'buy_print_url_value')
|
||||||
), $result);
|
), $result);
|
||||||
|
|
||||||
$this->assertTag(array(
|
$this->assertTag(array(
|
||||||
|
|
|
@ -35,8 +35,11 @@ class BuyThisPrintWidget extends WP_Widget {
|
||||||
echo $after_widget;
|
echo $after_widget;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function _load_options() { return comicpress_load_options(); }
|
||||||
|
|
||||||
function buy_print_structure($content = '') {
|
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']; ?>">
|
<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(); ?>" />
|
<input type="hidden" name="comic" value="<?php echo get_the_ID(); ?>" />
|
||||||
<button class="buythisbutton" type="submit" value="submit" name="submit"></button></form></div>
|
<button class="buythisbutton" type="submit" value="submit" name="submit"></button></form></div>
|
||||||
|
|
Loading…
Reference in New Issue