beef up tests

This commit is contained in:
John Bintz 2010-02-04 22:21:36 -05:00
parent 23c145c262
commit e678291d40
1 changed files with 13 additions and 4 deletions

View File

@ -219,6 +219,7 @@ class ComicPressTagBuilderTest extends PHPUnit_Framework_TestCase {
array(array(array('from', 'test'))), array(array(array('from', 'test'))),
array(array(array('in'))), array(array(array('in'))),
array(array(array('from'))), array(array(array('from'))),
array(array(array('current')))
); );
} }
@ -448,9 +449,10 @@ class ComicPressTagBuilderTest extends PHPUnit_Framework_TestCase {
array( array(
array( array(
array('category', 2), array('category', 2),
array('children', true) array('children')
), ),
array(2, 3, 4) array(2, 3, 4),
true
), ),
); );
} }
@ -458,7 +460,7 @@ class ComicPressTagBuilderTest extends PHPUnit_Framework_TestCase {
/** /**
* @dataProvider providerTestCategoryTraversal * @dataProvider providerTestCategoryTraversal
*/ */
function testCategoryTraversal($methods, $expected_result) { function testCategoryTraversal($methods, $expected_result, $compare_ids = false) {
global $post; global $post;
$storyline = new ComicPressStoryline(); $storyline = new ComicPressStoryline();
@ -492,8 +494,15 @@ class ComicPressTagBuilderTest extends PHPUnit_Framework_TestCase {
if (is_object($core)) { if (is_object($core)) {
$this->assertEquals($expected_result, $core->cat_ID); $this->assertEquals($expected_result, $core->cat_ID);
} else {
if (is_array($core) && $compare_ids) {
foreach ($expected_result as $id) {
$cat = array_shift($core);
$this->assertEquals($id, $cat->cat_ID);
}
} else { } else {
$this->assertEquals($expected_result, $core); $this->assertEquals($expected_result, $core);
} }
} }
}
} }