working on actually getting this thing working
This commit is contained in:
parent
5e2579e568
commit
c781cab239
@ -45,15 +45,14 @@ class ComicPressDBInterface {
|
||||
$this->_prepare_wp_query();
|
||||
|
||||
if (!is_array($categories)) { $categories = array($categories); }
|
||||
|
||||
$sort_order = $first ? "asc" : "desc";
|
||||
$terminal_comic_query = new WP_Query();
|
||||
$terminal_comic_query->query(array(
|
||||
'showposts' => 1,
|
||||
'order' => $sort_order,
|
||||
'category__in' => $categories,
|
||||
'status' => 'publish'
|
||||
'category__in' => $categories
|
||||
));
|
||||
|
||||
$post = false;
|
||||
if ($terminal_comic_query->have_posts()) {
|
||||
$post = reset($terminal_comic_query->posts);
|
||||
|
@ -112,7 +112,13 @@ class ComicPressTagBuilder {
|
||||
|
||||
switch ($method) {
|
||||
case 'setup':
|
||||
if (empty($this->post)) { throw new Exception('You need to have retrieved a post for setup to work'); }
|
||||
if (empty($this->post)) {
|
||||
if (isset($arguments[0])) {
|
||||
throw new ComicPressException('You need to have retrieved a post for setup to work');
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
$this->_setup_postdata($this->post);
|
||||
return $this->post;
|
||||
case 'from':
|
||||
|
@ -31,6 +31,8 @@ add_action('init', '__comicpress_init');
|
||||
// @codeCoverageIgnoreStart
|
||||
|
||||
function __comicpress_init() {
|
||||
global $core;
|
||||
|
||||
$classes_search = array(
|
||||
'/classes/', '/classes/backends/'
|
||||
);
|
||||
@ -47,4 +49,8 @@ function __comicpress_init() {
|
||||
$comicpress_admin = new ComicPressAdmin();
|
||||
$comicpress_admin->init();
|
||||
$comicpress_admin->handle_update();
|
||||
|
||||
if (!is_admin()) {
|
||||
$core = new ComicPressTagBuilderFactory();
|
||||
}
|
||||
}
|
||||
|
@ -523,6 +523,18 @@ class ComicPressTagBuilderTest extends PHPUnit_Framework_TestCase {
|
||||
ComicPress::get_instance(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException ComicPressException
|
||||
*/
|
||||
function testSetupEmptyPostException() {
|
||||
$core = new ComicPressTagBuilderFactory();
|
||||
unset($core->post);
|
||||
|
||||
$this->assertTrue(false === $core->setup());
|
||||
|
||||
$core->setup(true);
|
||||
}
|
||||
|
||||
function providerTestProtect() {
|
||||
return array(
|
||||
array(null, 'test'),
|
||||
|
Loading…
Reference in New Issue
Block a user