more code coverage
This commit is contained in:
parent
3bec106b8a
commit
229773a040
|
@ -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
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
|
||||
<h3><?php _e('Active Components', 'comicpress') ?></h3>
|
||||
<div id="comicpress-active-components-holder" class="comicpress-holder">
|
||||
|
||||
</div>
|
||||
|
||||
<?php do_action('comicpress-options-admin') ?>
|
||||
|
|
|
@ -349,6 +349,9 @@ class ComicPressTest extends PHPUnit_Framework_TestCase {
|
|||
array(
|
||||
array('ComicPressBackendURLFactory'), array('ComicPressBackendURLFactory'), array('ComicPressBackendURLFactory')
|
||||
),
|
||||
array(
|
||||
array(), false, array()
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue