diff --git a/modules/system/classes/PluginManager.php b/modules/system/classes/PluginManager.php index 3ba7a892c..62108ccaf 100644 --- a/modules/system/classes/PluginManager.php +++ b/modules/system/classes/PluginManager.php @@ -66,13 +66,23 @@ class PluginManager */ protected function init() { - $this->app = App::make('app'); + $this->bindSoftDependencies(); $this->metaFile = storage_path() . '/cms/disabled.json'; $this->loadDisabled(); $this->loadPlugins(); $this->loadDependencies(); } + /** + * These objects are "soft singletons" and may be lost when + * the IoC container reboots. This provides a way to rebuild + * for the purposes of unit testing. + */ + public function bindSoftDependencies() + { + $this->app = App::make('app'); + } + /** * Finds all available plugins and loads them in to the $plugins array. * @return array diff --git a/modules/system/classes/UpdateManager.php b/modules/system/classes/UpdateManager.php index 6f94d6b56..5871435c6 100644 --- a/modules/system/classes/UpdateManager.php +++ b/modules/system/classes/UpdateManager.php @@ -75,11 +75,10 @@ class UpdateManager { $this->pluginManager = PluginManager::instance(); $this->versionManager = VersionManager::instance(); - $this->migrator = App::make('migrator'); - $this->repository = App::make('migration.repository'); $this->tempDirectory = temp_path(); $this->baseDirectory = base_path(); $this->disableCoreUpdates = Config::get('cms.disableCoreUpdates', false); + $this->bindSoftDependencies(); /* * Ensure temp directory exists @@ -89,6 +88,12 @@ class UpdateManager } } + public function bindSoftDependencies() + { + $this->migrator = App::make('migrator'); + $this->repository = App::make('migration.repository'); + } + /** * Creates the migration table and updates * @return self