Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fix tests, add numeric type for unsigned

  • Loading branch information...
commit e35823e72a7ae04fa497ba82c7333752a6d6055c 1 parent 5a40944
imsamurai authored
View
2  lib/Cake/Model/Datasource/Database/Mysql.php
@@ -91,7 +91,7 @@ class Mysql extends DboSource {
'value' => 'UNSIGNED', 'quote' => false, 'join' => ' ', 'column' => false, 'position' => 'afterDefault',
'noVal' => true,
'options' => array(true),
- 'types' => array('integer', 'float', 'biginteger')
+ 'types' => array('integer', 'float', 'biginteger', 'numeric')
)
);
View
38 lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php
@@ -3166,14 +3166,9 @@ public function testBuildColumnBadType() {
*
* @dataProvider buildColumnUnsignedProvider
*/
- public function testBuildColumnUnsigned($data, $expected) {
- $restore = $this->Dbo->columns;
- $this->Dbo->columns = array('string' => 1, 'integer' => 1, 'float' => 1, 'biginteger' => 1, 'any' => 1);
-
+ public function testBuildColumnUnsigned($data, $expected) {//debug($this->Dbo->columns);
$result = $this->Dbo->buildColumn($data);
$this->assertEquals($expected, $result);
-
- $this->Dbo->columns = $restore;
}
/**
@@ -3188,18 +3183,20 @@ public function buildColumnUnsignedProvider() {
array(
'name' => 'testName',
'type' => 'integer',
+ 'length' => 11,
'unsigned' => true
),
- '`testName` UNSIGNED'
+ '`testName` int(11) UNSIGNED'
),
//set #1
array(
array(
'name' => 'testName',
'type' => 'biginteger',
+ 'length' => 20,
'unsigned' => true
),
- '`testName` UNSIGNED'
+ '`testName` bigint(20) UNSIGNED'
),
//set #2
array(
@@ -3208,43 +3205,54 @@ public function buildColumnUnsignedProvider() {
'type' => 'float',
'unsigned' => true
),
- '`testName` UNSIGNED'
+ '`testName` float UNSIGNED'
),
//set #3
array(
array(
'name' => 'testName',
'type' => 'string',
+ 'length' => 255,
'unsigned' => true
),
- '`testName` '
+ '`testName` varchar(255)'
),
//set #4
array(
array(
'name' => 'testName',
- 'type' => 'any',
+ 'type' => 'date',
'unsigned' => true
),
- '`testName` '
+ '`testName` date'
),
//set #5
array(
array(
'name' => 'testName',
- 'type' => 'any',
+ 'type' => 'date',
'unsigned' => false
),
- '`testName` '
+ '`testName` date'
),
//set #6
array(
array(
'name' => 'testName',
'type' => 'integer',
+ 'length' => 11,
'unsigned' => false
),
- '`testName` '
+ '`testName` int(11)'
+ ),
+ //set #7
+ array(
+ array(
+ 'name' => 'testName',
+ 'type' => 'numeric',
+ 'unsigned' => true
+ ),
+ '`testName` decimal UNSIGNED'
)
);
}
Please sign in to comment.
Something went wrong with that request. Please try again.