mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Adding tests for CURRENT_TIMESTAMP to DboSource.
This commit is contained in:
parent
59319b098b
commit
5fcbc33a75
1 changed files with 43 additions and 0 deletions
|
@ -3615,6 +3615,8 @@ class DboSourceTest extends CakeTestCase {
|
|||
'default' => '',
|
||||
'null' => false,
|
||||
);
|
||||
$restore = $this->testDb->columns;
|
||||
|
||||
$this->testDb->columns = array('integer' => array('name' => 'int', 'limit' => '11', 'formatter' => 'intval'), );
|
||||
$result = $this->testDb->buildColumn($data);
|
||||
$expected = '`int_field` int(11) NOT NULL';
|
||||
|
@ -3649,6 +3651,47 @@ class DboSourceTest extends CakeTestCase {
|
|||
$result = $this->testDb->buildColumn($data);
|
||||
$expected = '`int_field` int(11) COLLATE GOOD NOT NULL';
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
$this->testDb->columns = $restore;
|
||||
|
||||
$data = array(
|
||||
'name' => 'created',
|
||||
'type' => 'timestamp',
|
||||
'default' => 'current_timestamp',
|
||||
'null' => false,
|
||||
);
|
||||
$result = $this->db->buildColumn($data);
|
||||
$expected = '`created` timestamp DEFAULT CURRENT_TIMESTAMP NOT NULL';
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
$data = array(
|
||||
'name' => 'created',
|
||||
'type' => 'timestamp',
|
||||
'default' => 'CURRENT_TIMESTAMP',
|
||||
'null' => true,
|
||||
);
|
||||
$result = $this->db->buildColumn($data);
|
||||
$expected = '`created` timestamp DEFAULT CURRENT_TIMESTAMP';
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
$data = array(
|
||||
'name' => 'modified',
|
||||
'type' => 'timestamp',
|
||||
'null' => true,
|
||||
);
|
||||
$result = $this->db->buildColumn($data);
|
||||
$expected = '`modified` timestamp NULL';
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
$data = array(
|
||||
'name' => 'modified',
|
||||
'type' => 'timestamp',
|
||||
'default' => null,
|
||||
'null' => true,
|
||||
);
|
||||
$result = $this->db->buildColumn($data);
|
||||
$expected = '`modified` timestamp NULL';
|
||||
$this->assertEqual($result, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue