From a2e13853ab381b056c72128764adfea34408275d Mon Sep 17 00:00:00 2001 From: John Bintz Date: Sun, 24 Jan 2010 10:51:10 -0500 Subject: [PATCH] undo amother merge --- classes/ComicPressMediaHandling.inc | 3 - comicpress-options.php | 24 --- functions.php | 3 +- options/configoptions.php | 76 +--------- options/options.css | 17 --- test/ComicPressMediaHandlingTest.php | 14 +- test/ComicPressOptionsAdminTest.php | 43 ------ test/ComicPressRelatedPostsTest.php | 3 +- test/selenium/TestComicFilenameFilters.html | 154 -------------------- 9 files changed, 9 insertions(+), 328 deletions(-) delete mode 100644 test/ComicPressOptionsAdminTest.php delete mode 100644 test/selenium/TestComicFilenameFilters.html diff --git a/classes/ComicPressMediaHandling.inc b/classes/ComicPressMediaHandling.inc index 225246b..7d9a1e5 100644 --- a/classes/ComicPressMediaHandling.inc +++ b/classes/ComicPressMediaHandling.inc @@ -98,9 +98,6 @@ class ComicPressMediaHandling { case 'type-folder': $value = $this->type_folder; break; - case 'upload-path': - $value = get_option('upload_path'); - break; default: if (preg_match('#^date-(.*)$#', $matches[1], $date_matches) > 0) { if (isset($this->post_to_use)) { diff --git a/comicpress-options.php b/comicpress-options.php index 6f7116d..3e89ecb 100644 --- a/comicpress-options.php +++ b/comicpress-options.php @@ -19,23 +19,6 @@ function comicpress_admin_print_styles() { wp_enqueue_style('comicpress-options', get_template_directory_uri() . '/options/options.css'); } -function comicpress_save_options_comic_filename_filters($incoming) { - $filters = array(); - - foreach (array_values($incoming) as $filter) { - $filters[wp_filter_nohtml_kses($filter['name'])] = wp_filter_nohtml_kses($filter['filter']); - } - - if (!empty($filters)) { - if (!isset($filters['default'])) { - $cpmh = new ComicPressMediaHandling(); - $filters['default'] = $cpmh->default_filter; - } - } - - return $filters; -} - function comicpress_admin_page_head() { ?> false, 'enable_scroll_to_top' => false, - 'enable_page_load_info' => false, - 'comic_filename_filters' => array() + 'enable_page_load_info' => false ) as $field => $value) { $comicpress_options[$field] = $value; diff --git a/options/configoptions.php b/options/configoptions.php index 8a1ab90..dc24c9d 100644 --- a/options/configoptions.php +++ b/options/configoptions.php @@ -112,7 +112,7 @@ - + @@ -135,7 +135,7 @@ - + @@ -147,86 +147,18 @@ - + - + - default_filter; - } - ?> - - - -

- For advanced users. Specify the filters used to find the filename. -

-
-
- - -

- Available parameters: -

- - - diff --git a/options/options.css b/options/options.css index 11c8287..f7621fa 100644 --- a/options/options.css +++ b/options/options.css @@ -221,20 +221,3 @@ div.show .cpadmin-footer img{ min-width: 80px; text-align: center; } - -/** Comic Filters **/ - -#comicpress-comic-filename-filters-holder div { - border: solid #ddd 1px; - padding: 3px; - overflow: hidden; -} - -#comicpress-comic-filename-filters-holder label { - float: left; - display: inline; -} - -#comicpress-comic-filename-filters-holder input { - margin: 0 10px; -} diff --git a/test/ComicPressMediaHandlingTest.php b/test/ComicPressMediaHandlingTest.php index d79578a..899d550 100644 --- a/test/ComicPressMediaHandlingTest.php +++ b/test/ComicPressMediaHandlingTest.php @@ -41,8 +41,7 @@ class ComicPressMediaHandlingTest extends PHPUnit_Framework_TestCase { array(null, $default), array('fail', $default), array(array(), $default), - array('test', 'test'), - array('test-from-option', 'test-from-option'), + array('test', 'test') ); } @@ -54,12 +53,6 @@ class ComicPressMediaHandlingTest extends PHPUnit_Framework_TestCase { $comic_filename_filters['test'] = 'test'; - update_option('comicpress_options', array( - 'comic_filename_filters' => array( - 'test-from-option' => 'test-from-option' - ) - )); - $default = str_replace('{date}', $this->cpmh->default_filename_filter, $this->cpmh->default_filter); $cpmh = $this->getMock('ComicPressMediaHandling', array('_convert_to_percent_filter')); @@ -102,8 +95,7 @@ class ComicPressMediaHandlingTest extends PHPUnit_Framework_TestCase { array('%test test%', '%test test%'), array('%wordpress%/%type-folder%', vfsStream::url('root') . '/comic'), array('%date-Y%', '2009'), - array('%wordpress%/%type-folder%/%date-Y-m-d%*.*', vfsStream::url('root') . '/comic/2009-01-01.*\..*'), - array('%wordpress%/%upload-path%/%type-folder%/%date-Y-m-d%*.*', vfsStream::url('root') . '/1/files/comic/2009-01-01.*\..*') + array('%wordpress%/%type-folder%/%date-Y-m-d%*.*', vfsStream::url('root') . '/comic/2009-01-01.*\..*') ); } @@ -114,8 +106,6 @@ class ComicPressMediaHandlingTest extends PHPUnit_Framework_TestCase { $cpmh = $this->getMock('ComicPressMediaHandling', array('_abspath')); $cpmh->expects($this->any())->method('_abspath')->will($this->returnValue(vfsStream::url('root'))); - update_option('upload_path', '1/files'); - $this->assertEquals($expected_result, $cpmh->_expand_filter($filter, 'comic', (object)array('ID' => 1, 'post_date' => '2009-01-01 15:00:00'))); } diff --git a/test/ComicPressOptionsAdminTest.php b/test/ComicPressOptionsAdminTest.php deleted file mode 100644 index aa363b7..0000000 --- a/test/ComicPressOptionsAdminTest.php +++ /dev/null @@ -1,43 +0,0 @@ - array( - 'name' => 'test', 'filter' => 'myfilter' - )), - array( - 'default' => $cpmh->default_filter, - 'test' => 'myfilter' - ) - ), - array( - array(1 => array( - 'name' => 'default', 'filter' => 'test' - )), - array( - 'default' => 'test' - ) - ) - ); - } - - /** - * @dataProvider providerTestSaveComicFilenameFilters - */ - function testSaveComicFilenameFilters($incoming, $expected) { - $this->assertEquals($expected, comicpress_save_options_comic_filename_filters($incoming)); - } -} diff --git a/test/ComicPressRelatedPostsTest.php b/test/ComicPressRelatedPostsTest.php index e739117..9291b85 100644 --- a/test/ComicPressRelatedPostsTest.php +++ b/test/ComicPressRelatedPostsTest.php @@ -11,6 +11,7 @@ class ComicPressRelatedPostsTest extends PHPUnit_Framework_TestCase { } function testBuildPostTable() { + $this->markTestIncomplete(); $posts = array( (object)array('ID' => 1, 'post_date' => '2009-01-01', 'post_title' => 'Post 1', 'guid' => 'post-1'), (object)array('ID' => 2, 'post_date' => '2009-01-02', 'post_title' => 'Post 2', 'guid' => 'post-2'), @@ -31,7 +32,7 @@ class ComicPressRelatedPostsTest extends PHPUnit_Framework_TestCase { wp_set_post_categories($id, $cats); } - $output = ''; + $output = ''; $this->rp->related_categories = array(2); diff --git a/test/selenium/TestComicFilenameFilters.html b/test/selenium/TestComicFilenameFilters.html deleted file mode 100644 index 74b3686..0000000 --- a/test/selenium/TestComicFilenameFilters.html +++ /dev/null @@ -1,154 +0,0 @@ - - - - - - -TestComicFilenameFilters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
TestComicFilenameFilters
clickAndWaitlink=ComicPress Options
click//div[@id='comicpress-tab-config']/span
storeXpathCount//div[@id="comicpress-comic-filename-filters-holder"]/divfilter_count
while${filter_count} > 0
click//div[@id='comicpress-comic-filename-filters-holder']/div[1]/a
assertConfirmationAre you sure?
storeXpathCount//div[@id="comicpress-comic-filename-filters-holder"]/divfilter_count
endWhile
clickAndWaitcomicpress_save_config
storeXpathCount//div[@id="comicpress-comic-filename-filters-holder"]/divfilter_count
echo${filter_count}
clickadd-new-filter
storeXpathCount//div[@id="comicpress-comic-filename-filters-holder"]/divnew_filter_count
assertEval(${new_filter_count}) == (${filter_count} + 1)true
clickAndWaitcomicpress_save_config
assertTextPresentComicPress Settings SAVED!
storeXpathCount//div[@id="comicpress-comic-filename-filters-holder"]/divnew_filter_count
assertEval(${new_filter_count}) == (${filter_count} + 1)true
click//div[@id='comicpress-comic-filename-filters-holder']/div[2]/a
assertConfirmationAre you sure?
storeXpathCount//div[@id="comicpress-comic-filename-filters-holder"]/divnew_filter_count
assertEval(${new_filter_count}) == (${filter_count})true
clickAndWaitcomicpress_save_config
assertTextPresentComicPress Settings SAVED!
storeXpathCount//div[@id="comicpress-comic-filename-filters-holder"]/divnew_filter_count
assertEval(${new_filter_count}) == (${filter_count})true
assertTextPresentComicPress Settings SAVED!
- -