remove cascade search, supplanted by find file

This commit is contained in:
John Bintz 2009-11-07 17:00:39 -05:00
parent f38823df7b
commit bd1c206ba4
2 changed files with 0 additions and 48 deletions

View File

@ -108,23 +108,6 @@ class ComicPress {
return $wp_query;
}
/**
* See if a file exists in either child or parent theme, and if it does, return the path to that file.
* @param string $path The path to find.
* @param string $force_parent If true, always find the parent.
* @return string|boolean The path to the file, or false if not found.
*/
function cascade_search($path, $force_parent = false) {
$dirs_to_search = array(get_template_directory());
if (!$force_parent) { array_unshift($dirs_to_search, get_stylesheet_directory()); }
foreach ($dirs_to_search as $dir) {
$dir = trailingslashit($dir);
if (file_exists($dir . $path)) { return $dir . $path; }
}
return false;
}
/**
* Search a path for directories named after the slugs provided.

View File

@ -14,37 +14,6 @@ class ComicPressTest extends PHPUnit_Framework_TestCase {
vfsStreamWrapper::setRoot(new vfsStreamDirectory('root'));
}
function providerTestCascadeSearch() {
$parent = vfsStream::url('root/parent/file');
$child = vfsStream::url('root/child/file');
return array(
array(array(), false, false),
array(array('child'), false, $child),
array(array('parent'), false, $parent),
array(array('child', 'parent'), false, $child),
array(array('child', 'parent'), true, $parent),
);
}
/**
* @dataProvider providerTestCascadeSearch
*/
function testCascadeSearch($create, $force_parent, $expected_result) {
mkdir(vfsStream::url('root/parent'), 0777);
mkdir(vfsStream::url('root/child'), 0777);
_set_template_directory(vfsStream::url('root/parent'));
_set_stylesheet_directory(vfsStream::url('root/child'));
foreach ($create as $type) {
file_put_contents(vfsStream::url("root/${type}/file"), 'file');
}
$result = $this->cp->cascade_search('file', $force_parent);
$this->assertTrue($result === $expected_result);
}
function providerTestCategorySearch() {
return array(
array(