Exemple #1
0
 /**
  */
 public function testRenameTable()
 {
     try {
         $this->object->renameTable('', '');
         $this->fail('renameTable does not accept empty string for original table name!');
     } catch (Phigrate_Exception_Argument $ex) {
         $msg = 'Missing original table name parameter';
         $this->assertEquals($msg, $ex->getMessage());
     }
     try {
         $this->object->renameTable('users', '');
         $this->fail('renameTable does not accept empty string for new table name!');
     } catch (Phigrate_Exception_Argument $ex) {
         $msg = 'Missing new table name parameter';
         $this->assertEquals($msg, $ex->getMessage());
     }
     $sql = 'CREATE TABLE `users` (name varchar(20));';
     $this->object->executeDdl($sql);
     $actual = $this->object->renameTable('users', 'contacts');
     $this->assertTrue($actual);
     $this->assertFalse($this->object->tableExists('users', true));
     $this->assertTrue($this->object->tableExists('contacts'));
     $this->object->dropTable('contacts');
 }