Ejemplo n.º 1
0
 /**
  * Because DBUnit does not really provide tools for working with schema, we
  * manually clean up our DB before and after each test.  We run before in
  * case the previous test run failed and we have stuff laying around still.
  * We run after because who likes seeing artifacts of old test runs hanging
  * around their DB?
  */
 private function cleanDb()
 {
     $db = $this->runner->connectDb();
     if ($db->getConnection() instanceof \wpdb) {
         // Forcing reconnect because of quirky wpdb during testing with lots of queries
         // @see http://core.trac.wordpress.org/ticket/23085
         $db->getConnection()->db_connect();
     }
     $db->query('DROP TABLE IF EXISTS dewdrop_test_dbdeploy_changelog');
     $db->query('DROP TABLE IF EXISTS dewdrop_test_plugins');
     $db->query('DROP TABLE IF EXISTS dewdrop_test_dewdrop_tests');
 }
Ejemplo n.º 2
0
 public function testConnectDb()
 {
     $runner = new \Dewdrop\Cli\Run();
     $this->assertTrue($runner->connectDb() instanceof \Dewdrop\Db\Adapter);
 }
Ejemplo n.º 3
0
 /**
  * Instantiate command with a runner and renderer.  After the command
  * sub-class runs its init() method, check to ensure the required basic
  * properties were set.
  *
  * @param Run $runner
  * @param RendererInterface $renderer
  */
 public function __construct(Run $runner, RendererInterface $renderer)
 {
     $this->runner = $runner;
     $this->renderer = $renderer;
     $this->paths = $runner->getPimple()['paths'];
     // All commands support the --help argument
     $this->addArg('help', 'Display the help message for this command', self::ARG_OPTIONAL);
     $this->init();
     if (!$this->command || !$this->description) {
         throw new Exception('You must set the name and description in your init() method.');
     }
 }