widget display and integration bug

This commit is contained in:
John Bintz 2009-12-14 21:34:41 -05:00
parent a0fd4219ff
commit 14b79a3b82
2 changed files with 9 additions and 9 deletions

View File

@ -68,7 +68,7 @@ class ArchiveDropdownWidgetTest extends PHPUnit_Framework_TestCase {
$w->expects($this->once())->method('_new_comicpressstoryline')->will($this->returnValue($storyline));
$query = $this->getMock('WP_Query', array('query', 'has_posts', 'next_post'));
$query = $this->getMock('WP_Query', array('query', 'have_posts', 'next_post'));
$query->expects($this->once())->method('query')->with(array(
'showposts' => -1,
'category__in' => array(1,2,3)
@ -76,9 +76,9 @@ class ArchiveDropdownWidgetTest extends PHPUnit_Framework_TestCase {
wp_insert_post((object)array('ID' => 1, 'guid' => 'guid', 'post_title' => 'title'));
$query->expects($this->at(1))->method('has_posts')->will($this->returnValue(true));
$query->expects($this->at(1))->method('have_posts')->will($this->returnValue(true));
$query->expects($this->at(2))->method('next_post')->will($this->returnValue((object)array('ID' => 1, 'guid' => 'guid', 'post_title' => 'title')));
$query->expects($this->at(3))->method('has_posts')->will($this->returnValue(false));
$query->expects($this->at(3))->method('have_posts')->will($this->returnValue(false));
$w->expects($this->once())->method('_new_wp_query')->will($this->returnValue($query));

View File

@ -90,7 +90,7 @@ class ArchiveDropdownWidget extends WP_Widget {
));
$results = array();
while($query->has_posts()) {
while($query->have_posts()) {
$post = $query->next_post();
$results[get_permalink($post)] = get_the_title($post);
}
@ -103,12 +103,12 @@ class ArchiveDropdownWidget extends WP_Widget {
echo $before_widget;
$title = empty($instance['title']) ? '' : apply_filters('widget_title', $instance['title']);
if ( !empty( $title ) ) { echo $before_title . $title . $after_title; };
if ($instance['showcomicposts'] == 'on') {
comicpress_archive_dropdown_comics();
} else {
comicpress_archive_dropdown();
if (!empty($title)) { echo $before_title . $title . $after_title; };
if (method_exists($this, "build_{$instance['mode']}_dropdown")) {
echo $this->{"build_{$instance['mode']}_dropdown"}();
}
echo $after_widget;
}