wpmu handling
This commit is contained in:
parent
1f428c786a
commit
6aea00a8d0
|
@ -58,13 +58,19 @@ class ComicPressMediaHandling {
|
|||
return $result;
|
||||
}
|
||||
|
||||
function _abspath() { return ABSPATH; }
|
||||
function _abspath() {
|
||||
return ABSPATH;
|
||||
}
|
||||
|
||||
function _expand_filter_callback($matches) {
|
||||
$value = '';
|
||||
switch (strtolower($matches[1])) {
|
||||
case 'wordpress':
|
||||
if ($path = get_option('upload_path')) {
|
||||
$value = $path;
|
||||
} else {
|
||||
$value = $this->_abspath();
|
||||
}
|
||||
break;
|
||||
case 'type-folder':
|
||||
$value = $this->type_filter;
|
||||
|
|
|
@ -85,16 +85,21 @@ class ComicPressMediaHandlingTest extends PHPUnit_Framework_TestCase {
|
|||
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%/%type-folder%/%date-Y-m-d%*.*', '/wpmupath/comic/2009-01-01.*\..*', '/wpmupath'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerTestExpandFilter
|
||||
*/
|
||||
function testExpandFilter($filter, $expected_result) {
|
||||
function testExpandFilter($filter, $expected_result, $use_option_path = false) {
|
||||
$cpmh = $this->getMock('ComicPressMediaHandling', array('_abspath'));
|
||||
$cpmh->expects($this->any())->method('_abspath')->will($this->returnValue(vfsStream::url('root')));
|
||||
|
||||
if ($use_option_path !== false) {
|
||||
update_option('upload_path', $use_option_path);
|
||||
}
|
||||
|
||||
$this->assertEquals($expected_result, $cpmh->_expand_filter($filter, 'comic', (object)array('ID' => 1, 'post_date' => '2009-01-01 15:00:00')));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue