Bake\Shell\Task\TestTask::_processModel PHP Method

_processModel() protected method

Process a model recursively and pull out all the model names converting them to fixture names.
protected _processModel ( Model $subject ) : void
$subject Model A Model class to scan for associations and pull fixtures off of.
return void
    protected function _processModel($subject)
    {
        $this->_addFixture($subject->alias());
        foreach ($subject->associations()->keys() as $alias) {
            $assoc = $subject->association($alias);
            $target = $assoc->target();
            $name = $target->alias();
            $subjectClass = get_class($subject);
            if ($subjectClass !== 'Cake\\ORM\\Table' && $subjectClass === get_class($target)) {
                continue;
            }
            if (!isset($this->_fixtures[$name])) {
                $this->_processModel($target);
            }
            if ($assoc->type() === Association::MANY_TO_MANY) {
                $junction = $assoc->junction();
                if (!isset($this->_fixtures[$junction->alias()])) {
                    $this->_processModel($junction);
                }
            }
        }
    }