diff --git a/addons/Core/layout_constructors/LayoutConstructorsTest.html b/addons/Core/layout_constructors/LayoutConstructorsTest.html index 9304be3..48adbfd 100644 --- a/addons/Core/layout_constructors/LayoutConstructorsTest.html +++ b/addons/Core/layout_constructors/LayoutConstructorsTest.html @@ -2,8 +2,9 @@ LayoutConstructorsTest - + + \ No newline at end of file diff --git a/classes/ComicPressDBInterface.inc b/classes/ComicPressDBInterface.inc index 3ab5f20..1c0070e 100644 --- a/classes/ComicPressDBInterface.inc +++ b/classes/ComicPressDBInterface.inc @@ -13,17 +13,19 @@ class ComicPressDBInterface { } return $instance; } - + + function _get_categories() { + return get_categories("hide_empty=0"); + } + function set_comic_categories($categories) { $this->_non_comic_categories = array(); $this->_all_categories = array(); - foreach (get_categories("hide_empty=0") as $category_object) { + foreach ($this->_get_categories() as $category_object) { $this->_all_categories[] = $category_object->term_id; - if (!in_array($category_object->term_id, $categories - $this->categories_by_id[$category_object->term_id] = $category_object; } - - $this->_categories = $categories; + + $this->_non_comic_categories = array_values(array_diff($this->_all_categories, $categories)); } /** @@ -91,6 +93,7 @@ class ComicPressDBInterface { * Get the next comic from the current one. */ function get_next_comic($category = null, $override_post = null) { return $this->get_adjacent_comic($category, true, $override_post); } + } diff --git a/partials/search-comic-post.inc b/partials/search-comic-post.inc index 2b7d85f..dde70f5 100644 --- a/partials/search-comic-post.inc +++ b/partials/search-comic-post.inc @@ -1,8 +1,9 @@
- Click for full size.
-

+
+
+


diff --git a/search.php b/search.php index d876abb..17fd437 100644 --- a/search.php +++ b/search.php @@ -3,6 +3,8 @@ comicpress_init(); + ob_start(); + include_partial('search-results-count'); if (have_posts()) { diff --git a/test/ComicPressDBInterfaceTest.php b/test/ComicPressDBInterfaceTest.php new file mode 100644 index 0000000..8bcbf04 --- /dev/null +++ b/test/ComicPressDBInterfaceTest.php @@ -0,0 +1,35 @@ +assertTrue(!isset($a->test)); + $a->test = "test"; + $this->assertEquals("test", $a->test); + + $b = ComicPressDBInterface::get_instance(); + $this->assertEquals("test", $b->test); + } + + function testSetComicCategories() { + $dbi = $this->getMock('ComicPressDBInterface', array('_get_categories')); + + $dbi->expects($this->once())->method('_get_categories')->will($this->returnValue(array( + (object)array('term_id' => 1), + (object)array('term_id' => 2), + (object)array('term_id' => 3), + (object)array('term_id' => 4) + ))); + + $dbi->set_comic_categories(array(2,3)); + + $this->assertEquals(array(1,2,3,4), $dbi->_all_categories); + $this->assertEquals(array(1,4), $dbi->_non_comic_categories); + } +} + +?> \ No newline at end of file diff --git a/test/ComicPressStorylineTest.php b/test/ComicPressStorylineTest.php index ecbdceb..51a06a2 100644 --- a/test/ComicPressStorylineTest.php +++ b/test/ComicPressStorylineTest.php @@ -132,7 +132,7 @@ class ComicPressStorylineTest extends PHPUnit_Framework_TestCase { '3' => array('prior' => 2, 'previous' => 2) ); - $this->assertEquals($expected_navigation, $this->css->get_valid_storyline_nav(1)); + $this->assertEquals($expected_navigation, $this->css->get_valid_nav(1)); } }