Exemplo n.º 1
0
 public function testRenameColumn()
 {
     $time = time();
     $this->environment->executeMigration(new InitialMigration($time - 1), MigrationInterface::UP);
     $this->assertNotEmpty($this->adapter->fetchAll("SELECT * FROM ponies WHERE name IS NOT NULL"));
     $this->environment->executeMigration(new RenameMigration($time), MigrationInterface::UP);
     $this->assertEmpty($this->adapter->fetchAll("SELECT * FROM ponies WHERE first_name IS NULL"));
 }
Exemplo n.º 2
0
 public function testExecutingAChangeMigrationDown()
 {
     // stub adapter
     $adapterStub = $this->getMock('\\Phinx\\Db\\Adapter\\PdoAdapter', array(), array(array()));
     $adapterStub->expects($this->once())->method('migrated')->will($this->returnArgument(0));
     $this->environment->setAdapter($adapterStub);
     // migration
     $migration = $this->getMock('\\Phinx\\Migration\\AbstractMigration', array('change'), array('20130301080000'));
     $migration->expects($this->once())->method('change');
     $this->environment->executeMigration($migration, MigrationInterface::DOWN);
 }