mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Merge pull request #2 from Tounu/patch-3
Allow sub-directories for Fixture folder
This commit is contained in:
commit
9078f350bd
1 changed files with 18 additions and 7 deletions
|
@ -114,17 +114,28 @@ class CakeFixtureManager {
|
|||
$fixture = substr($fixture, strlen('core.'));
|
||||
$fixturePaths[] = CAKE . 'Test' . DS . 'Fixture';
|
||||
} elseif (strpos($fixture, 'app.') === 0) {
|
||||
$fixture = substr($fixture, strlen('app.'));
|
||||
$fixturePrefixLess = substr($fixture, strlen('app.'));
|
||||
$pathTokenArray = explode('/', $fixturePrefixLess);
|
||||
$fixture = array_pop($pathTokenArray);
|
||||
$additionalPath = '';
|
||||
foreach ($pathTokenArray as $pathToken) {
|
||||
$additionalPath .= DS . $pathToken;
|
||||
}
|
||||
$fixturePaths = array(
|
||||
TESTS . 'Fixture'
|
||||
TESTS . 'Fixture' . $additionalPath
|
||||
);
|
||||
} elseif (strpos($fixture, 'plugin.') === 0) {
|
||||
$parts = explode('.', $fixture, 3);
|
||||
$pluginName = $parts[1];
|
||||
$fixture = $parts[2];
|
||||
$explodedFixture = explode('.', $fixturePrefixLess,3);
|
||||
$pluginName = $explodedFixture[1];
|
||||
$pathTokenArray = explode('/', $explodedFixture[2]);
|
||||
$fixture = array_pop($pathTokenArray);
|
||||
$additionalPath = '';
|
||||
foreach ($pathTokenArray as $pathToken) {
|
||||
$additionalPath .= DS . $pathToken;
|
||||
}
|
||||
$fixturePaths = array(
|
||||
CakePlugin::path(Inflector::camelize($pluginName)) . 'Test' . DS . 'Fixture',
|
||||
TESTS . 'Fixture'
|
||||
CakePlugin::path(Inflector::camelize($pluginName)) . 'Test' . DS . 'Fixture' . $additionalPath,
|
||||
TESTS . 'Fixture' . $additionalPath
|
||||
);
|
||||
} else {
|
||||
$fixturePaths = array(
|
||||
|
|
Loading…
Reference in a new issue