fix issue with periods in directory names
This commit is contained in:
parent
91436b4b51
commit
23742b8fe2
|
@ -58,6 +58,11 @@ class ComicPressMediaHandling {
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function _resolve_regex_path($input) {
|
||||||
|
$input = str_replace('\.', '.', $input);
|
||||||
|
return $input;
|
||||||
|
}
|
||||||
|
|
||||||
// @codeCoverageIgnoreStart
|
// @codeCoverageIgnoreStart
|
||||||
function _abspath() {
|
function _abspath() {
|
||||||
return realpath(ABSPATH);
|
return realpath(ABSPATH);
|
||||||
|
@ -85,7 +90,7 @@ class ComicPressMediaHandling {
|
||||||
}
|
}
|
||||||
|
|
||||||
function _read_directory($pattern) {
|
function _read_directory($pattern) {
|
||||||
$dirname = dirname($pattern);
|
$dirname = $this->_resolve_regex_path(dirname($pattern));
|
||||||
$results = false;
|
$results = false;
|
||||||
if (is_dir($dirname)) {
|
if (is_dir($dirname)) {
|
||||||
$results = array();
|
$results = array();
|
||||||
|
|
|
@ -141,6 +141,20 @@ class ComicPressMediaHandlingTest extends PHPUnit_Framework_TestCase {
|
||||||
$this->assertEquals($expected_results, $this->cpmh->_read_directory($pattern));
|
$this->assertEquals($expected_results, $this->cpmh->_read_directory($pattern));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function providerTestResolveRegexPath() {
|
||||||
|
return array(
|
||||||
|
array('test', 'test'),
|
||||||
|
array('te\.st', 'te.st')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dataProvider providerTestResolveRegexPath
|
||||||
|
*/
|
||||||
|
function testResolveRegexPath($input, $expected_output) {
|
||||||
|
$this->assertEquals($expected_output, $this->cpmh->_resolve_regex_path($input));
|
||||||
|
}
|
||||||
|
|
||||||
function providerTestPreHandleComicPathResults() {
|
function providerTestPreHandleComicPathResults() {
|
||||||
return array(
|
return array(
|
||||||
array('', '', false),
|
array('', '', false),
|
||||||
|
|
Loading…
Reference in New Issue