change how get attachments w/ children works

This commit is contained in:
John Bintz 2009-11-15 11:01:57 -05:00
parent ec907484bb
commit b87735e2d7
2 changed files with 6 additions and 5 deletions

View File

@ -167,10 +167,11 @@ class ComicPressComicPost {
$attachments_with_children = array(); $attachments_with_children = array();
foreach ($this->normalize_ordering($skip_checks) as $id => $info) { foreach ($this->normalize_ordering($skip_checks) as $id => $info) {
if ($info['enabled']) { if ($info['enabled']) {
$attachments_with_children[$id] = array(); $attachment = array('id' => $id);
if (isset($info['children'])) { if (isset($info['children'])) {
$attachments_with_children[$id] = $info['children']; $attachment['children'] = $info['children'];
} }
$attachments_with_children[] = $attachment;
} }
} }
return $attachments_with_children; return $attachments_with_children;

View File

@ -195,8 +195,8 @@ class ComicPressComicPostTest extends PHPUnit_Framework_TestCase {
'test-4' => array('enabled' => false), 'test-4' => array('enabled' => false),
), ),
array( array(
'test-1' => array(), array('id' => 'test-1'),
'test-2' => array() array('id' => 'test-2')
) )
), ),
array( array(
@ -205,7 +205,7 @@ class ComicPressComicPostTest extends PHPUnit_Framework_TestCase {
'test-2' => array('enabled' => false, 'children' => array('rss' => 'test-4')), 'test-2' => array('enabled' => false, 'children' => array('rss' => 'test-4')),
), ),
array( array(
'test-1' => array('rss' => 'test-3'), array('id' => 'test-1', 'children' => array('rss' => 'test-3')),
) )
), ),