From 229773a040c41e2f2acde2c286a5f383e827e910 Mon Sep 17 00:00:00 2001 From: John Bintz Date: Mon, 25 Jan 2010 23:00:40 -0500 Subject: [PATCH] more code coverage --- classes/ComicPress.inc | 17 +++++++++++------ classes/partials/options-admin.inc | 1 - test/ComicPressTest.php | 3 +++ 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/classes/ComicPress.inc b/classes/ComicPress.inc index 72ac4eb..17ae07d 100644 --- a/classes/ComicPress.inc +++ b/classes/ComicPress.inc @@ -162,18 +162,23 @@ class ComicPress { } function normalize_active_backends() { + if (!is_array($this->comicpress_options['active_backends'])) { + $this->comicpress_options['active_backends'] = array(); + } + + $this->comicpress_options['active_backends'] = array_intersect($this->get_valid_backends(), $this->comicpress_options['active_backends']); + + return $this->comicpress_options['active_backends']; + } + + function get_valid_backends() { $available_backends = array(); foreach ($this->_get_declared_classes() as $class) { if (preg_match('#^ComicPressBackend(.*)Factory$#', $class, $matches) > 0) { $available_backends[] = $class; } } - - if (!is_array($this->comicpress_options['active_backends'])) { - $this->comicpress_options['active_backends'] = array(); - } - - $this->comicpress_options['active_backends'] = array_intersect($available_backends, $this->comicpress_options['active_backends']); + return $available_backends; } // @codeCoverageIgnoreStart diff --git a/classes/partials/options-admin.inc b/classes/partials/options-admin.inc index dd80b14..b4e0bf4 100644 --- a/classes/partials/options-admin.inc +++ b/classes/partials/options-admin.inc @@ -11,7 +11,6 @@

-
diff --git a/test/ComicPressTest.php b/test/ComicPressTest.php index 5f34cfb..c66f469 100644 --- a/test/ComicPressTest.php +++ b/test/ComicPressTest.php @@ -349,6 +349,9 @@ class ComicPressTest extends PHPUnit_Framework_TestCase { array( array('ComicPressBackendURLFactory'), array('ComicPressBackendURLFactory'), array('ComicPressBackendURLFactory') ), + array( + array(), false, array() + ), ); }