@@ -3615,6 +3615,8 @@ function testBuildColumn() {
3615
3615
'default ' => '' ,
3616
3616
'null ' => false ,
3617
3617
);
3618
+ $ restore = $ this ->testDb ->columns ;
3619
+
3618
3620
$ this ->testDb ->columns = array ('integer ' => array ('name ' => 'int ' , 'limit ' => '11 ' , 'formatter ' => 'intval ' ), );
3619
3621
$ result = $ this ->testDb ->buildColumn ($ data );
3620
3622
$ expected = '`int_field` int(11) NOT NULL ' ;
@@ -3649,6 +3651,47 @@ function testBuildColumn() {
3649
3651
$ result = $ this ->testDb ->buildColumn ($ data );
3650
3652
$ expected = '`int_field` int(11) COLLATE GOOD NOT NULL ' ;
3651
3653
$ this ->assertEqual ($ result , $ expected );
3654
+
3655
+ $ this ->testDb ->columns = $ restore ;
3656
+
3657
+ $ data = array (
3658
+ 'name ' => 'created ' ,
3659
+ 'type ' => 'timestamp ' ,
3660
+ 'default ' => 'current_timestamp ' ,
3661
+ 'null ' => false ,
3662
+ );
3663
+ $ result = $ this ->db ->buildColumn ($ data );
3664
+ $ expected = '`created` timestamp DEFAULT CURRENT_TIMESTAMP NOT NULL ' ;
3665
+ $ this ->assertEqual ($ result , $ expected );
3666
+
3667
+ $ data = array (
3668
+ 'name ' => 'created ' ,
3669
+ 'type ' => 'timestamp ' ,
3670
+ 'default ' => 'CURRENT_TIMESTAMP ' ,
3671
+ 'null ' => true ,
3672
+ );
3673
+ $ result = $ this ->db ->buildColumn ($ data );
3674
+ $ expected = '`created` timestamp DEFAULT CURRENT_TIMESTAMP ' ;
3675
+ $ this ->assertEqual ($ result , $ expected );
3676
+
3677
+ $ data = array (
3678
+ 'name ' => 'modified ' ,
3679
+ 'type ' => 'timestamp ' ,
3680
+ 'null ' => true ,
3681
+ );
3682
+ $ result = $ this ->db ->buildColumn ($ data );
3683
+ $ expected = '`modified` timestamp NULL ' ;
3684
+ $ this ->assertEqual ($ result , $ expected );
3685
+
3686
+ $ data = array (
3687
+ 'name ' => 'modified ' ,
3688
+ 'type ' => 'timestamp ' ,
3689
+ 'default ' => null ,
3690
+ 'null ' => true ,
3691
+ );
3692
+ $ result = $ this ->db ->buildColumn ($ data );
3693
+ $ expected = '`modified` timestamp NULL ' ;
3694
+ $ this ->assertEqual ($ result , $ expected );
3652
3695
}
3653
3696
3654
3697
/**
0 commit comments