AppTestCase::solveDependancies PHP Method

solveDependancies() public method

Solves Plugin Fixture dependancies. Called in AppTestCase::__construct to solve fixture dependancies. Uses a Plugins tests/config/dependent and tests/config/fixtures to load plugin fixtures. To use this feature set $plugin = 'pluginName' in your test case.
public solveDependancies ( string $plugin ) : array
$plugin string Name of the plugin to load
return array Array of plugins that this plugin's test cases depend on.
    public function solveDependancies($plugin)
    {
        $found = false;
        $result = array($plugin);
        $add = $result;
        do {
            $changed = false;
            $copy = $add;
            $add = array();
            foreach ($copy as $pluginName) {
                $dependent = $this->loadConfig('dependent', $pluginName);
                if (!empty($dependent)) {
                    foreach ($dependent as $parentPlugin) {
                        if (!in_array($parentPlugin, $result)) {
                            $add[] = $parentPlugin;
                            $result[] = $parentPlugin;
                            $changed = true;
                        }
                    }
                }
            }
        } while ($changed);
        return $result;
    }