mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
Load fixtures from a consistent location
If a test is baked for a plugin - it should by default look for fixtures in the same plugin, otherwise it creates potentially complex inter-plugin/app dependencies.
This commit is contained in:
parent
5413143178
commit
23c37efc71
1 changed files with 4 additions and 5 deletions
|
@ -403,11 +403,10 @@ class TestTask extends BakeTask {
|
|||
* @return void
|
||||
*/
|
||||
protected function _addFixture($name) {
|
||||
$parent = get_parent_class($name);
|
||||
$prefix = 'app.';
|
||||
if (strtolower($parent) != 'appmodel' && strtolower(substr($parent, -8)) == 'appmodel') {
|
||||
$pluginName = substr($parent, 0, -8);
|
||||
$prefix = 'plugin.' . Inflector::underscore($pluginName) . '.';
|
||||
if ($this->plugin) {
|
||||
$prefix = 'plugin.' . Inflector::underscore($this->plugin) . '.';
|
||||
} else {
|
||||
$prefix = 'app.';
|
||||
}
|
||||
$fixture = $prefix . Inflector::underscore($name);
|
||||
$this->_fixtures[$name] = $fixture;
|
||||
|
|
Loading…
Add table
Reference in a new issue