mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-09-08 12:32:42 +00:00
Allow sub-directories for Fixture folder
Allow sub-directories for Test/Fixture folder (for app. and plugin.) The directory separator is '/'. A file ``MyClassFixture.php` in the folder `Fixture/MyFolder` will be included like this : `'app.MyFolder/my_class'`
This commit is contained in:
parent
aa0f1c1862
commit
316fd50443
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…
Add table
Add a link
Reference in a new issue