clean up test cases a bit

This commit is contained in:
John Bintz 2009-07-21 13:40:24 -04:00
parent 84ec0b5c9e
commit 88fa4b78e7
3 changed files with 80 additions and 67 deletions

View File

@ -340,25 +340,25 @@ class ComicPressAddonCore extends ComicPressAddon {
}
/**
* Handle an update.
* Update attachment information.
*/
function handle_update() {
if (isset($_POST['attachments'])) {
//coming from media editor
function handle_update_attachments() {
foreach ($_POST['attachments'] as $post_id => $settings) {
if (isset($settings['comic_image_type'])) {
update_post_meta($post_id, 'comic_image_type', $settings['comic_image_type']);
}
if (isset($settings['auto_attach'])) {
if (isset($settings['post_parent'])) {
if (isset($settings['auto_attach']) && isset($settings['post_parent'])) {
$media_post = get_post($post_id);
$media_post->post_parent = $settings['post_parent'];
wp_update_post($media_post);
}
}
}
} else {
//coming from us
/**
* Update ComicPress options.
*/
function handle_update_comicpress_options() {
foreach ($this->comicpress->comicpress_options as $option => $value) {
if (isset($_POST['cp'][$option])) {
switch ($option) {
@ -373,6 +373,7 @@ class ComicPressAddonCore extends ComicPressAddon {
case 'comic_dimensions':
case 'rss_dimensions':
case 'archive_dimensions':
case 'mini_dimensions':
if (is_array($_POST['cp'][$option])) {
$dim_parts = array();
$is_valid = true;
@ -404,6 +405,18 @@ class ComicPressAddonCore extends ComicPressAddon {
}
}
}
}
/**
* Handle an update.
*/
function handle_update() {
if (isset($_POST['attachments'])) {
//coming from media editor
$this->handle_update_attachments();
} else {
//coming from us
$this->handle_update_comicpress_options();
if (isset($_GET['cp']['move_direction']) && isset($_GET['cp']['category'])) {
$this->move_storyline_category_order($_GET['cp']['category'], $_GET['cp']['move_direction']);

View File

@ -166,7 +166,7 @@ class CoreTest extends PHPUnit_Framework_TestCase {
$_POST = $change;
$this->core->handle_update();
$this->core->handle_update_comicpress_options();
foreach ($new as $key => $value) {
$this->assertEquals($value, $this->core->comicpress->comicpress_options[$key]);