Esempio n. 1
0
 public function testCanConstructRequestAndGetParams()
 {
     $_SERVER['argv'] = array('foo.php', 'foo' => 'baz', 'bar');
     $_ENV["FOO_VAR"] = "bar";
     $request = new Request();
     $params = $request->getParams();
     $this->assertEquals(2, count($params));
     $this->assertEquals($params->toArray(), array('foo' => 'baz', 'bar'));
     $this->assertEquals($request->getParam('foo'), 'baz');
     $this->assertEquals($request->getScriptName(), 'foo.php');
     $this->assertEquals(1, count($request->env()));
     $this->assertEquals($request->env()->get('FOO_VAR'), 'bar');
     $this->assertEquals($request->getEnv('FOO_VAR'), 'bar');
 }
Esempio n. 2
0
 /**
  * show migration
  *
  */
 public function showAction()
 {
     $module = $this->request->getParam('module');
     if ($module) {
         $this->console->writeLine('Only for module "' . $module . '":');
     }
     try {
         $revision = $this->getManager()->getLastMigration($module);
         if ('0' == $revision['id']) {
             $this->console->writeLine('None');
         } else {
             $this->console->writeLine('Current migration is: ' . $revision['migration']);
         }
     } catch (ZFCToolException $e) {
         $this->console->writeLine($e->getMessage(), Color::RED);
     } catch (\Exception $e) {
         $this->console->writeLine($e->getMessage(), Color::RED);
     }
 }
Esempio n. 3
0
 /**
  * list dump files
  */
 public function listAction()
 {
     $module = $this->request->getParam('module');
     if ($module) {
         $this->console->writeLine('Only for module "' . $module . '":');
     }
     $includeModules = $this->request->getParam('includemodules');
     try {
         $dumps = $this->manager->getExistsDumps($module, $includeModules);
         if ($dumps) {
             //Display legend
             $this->console->writeLine("|dump\t\t\t|module", Color::GRAY);
         }
         foreach ($dumps as $module => $dump) {
             foreach ($dump as $file) {
                 $this->console->writeLine("{$file}\t{$module}", Color::GREEN, null);
             }
         }
     } catch (ZFCToolException $e) {
         $this->console->writeLine($e->getMessage(), Color::RED);
     } catch (\Exception $e) {
         $this->console->writeLine($e->getMessage(), Color::RED);
     }
 }