From 93fa9500b756184f05e4cd433d33911dd3ff251b Mon Sep 17 00:00:00 2001 From: John Bintz Date: Sun, 6 Dec 2009 16:36:19 -0500 Subject: [PATCH] code coverage --- classes/ComicPressComicPost.inc | 5 ++++- test/ComicPressComicPostTest.php | 8 ++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/classes/ComicPressComicPost.inc b/classes/ComicPressComicPost.inc index 1daafd9..4d1379e 100644 --- a/classes/ComicPressComicPost.inc +++ b/classes/ComicPressComicPost.inc @@ -21,7 +21,10 @@ class ComicPressComicPost { if (is_object($backend)) { $a = $backend; } - $attachments = array_merge($attachments, $a->generate_from_post($this->post)); + $result = $a->generate_from_post($this->post); + if (is_array($result)) { + $attachments = array_merge($attachments, $result); + } } return $attachments; } diff --git a/test/ComicPressComicPostTest.php b/test/ComicPressComicPostTest.php index 6b9a10b..1a26858 100644 --- a/test/ComicPressComicPostTest.php +++ b/test/ComicPressComicPostTest.php @@ -232,6 +232,14 @@ class ComicPressComicPostTest extends PHPUnit_Framework_TestCase { $this->assertEquals($expected_result, $p->get_attachments_with_children()); } + + + function testGetAttachmentsStringProvided() { + $cp = ComicPress::get_instance(true); + $m = $this->getMock('TestFactory', array('generate_from_post')); + $cp->backends = array(get_class($m)); + $this->p->get_attachments(); + } } ?>