diff --git a/comicpress-config.php b/comicpress-config.php index 9fbbd05..29580ea 100644 --- a/comicpress-config.php +++ b/comicpress-config.php @@ -1,10 +1,10 @@ w->_group_navigation_buttons(array(), array()); } + function testSetUpPostNavFilterReturnsData() { + _set_filter_expectation('comicpress_set_up_post_nav', array(array(array('test')))); + + $w = $this->getMock('GraphicalNavigationWidget', array('_new_comicpress_storyline', '_new_comicpress_navigation')); + $w->expects($this->once())->method('_new_comicpress_storyline')->will($this->returnValue($this->getMock('Storyline', array('set_order_via_flattened_storyline')))); + $w->expects($this->once())->method('_new_comicpress_navigation')->will($this->returnValue($this->getMock('Navigation', array('init', 'get_post_nav')))); + + $this->assertEquals('test', $w->set_up_post_nav(array())); + } + function providerTestSetUpPostNavStoryPrev() { return array( array( diff --git a/widgets/GraphicalNavigationWidget.inc b/widgets/GraphicalNavigationWidget.inc index e68e60c..3409b79 100644 --- a/widgets/GraphicalNavigationWidget.inc +++ b/widgets/GraphicalNavigationWidget.inc @@ -158,10 +158,6 @@ class GraphicalNavigationWidget extends WP_Widget { } } - if (($filter_link = apply_filters('comicpress_display_navigation_link', $link, $which, $current, $target, $instance)) !== false) { - $link = $filter_link; - } - return compact('link', 'navi_class_names'); } @@ -298,8 +294,10 @@ class GraphicalNavigationWidget extends WP_Widget { } } + // @codeCoverageIgnoreStart function _new_comicpress_storyline() { return new ComicPressStoryline(); } function _new_comicpress_navigation() { return new ComicPressNavigation(); } + // @codeCoverageIgnoreEnd function set_up_post_nav($instance) { global $post; @@ -313,7 +311,7 @@ class GraphicalNavigationWidget extends WP_Widget { $result = apply_filters('comicpress_set_up_post_nav', $post_nav, $post, $instance); if (is_array($result)) { - return array_shift($result); + return array_shift(array_shift($result)); } else { return $post_nav; }