fix issue with periods in directory names

This commit is contained in:
John Bintz 2009-12-02 22:40:08 -05:00
parent 91436b4b51
commit 23742b8fe2
2 changed files with 20 additions and 1 deletions

View File

@ -58,6 +58,11 @@ class ComicPressMediaHandling {
return $result;
}
function _resolve_regex_path($input) {
$input = str_replace('\.', '.', $input);
return $input;
}
// @codeCoverageIgnoreStart
function _abspath() {
return realpath(ABSPATH);
@ -85,7 +90,7 @@ class ComicPressMediaHandling {
}
function _read_directory($pattern) {
$dirname = dirname($pattern);
$dirname = $this->_resolve_regex_path(dirname($pattern));
$results = false;
if (is_dir($dirname)) {
$results = array();

View File

@ -141,6 +141,20 @@ class ComicPressMediaHandlingTest extends PHPUnit_Framework_TestCase {
$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() {
return array(
array('', '', false),