Set the application instance.
public static setContainer ( $container ) : void | ||
Résultat | void |
protected function setUp() { $this->container = new Container(); ModuleFacade::clearResolvedInstances(); ModuleFacade::setContainer($this->container); $module = new \Altax\Module\Server\ServerModule($this->container); $this->container->addModule(Server::getModuleName(), $module); }
public function testDefault() { ModuleFacade::clearResolvedInstances(); ModuleFacade::setContainer($this->container); try { ModuleFacade::getModuleName(); $this->assertEquals(false, true); } catch (\RuntimeException $e) { $this->assertEquals(true, true); } ModuleFacade::getContainer(); ModuleFacade::clearResolvedInstance("Task"); }
protected function setUp() { $this->container = new Container(); $this->task = new DefinedTask(); $this->task->setName("test_process_run"); $this->input = new ArgvInput(); $this->bufOutput = new BufferedOutput(); $this->runtimeTask = new RuntimeTask(null, $this->task, $this->input, $this->bufOutput); ModuleFacade::clearResolvedInstances(); ModuleFacade::setContainer($this->container); $module = new \Altax\Module\Server\ServerModule($this->container); $this->container->addModule(Server::getModuleName(), $module); $module = new \Altax\Module\Env\EnvModule($this->container); $this->container->addModule(Env::getModuleName(), $module); // Env::set('server.port', 2222); // Env::set("server.username", 'vagrant'); }
protected function setUp() { $this->container = new Container(); ModuleFacade::clearResolvedInstances(); ModuleFacade::setContainer($this->container); $this->container->addModule(\Altax\Module\Server\Facade\Server::getModuleName(), new \Altax\Module\Server\ServerModule($this->container)); $this->container->addModule(\Altax\Module\Task\Facade\Task::getModuleName(), new \Altax\Module\Task\TaskModule($this->container)); $this->container->addModule(\Altax\Module\Env\Facade\Env::getModuleName(), new \Altax\Module\Env\EnvModule($this->container)); Server::node("127.0.0.1", "test"); Server::node("localhost", "test"); Server::node("nodeIsSameNameOfRole", "nodeIsSameNameOfRole"); $this->task = new DefinedTask(); $this->task->setName("test_process_run"); $this->input = new ArgvInput(); $this->bufOutput = new BufferedOutput(); $this->runtimeTask = new RuntimeTask(null, $this->task, $this->input, $this->bufOutput); }
/** * Register Modules. */ protected function registerBaseModules() { ModuleFacade::clearResolvedInstances(); ModuleFacade::setContainer($this->container); $finder = new Finder(); $finder->directories()->depth('== 0')->in(__DIR__ . "/../Module"); foreach ($finder as $dir) { $module = $dir->getBasename(); $facadeClass = "\\Altax\\Module\\" . $module . "\\Facade\\" . $module; $implClass = "\\Altax\\Module\\" . $module . "\\" . $module . "Module"; $moduleName = $facadeClass::getModuleName(); $r = new \ReflectionClass($implClass); $instance = $r->newInstance($this->container); // register module into container $this->container->addModule($moduleName, $instance); if (!class_exists($moduleName)) { class_alias($facadeClass, $moduleName); } } }