Ejemplo n.º 1
1
 /**
  * setup method
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     $this->Connection = ConnectionManager::get('test');
     $connectionConfig = $this->Connection->config();
     $this->Connection->execute('DROP TABLE IF EXISTS phinxlog');
     $this->config = new Config(['paths' => ['migrations' => __FILE__], 'environments' => ['default_migration_table' => 'phinxlog', 'default_database' => 'cakephp_test', 'default' => ['adapter' => getenv('DB'), 'host' => '127.0.0.1', 'name' => !empty($connectionConfig['database']) ? $connectionConfig['database'] : '', 'user' => !empty($connectionConfig['username']) ? $connectionConfig['username'] : '', 'pass' => !empty($connectionConfig['password']) ? $connectionConfig['password'] : '']]]);
     $application = new MigrationsDispatcher('testing');
     $output = new StreamOutput(fopen('php://memory', 'a', false));
     $this->command = $application->find('mark_migrated');
     $Environment = new Environment('default', $this->config['environments']['default']);
     $Manager = $this->getMock('\\Phinx\\Migration\\Manager', [], [$this->config, $output]);
     $Manager->expects($this->any())->method('getEnvironment')->will($this->returnValue($Environment));
     $this->command->setManager($Manager);
 }