from working
This commit is contained in:
parent
672d8a2255
commit
c24214afff
@ -45,6 +45,16 @@ class ComicPressTagBuilder {
|
|||||||
if (empty($this->post)) { throw new Exception('You need to have retrieved a post for setup to work'); }
|
if (empty($this->post)) { throw new Exception('You need to have retrieved a post for setup to work'); }
|
||||||
$this->_setup_postdata($this->post);
|
$this->_setup_postdata($this->post);
|
||||||
return $this->post;
|
return $this->post;
|
||||||
|
case 'from':
|
||||||
|
if (!isset($arguments[0])) {
|
||||||
|
throw new ComicPressException('Need to specify a post');
|
||||||
|
}
|
||||||
|
if (!is_object($arguments[0]) && !is_array($arguments[0])) {
|
||||||
|
throw new ComicPressException('Provided post needs to be an array or object');
|
||||||
|
}
|
||||||
|
$this->parent_post = (object)$arguments[0];
|
||||||
|
$ok = true;
|
||||||
|
break;
|
||||||
case 'next':
|
case 'next':
|
||||||
case 'previous':
|
case 'previous':
|
||||||
case 'first':
|
case 'first':
|
||||||
@ -53,7 +63,9 @@ class ComicPressTagBuilder {
|
|||||||
$ok = true;
|
$ok = true;
|
||||||
break;
|
break;
|
||||||
case 'in':
|
case 'in':
|
||||||
if (!isset($arguments[0])) { throw new Exception('Need to specify a category'); }
|
if (!isset($arguments[0])) {
|
||||||
|
throw new ComicPressException('Need to specify a category');
|
||||||
|
}
|
||||||
$this->restrictions[] = array('child_of', $arguments[0]);
|
$this->restrictions[] = array('child_of', $arguments[0]);
|
||||||
$ok = true;
|
$ok = true;
|
||||||
break;
|
break;
|
||||||
|
@ -63,6 +63,14 @@ class ComicPressTagBuilderTest extends PHPUnit_Framework_TestCase {
|
|||||||
array('get_first_post', array(2,3,4), 'current-post'),
|
array('get_first_post', array(2,3,4), 'current-post'),
|
||||||
true
|
true
|
||||||
),
|
),
|
||||||
|
array(
|
||||||
|
array(
|
||||||
|
array('from', (object)array('other-post' => 'post')),
|
||||||
|
array('in', 2),
|
||||||
|
array('first')
|
||||||
|
),
|
||||||
|
array('get_first_post', array(2,3,4), (object)array('other-post' => 'post')),
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -168,6 +176,9 @@ class ComicPressTagBuilderTest extends PHPUnit_Framework_TestCase {
|
|||||||
array(array('bad')),
|
array(array('bad')),
|
||||||
array(array(array('in', 1), 'bad')),
|
array(array(array('in', 1), 'bad')),
|
||||||
array(array(array('in', 1), 'date')),
|
array(array(array('in', 1), 'date')),
|
||||||
|
array(array(array('from', 'test'))),
|
||||||
|
array(array(array('in'))),
|
||||||
|
array(array(array('from'))),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user