clean up test cases a bit
This commit is contained in:
parent
84ec0b5c9e
commit
88fa4b78e7
@ -340,25 +340,25 @@ class ComicPressAddonCore extends ComicPressAddon {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle an update.
|
* Update attachment information.
|
||||||
*/
|
*/
|
||||||
function handle_update() {
|
function handle_update_attachments() {
|
||||||
if (isset($_POST['attachments'])) {
|
|
||||||
//coming from media editor
|
|
||||||
foreach ($_POST['attachments'] as $post_id => $settings) {
|
foreach ($_POST['attachments'] as $post_id => $settings) {
|
||||||
if (isset($settings['comic_image_type'])) {
|
if (isset($settings['comic_image_type'])) {
|
||||||
update_post_meta($post_id, 'comic_image_type', $settings['comic_image_type']);
|
update_post_meta($post_id, 'comic_image_type', $settings['comic_image_type']);
|
||||||
}
|
}
|
||||||
if (isset($settings['auto_attach'])) {
|
if (isset($settings['auto_attach']) && isset($settings['post_parent'])) {
|
||||||
if (isset($settings['post_parent'])) {
|
|
||||||
$media_post = get_post($post_id);
|
$media_post = get_post($post_id);
|
||||||
$media_post->post_parent = $settings['post_parent'];
|
$media_post->post_parent = $settings['post_parent'];
|
||||||
wp_update_post($media_post);
|
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) {
|
foreach ($this->comicpress->comicpress_options as $option => $value) {
|
||||||
if (isset($_POST['cp'][$option])) {
|
if (isset($_POST['cp'][$option])) {
|
||||||
switch ($option) {
|
switch ($option) {
|
||||||
@ -373,6 +373,7 @@ class ComicPressAddonCore extends ComicPressAddon {
|
|||||||
case 'comic_dimensions':
|
case 'comic_dimensions':
|
||||||
case 'rss_dimensions':
|
case 'rss_dimensions':
|
||||||
case 'archive_dimensions':
|
case 'archive_dimensions':
|
||||||
|
case 'mini_dimensions':
|
||||||
if (is_array($_POST['cp'][$option])) {
|
if (is_array($_POST['cp'][$option])) {
|
||||||
$dim_parts = array();
|
$dim_parts = array();
|
||||||
$is_valid = true;
|
$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'])) {
|
if (isset($_GET['cp']['move_direction']) && isset($_GET['cp']['category'])) {
|
||||||
$this->move_storyline_category_order($_GET['cp']['category'], $_GET['cp']['move_direction']);
|
$this->move_storyline_category_order($_GET['cp']['category'], $_GET['cp']['move_direction']);
|
||||||
|
@ -166,7 +166,7 @@ class CoreTest extends PHPUnit_Framework_TestCase {
|
|||||||
|
|
||||||
$_POST = $change;
|
$_POST = $change;
|
||||||
|
|
||||||
$this->core->handle_update();
|
$this->core->handle_update_comicpress_options();
|
||||||
|
|
||||||
foreach ($new as $key => $value) {
|
foreach ($new as $key => $value) {
|
||||||
$this->assertEquals($value, $this->core->comicpress->comicpress_options[$key]);
|
$this->assertEquals($value, $this->core->comicpress->comicpress_options[$key]);
|
||||||
|
Loading…
Reference in New Issue
Block a user