コード例 #1
0
ファイル: AdapterTest.php プロジェクト: azema/phigrate
 /**
  */
 public function testColumnDefinition()
 {
     $expected = '`age` varchar(255) NULL DEFAULT NULL';
     $this->assertEquals($expected, $this->object->columnDefinition('age', 'string'));
     $expected = '`age` varchar(32) NULL DEFAULT NULL';
     $this->assertEquals($expected, $this->object->columnDefinition('age', 'string', array('limit' => 32)));
     $expected = '`age` varchar(32) NOT NULL';
     $this->assertEquals($expected, $this->object->columnDefinition('age', 'string', array('limit' => 32, 'null' => false)));
     $expected = '`age` varchar(32) NOT NULL DEFAULT \'abc\'';
     $this->assertEquals($expected, $this->object->columnDefinition('age', 'string', array('limit' => 32, 'default' => 'abc', 'null' => false)));
     $expected = '`age` varchar(32) NOT NULL DEFAULT \'abc\'';
     $this->assertEquals($expected, $this->object->columnDefinition('age', 'string', array('limit' => 32, 'default' => 'abc')));
     $expected = '`age` int(11) NULL DEFAULT NULL';
     $this->assertEquals($expected, $this->object->columnDefinition('age', 'integer'));
     $expected = '`active` tinyint(1) NULL DEFAULT NULL';
     $this->assertEquals($expected, $this->object->columnDefinition('active', 'boolean'));
     $expected = '`weight` tinyint(2) NULL DEFAULT NULL';
     $this->assertEquals($expected, $this->object->columnDefinition('weight', 'tinyinteger', array('limit' => 2)));
     $expected = '`weight` smallint(8) NULL DEFAULT NULL';
     $this->assertEquals($expected, $this->object->columnDefinition('weight', 'smallinteger', array('limit' => 8)));
     $expected = '`weight` mediumint(12) NULL DEFAULT NULL';
     $this->assertEquals($expected, $this->object->columnDefinition('weight', 'mediuminteger', array('limit' => 12)));
     $expected = '`weight` bigint(20) NULL DEFAULT NULL';
     $this->assertEquals($expected, $this->object->columnDefinition('weight', 'biginteger', array('limit' => 20)));
     $expected = '`age` int(11) NULL DEFAULT NULL AFTER `height`';
     $this->assertEquals($expected, $this->object->columnDefinition('age', 'integer', array('after' => 'height')));
 }