Merge branch 'master' of git@github.com:johnbintz/comicpress-manager-1.4

This commit is contained in:
John Bintz 2009-11-25 16:50:46 -05:00
commit 36354b4f83
4 changed files with 34 additions and 2 deletions

4
.gitignore vendored
View File

@ -1 +1,5 @@
*~
.buildpath
.project
.settings/

View File

@ -30,8 +30,9 @@ function cpm_action_build_storyline_schema() {
$parts = explode("/", $field);
if (($parts[0] == "0") && (count($parts) > 1)) {
$category_id = end($parts);
$category = get_category($category_id, ARRAY_A);
$category = get_category($category_id);
if (!empty($category)) {
$category = (array)$category;
if ($category['cat_name'] != $value) {
$cpm_config->messages[] = sprintf(__('Category <strong>%1$s</strong> renamed to <strong>%2$s</strong>.', 'comicpress-manager'), $category['cat_name'], $value);
$category['cat_name'] = $value;

View File

@ -188,6 +188,8 @@ function cpm_breakdown_comic_filename($filename, $allow_override = false) {
$converted_title = ucwords(trim(preg_replace('/[\-\_]/', ' ', $title)));
$date = date($pattern, strtotime($date));
if (is_numeric($converted_title)) { $converted_title = "Title: ${converted_title}"; }
return compact('date', 'title', 'converted_title');
}
}
@ -790,4 +792,4 @@ function cpm_short_size_string_to_bytes($string) {
return $max_bytes;
}
?>
?>

View File

@ -0,0 +1,25 @@
<?php
require_once('PHPUnit/Framework.php');
require_once(dirname(__FILE__) . '/../comicpress_manager_library.php');
define('CPM_DATE_FORMAT', 'Y-m-d');
class ComicPressLibraryTest extends PHPUnit_Framework_TestCase {
function providerTestBreakdownComicFilename() {
return array(
array('2009-01-01-1.jpg', array(
'date' => '2009-01-01',
'title' => '-1',
'converted_title' => 'Title: 1'
))
);
}
/**
* @dataProvider providerTestBreakdownComicFilename
*/
function testBreakdownComicFilename($input, $expected_output) {
$this->assertEquals($expected_output, cpm_breakdown_comic_filename($input));
}
}