diff --git a/classes/ComicPressPostMediaHandlingMetabox.inc b/classes/ComicPressPostMediaHandlingMetabox.inc index 59d5088..7a6cabb 100644 --- a/classes/ComicPressPostMediaHandlingMetabox.inc +++ b/classes/ComicPressPostMediaHandlingMetabox.inc @@ -5,8 +5,10 @@ class ComicPressPostMediaHandlingMetabox { return array_keys(ComicPressMediaHandling::_bundle_global_variables()); } + function _verify_nonce() { return __comicpress_verify_nonce(); } + function save_post($post_id) { - if (__comicpress_verify_nonce() == 'post-media-update') { + if ($this->_verify_nonce() == 'post-media-update') { $info = $_REQUEST['cp']; $result = array(); if (isset($info['urls'])) { diff --git a/test/ComicPressPostMediaHandlingMetaboxTest.php b/test/ComicPressPostMediaHandlingMetaboxTest.php index 39c6039..0711ea9 100644 --- a/test/ComicPressPostMediaHandlingMetaboxTest.php +++ b/test/ComicPressPostMediaHandlingMetaboxTest.php @@ -7,29 +7,31 @@ require_once(dirname(__FILE__) . '/../classes/ComicPressPostMediaHandlingMetabox class ComicPressPostMediaHandlingMetaboxTest extends PHPUnit_Framework_TestCase { function setUp() { _reset_wp(); + $_REQUEST = array(); $this->pmh = new ComicPressPostMediaHandlingMetabox(); } - function providerTestPostMediaUpdate() { + function providerTestSavePost() { return array( - array(array(), ''), - array(array('post_id' => 'test'), ''), - array(array('post_id' => 1), array()), - array(array('post_id' => 1, 'urls' => false), array()), - array(array('post_id' => 1, 'urls' => array()), array()), - array(array('post_id' => 1, 'urls' => array('test' => 'test')), array()), - array(array('post_id' => 1, 'urls' => array('comic' => 'test')), array('comic' => 'test')), + array(array(), array()), + array(array('urls' => false), array()), + array(array('urls' => array()), array()), + array(array('urls' => array('test' => 'test')), array()), + array(array('urls' => array('comic' => 'test')), array('comic' => 'test')), ); } /** - * @dataProvider providerTestPostMediaUpdate + * @dataProvider providerTestSavePost */ - function testPostMediaUpdate($input, $expected_post_metadata) { - $pmh = $this->getMock('ComicPressPostMediaHandlingMetabox', array('_get_valid_types')); + function testSavePost($input, $expected_post_metadata) { + $pmh = $this->getMock('ComicPressPostMediaHandlingMetabox', array('_get_valid_types', '_verify_nonce')); + $pmh->expects($this->once())->method('_verify_nonce')->will($this->returnValue(true)); $pmh->expects($this->any())->method('_get_valid_types')->will($this->returnValue(array('comic'))); - $this->pmh->handle_post_media_update($input); + $_REQUEST = array('cp' => $input); + + $pmh->save_post(1); $this->assertEquals($expected_post_metadata, get_post_meta(1, 'backend_url_images', true)); } } diff --git a/widgets/archive-dropdown.php b/widgets/archive-dropdown.php deleted file mode 100644 index 05163c3..0000000 --- a/widgets/archive-dropdown.php +++ /dev/null @@ -1,102 +0,0 @@ -create_structure(get_option('comicpress-storyline-category-order')); - $categories = array_keys($storyline->_structure); - foreach ($categories as $id) { - $post = ComicPressDBInterface::get_instance()->get_first_comic($id); - } -} -*/ - -function comicpress_archive_dropdown() { ?> -
/>Off
- - \ No newline at end of file