public function testSet() { try { Server::node(); $this->assertEquals(false, true); } catch (\RuntimeException $e) { $this->assertEquals(true, true); } Server::node("web1.exsample.com"); Server::node("web2.exsample.com"); }
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); }
public function testDefault() { $application = new Application($this->container); $application->setAutoExit(false); $application->add(new RolesCommand()); $command = $application->find("roles"); Server::node("web1.example.com", "web"); Server::node("web2.example.com", "web"); Server::node("db1.example.com", "db"); $commandTester = new CommandTester($command); $commandTester->execute(array("command" => $command->getName())); $expected = <<<EOL +------+------------------------------------+ | name | nodes | +------+------------------------------------+ | web | web1.example.com, web2.example.com | | db | db1.example.com | +------+------------------------------------+ EOL; $this->assertEquals($expected, $commandTester->getDisplay(true)); }
public function testDetailOutput() { $application = new Application($this->container); $application->setAutoExit(false); $application->add(new NodesCommand()); $command = $application->find("nodes"); Server::node("web1.example.com"); Server::node("web2.example.com"); Server::node("web3.example.com"); $commandTester = new CommandTester($command); $commandTester->execute(array("command" => $command->getName(), "--detail" => true)); $expected = <<<EOL +------------------+------+------+----------+-----+-------+ | name | host | port | username | key | roles | +------------------+------+------+----------+-----+-------+ | web1.example.com | | | | | | | web2.example.com | | | | | | | web3.example.com | | | | | | +------------------+------+------+----------+-----+-------+ EOL; $this->assertEquals($expected, $commandTester->getDisplay(true)); }