Fix FS#135
This commit is contained in:
parent
92fd202c1d
commit
d2532dbf70
|
@ -188,6 +188,8 @@ function cpm_breakdown_comic_filename($filename, $allow_override = false) {
|
||||||
$converted_title = ucwords(trim(preg_replace('/[\-\_]/', ' ', $title)));
|
$converted_title = ucwords(trim(preg_replace('/[\-\_]/', ' ', $title)));
|
||||||
$date = date($pattern, strtotime($date));
|
$date = date($pattern, strtotime($date));
|
||||||
|
|
||||||
|
if (is_numeric($converted_title)) { $converted_title = "Title: ${converted_title}"; }
|
||||||
|
|
||||||
return compact('date', 'title', 'converted_title');
|
return compact('date', 'title', 'converted_title');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -326,7 +328,7 @@ function cpm_read_comics_folder() {
|
||||||
|
|
||||||
if ($glob_results === false) {
|
if ($glob_results === false) {
|
||||||
//$cpm_config->messages[] = "FYI: glob({$cpm_config->path}/*) returned false. This can happen on some PHP installations if you have no files in your comic directory. This message will disappear once you upload a comic to your site.";
|
//$cpm_config->messages[] = "FYI: glob({$cpm_config->path}/*) returned false. This can happen on some PHP installations if you have no files in your comic directory. This message will disappear once you upload a comic to your site.";
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
$filtered_glob_results = array();
|
$filtered_glob_results = array();
|
||||||
|
@ -789,4 +791,4 @@ function cpm_short_size_string_to_bytes($string) {
|
||||||
return $max_bytes;
|
return $max_bytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -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));
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue