コード例 #1
0
ファイル: AdapterTest.php プロジェクト: azema/phigrate
 /**
  */
 public function testRemoveColumn()
 {
     try {
         $this->object->removeColumn('', '');
         $this->fail('removeColumn does not accept empty string for table name!');
     } catch (Phigrate_Exception_Argument $ex) {
         $msg = 'Missing table name parameter';
         $this->assertEquals($msg, $ex->getMessage());
     }
     try {
         $this->object->removeColumn('users', '');
         $this->fail('removeColumn does not accept empty string for column name!');
     } catch (Phigrate_Exception_Argument $ex) {
         $msg = 'Missing column name parameter';
         $this->assertEquals($msg, $ex->getMessage());
     }
     //create it
     $sql = "CREATE TABLE `users` ( name varchar(20), age int(3) );";
     $this->object->executeDdl($sql);
     //verify it exists
     $col = $this->object->columnInfo('users', 'name');
     $this->assertEquals('name', $col['field']);
     //drop it
     $this->object->removeColumn('users', 'name');
     //verify it does not exist
     $col = $this->object->columnInfo('users', 'name');
     $this->assertEquals(null, $col);
 }