/** */ public function testChangeColumn() { try { $this->object->changeColumn('', '', ''); $this->fail('changeColumn 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->changeColumn('users', '', ''); $this->fail('changeColumn does not accept empty string for column name!'); } catch (Phigrate_Exception_Argument $ex) { $msg = 'Missing column name parameter'; $this->assertEquals($msg, $ex->getMessage()); } try { $this->object->changeColumn('users', 'name', ''); $this->fail('changeColumn does not accept empty string for type!'); } catch (Phigrate_Exception_Argument $ex) { $msg = 'Missing type parameter'; $this->assertEquals($msg, $ex->getMessage()); } //create it $sql = "CREATE TABLE `users` (name varchar(20), age int(3));"; $this->object->executeDdl($sql); //verify its type $col = $this->object->columnInfo('users', 'name'); $this->assertEquals('varchar(20)', $col['type']); $this->assertEmpty($col['default']); //change it, add a default too! $this->object->changeColumn('users', 'name', 'string', array('default' => 'abc', 'limit' => 128)); $col = $this->object->columnInfo('users', 'name'); $this->assertEquals('varchar(128)', $col['type']); $this->assertEquals('abc', $col['default']); //change it, add a default too! $this->object->changeColumn('users', 'name', 'integer', array('default' => '1')); $col = $this->object->columnInfo('users', 'name'); $this->assertEquals('int(11)', $col['type']); $this->assertEquals('1', $col['default']); }