more code coverage
This commit is contained in:
parent
3bec106b8a
commit
229773a040
|
@ -162,18 +162,23 @@ class ComicPress {
|
||||||
}
|
}
|
||||||
|
|
||||||
function normalize_active_backends() {
|
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();
|
$available_backends = array();
|
||||||
foreach ($this->_get_declared_classes() as $class) {
|
foreach ($this->_get_declared_classes() as $class) {
|
||||||
if (preg_match('#^ComicPressBackend(.*)Factory$#', $class, $matches) > 0) {
|
if (preg_match('#^ComicPressBackend(.*)Factory$#', $class, $matches) > 0) {
|
||||||
$available_backends[] = $class;
|
$available_backends[] = $class;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return $available_backends;
|
||||||
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']);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// @codeCoverageIgnoreStart
|
// @codeCoverageIgnoreStart
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
|
|
||||||
<h3><?php _e('Active Components', 'comicpress') ?></h3>
|
<h3><?php _e('Active Components', 'comicpress') ?></h3>
|
||||||
<div id="comicpress-active-components-holder" class="comicpress-holder">
|
<div id="comicpress-active-components-holder" class="comicpress-holder">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php do_action('comicpress-options-admin') ?>
|
<?php do_action('comicpress-options-admin') ?>
|
||||||
|
|
|
@ -349,6 +349,9 @@ class ComicPressTest extends PHPUnit_Framework_TestCase {
|
||||||
array(
|
array(
|
||||||
array('ComicPressBackendURLFactory'), array('ComicPressBackendURLFactory'), array('ComicPressBackendURLFactory')
|
array('ComicPressBackendURLFactory'), array('ComicPressBackendURLFactory'), array('ComicPressBackendURLFactory')
|
||||||
),
|
),
|
||||||
|
array(
|
||||||
|
array(), false, array()
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue