Exemplo n.º 1
0
 public function testExecute()
 {
     $app = new Application();
     $app->add(new SetCommand());
     $app->add(new GetCommand());
     $setCommand = $app->find('config:set');
     $getCommand = $app->find('config:get');
     $randomColumns = array(md5(microtime(true) . rand(1024, 2048)), md5(microtime(true) . rand(1024, 2048)), md5(microtime(true) . rand(1024, 2048)));
     $randomColumnsJson = json_encode($randomColumns, true);
     $commandTester = new CommandTester($setCommand);
     $commandTester->execute(array('command' => $setCommand->getName(), 'variableName' => 'aSortCols', 'variableValue' => $randomColumnsJson));
     $commandTester = new CommandTester($getCommand);
     $commandTester->execute(array('command' => $getCommand->getName(), 'variableName' => 'aSortCols'));
     $this->assertContains('aSortCols has value ' . $randomColumnsJson, $commandTester->getDisplay());
     $commandTester = new CommandTester($setCommand);
     $commandTester->execute(array('command' => $setCommand->getName(), 'variableName' => 'bl_perfLoadAktion', 'variableValue' => false));
     $commandTester = new CommandTester($getCommand);
     $commandTester->execute(array('command' => $getCommand->getName(), 'variableName' => 'bl_perfLoadAktion'));
     $this->assertContains('bl_perfLoadAktion has value 0', $commandTester->getDisplay());
     $commandTester = new CommandTester($setCommand);
     $commandTester->execute(array('command' => $setCommand->getName(), 'variableName' => 'bl_perfLoadAktion', 'variableValue' => true));
     $commandTester = new CommandTester($getCommand);
     $commandTester->execute(array('command' => $getCommand->getName(), 'variableName' => 'bl_perfLoadAktion'));
     $this->assertContains('bl_perfLoadAktion has value 1', $commandTester->getDisplay());
     $commandTester = new CommandTester($setCommand);
     $commandTester->execute(array('command' => $setCommand->getName(), 'variableName' => 'iTopNaviCatCount', 'variableValue' => 99, '--moduleId' => 'theme:azure'));
     $commandTester = new CommandTester($getCommand);
     $commandTester->execute(array('command' => $getCommand->getName(), 'variableName' => 'iTopNaviCatCount', '--moduleId' => 'theme:azure'));
     $this->assertContains('iTopNaviCatCount has value 99', $commandTester->getDisplay());
 }
Exemplo n.º 2
0
 public function testExecute()
 {
     $app = new Application();
     $app->add(new DeactivateCommand());
     $command = $app->find('module:deactivate');
     $commandTester = new CommandTester($command);
     $commandTester->execute(array('command' => $command->getName(), 'module' => 'invoicepdf'));
     $this->assertContains('Module invoicepdf deactivated.', $commandTester->getDisplay());
 }
Exemplo n.º 3
0
 public function testExecute()
 {
     $app = new Application();
     $app->add(new QueryCommand());
     $command = $app->find('db:query');
     $commandTester = new CommandTester($command);
     $commandTester->execute(array('command' => $command->getName(), 'query' => 'SELECT * FROM oxuser'));
     $this->assertContains('oxdefaultadmin', $commandTester->getDisplay());
 }
Exemplo n.º 4
0
 public function testExecute()
 {
     $app = new Application();
     $app->add(new UpdateCommand());
     $command = $app->find('views:update');
     $commandTester = new CommandTester($command);
     $commandTester->execute(array('command' => $command->getName()));
     $this->assertContains('Views updated.', $commandTester->getDisplay());
 }
Exemplo n.º 5
0
 public function testExecute()
 {
     $app = new Application();
     $app->add(new ListCommand());
     $command = $app->find('module:list');
     $commandTester = new CommandTester($command);
     $commandTester->execute(array('command' => $command->getName()));
     $this->assertContains('invoice', $commandTester->getDisplay());
 }
Exemplo n.º 6
0
 public function testExecute()
 {
     $app = new Application();
     $app->add(new ClearCommand());
     $command = $app->find('cache:clear');
     $commandTester = new CommandTester($command);
     $commandTester->execute(array('command' => $command->getName()));
     $this->assertContains('Cache cleared.', $commandTester->getDisplay());
 }
Exemplo n.º 7
0
 public function testExecute()
 {
     $app = new Application();
     $app->add(new PasswordCommand());
     $command = $app->find('user:password');
     $commandTester = new CommandTester($command);
     $commandTester->execute(array('command' => $command->getName(), 'username' => '*****@*****.**', 'password' => 'thenewpassword'));
     $this->assertContains('New password set.', $commandTester->getDisplay());
     $commandTester->execute(array('command' => $command->getName(), 'username' => '*****@*****.**', 'password' => 'thenewpassword'));
     $this->assertContains('User does not exist.', $commandTester->getDisplay());
 }
Exemplo n.º 8
0
 public function testExecute()
 {
     $app = new Application();
     $app->add(new DumpCommand());
     $command = $app->find('db:dump');
     $commandTester = new CommandTester($command);
     $commandTester->execute(array('command' => $command->getName()));
     $this->assertContains('DROP TABLE IF EXISTS `oxacceptedterms`;', $commandTester->getDisplay());
     $this->assertContains('DROP TABLE IF EXISTS `oxaccessoire2article`;', $commandTester->getDisplay());
     $this->assertContains('DROP TABLE IF EXISTS `oxactions`;', $commandTester->getDisplay());
     $this->assertContains('DROP TABLE IF EXISTS `oxaddress`;', $commandTester->getDisplay());
     $this->assertContains('DROP TABLE IF EXISTS `oxarticles`;', $commandTester->getDisplay());
     $this->assertContains('DROP TABLE IF EXISTS `oxattribute`;', $commandTester->getDisplay());
     $this->assertContains('DROP TABLE IF EXISTS `oxcategories`;', $commandTester->getDisplay());
     $this->assertContains('DROP TABLE IF EXISTS `oxconfig`;', $commandTester->getDisplay());
     $this->assertContains('DROP TABLE IF EXISTS `oxorder`;', $commandTester->getDisplay());
     $this->assertContains('DROP TABLE IF EXISTS `oxorderarticles`;', $commandTester->getDisplay());
     $this->assertContains('DROP TABLE IF EXISTS `oxuser`;', $commandTester->getDisplay());
     $this->assertContains('DROP TABLE IF EXISTS `oxvendor`;', $commandTester->getDisplay());
     $path = tempnam(sys_get_temp_dir(), 'oxrun_db_import_test');
     $commandTester = new CommandTester($command);
     $commandTester->execute(array('command' => $command->getName(), '--file' => $path));
     $dump = file_get_contents($path);
     $this->assertContains('DROP TABLE IF EXISTS `oxacceptedterms`;', $dump);
     $this->assertContains('DROP TABLE IF EXISTS `oxaccessoire2article`;', $dump);
     $this->assertContains('DROP TABLE IF EXISTS `oxactions`;', $dump);
     $this->assertContains('DROP TABLE IF EXISTS `oxaddress`;', $dump);
     $this->assertContains('DROP TABLE IF EXISTS `oxarticles`;', $dump);
     $this->assertContains('DROP TABLE IF EXISTS `oxattribute`;', $dump);
     $this->assertContains('DROP TABLE IF EXISTS `oxcategories`;', $dump);
     $this->assertContains('DROP TABLE IF EXISTS `oxconfig`;', $dump);
     $this->assertContains('DROP TABLE IF EXISTS `oxorder`;', $dump);
     $this->assertContains('DROP TABLE IF EXISTS `oxorderarticles`;', $dump);
     $this->assertContains('DROP TABLE IF EXISTS `oxuser`;', $dump);
     $this->assertContains('DROP TABLE IF EXISTS `oxvendor`;', $dump);
 }
Exemplo n.º 9
0
 public function testExecute()
 {
     $path = tempnam(sys_get_temp_dir(), 'oxrun_db_import_test');
     file_put_contents($path, $this->sql);
     $app = new Application();
     $app->add(new ImportCommand());
     $command = $app->find('db:import');
     $commandTester = new CommandTester($command);
     $commandTester->execute(array('command' => $command->getName(), 'file' => $path));
     $this->assertContains("File {$path} is imported.", $commandTester->getDisplay());
     $app->add(new DumpCommand());
     $command = $app->find('db:dump');
     $commandTester = new CommandTester($command);
     $commandTester->execute(array('command' => $command->getName()));
     $this->assertContains('DROP TABLE IF EXISTS `oxrun_db_import_test`;', $commandTester->getDisplay());
     $command = $app->find('db:import');
     $commandTester = new CommandTester($command);
     $commandTester->execute(array('command' => $command->getName(), 'file' => 'file_does_not_exist'));
     $this->assertContains("File file_does_not_exist does not exist.", $commandTester->getDisplay());
 }