Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixed tests
  • Loading branch information
lorenzo committed Jul 9, 2015
1 parent e726b0d commit 7daa24e
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 3 deletions.
4 changes: 1 addition & 3 deletions src/Database/Schema/Table.php
Expand Up @@ -363,9 +363,7 @@ public function baseColumnType($column)
return null;
}

$map = Type::map($type);

if (isset($map[$type])) {
if (Type::map($type)) {
$type = Type::build($type)->getBaseType();
}
return $this->_columns[$column]['baseType'] = $type;
Expand Down
7 changes: 7 additions & 0 deletions tests/TestCase/Database/Schema/MysqlSchemaTest.php
Expand Up @@ -254,6 +254,7 @@ public function testDescribeTable()
$expected = [
'id' => [
'type' => 'biginteger',
'baseType' => null,
'null' => false,
'unsigned' => false,
'default' => null,
Expand All @@ -264,6 +265,7 @@ public function testDescribeTable()
],
'title' => [
'type' => 'string',
'baseType' => null,
'null' => true,
'default' => null,
'length' => 20,
Expand All @@ -273,6 +275,7 @@ public function testDescribeTable()
],
'body' => [
'type' => 'text',
'baseType' => null,
'null' => true,
'default' => null,
'length' => null,
Expand All @@ -281,6 +284,7 @@ public function testDescribeTable()
],
'author_id' => [
'type' => 'integer',
'baseType' => null,
'null' => false,
'unsigned' => false,
'default' => null,
Expand All @@ -291,6 +295,7 @@ public function testDescribeTable()
],
'published' => [
'type' => 'boolean',
'baseType' => null,
'null' => true,
'default' => 0,
'length' => null,
Expand All @@ -299,6 +304,7 @@ public function testDescribeTable()
],
'allow_comments' => [
'type' => 'boolean',
'baseType' => null,
'null' => true,
'default' => 0,
'length' => null,
Expand All @@ -307,6 +313,7 @@ public function testDescribeTable()
],
'created' => [
'type' => 'datetime',
'baseType' => null,
'null' => true,
'default' => null,
'length' => null,
Expand Down
7 changes: 7 additions & 0 deletions tests/TestCase/Database/Schema/PostgresSchemaTest.php
Expand Up @@ -277,6 +277,7 @@ public function testDescribeTable()
$expected = [
'id' => [
'type' => 'biginteger',
'baseType' => null,
'null' => false,
'default' => null,
'length' => 20,
Expand All @@ -287,6 +288,7 @@ public function testDescribeTable()
],
'title' => [
'type' => 'string',
'baseType' => null,
'null' => true,
'default' => null,
'length' => 20,
Expand All @@ -296,6 +298,7 @@ public function testDescribeTable()
],
'body' => [
'type' => 'text',
'baseType' => null,
'null' => true,
'default' => null,
'length' => null,
Expand All @@ -304,6 +307,7 @@ public function testDescribeTable()
],
'author_id' => [
'type' => 'integer',
'baseType' => null,
'null' => false,
'default' => null,
'length' => 10,
Expand All @@ -314,6 +318,7 @@ public function testDescribeTable()
],
'published' => [
'type' => 'boolean',
'baseType' => null,
'null' => true,
'default' => 0,
'length' => null,
Expand All @@ -322,6 +327,7 @@ public function testDescribeTable()
],
'views' => [
'type' => 'integer',
'baseType' => null,
'null' => true,
'default' => 0,
'length' => 5,
Expand All @@ -332,6 +338,7 @@ public function testDescribeTable()
],
'created' => [
'type' => 'timestamp',
'baseType' => null,
'null' => true,
'default' => null,
'length' => null,
Expand Down
6 changes: 6 additions & 0 deletions tests/TestCase/Database/Schema/SqliteSchemaTest.php
Expand Up @@ -277,6 +277,7 @@ public function testDescribeTable()
$expected = [
'id' => [
'type' => 'integer',
'baseType' => null,
'null' => false,
'default' => null,
'length' => null,
Expand All @@ -287,6 +288,7 @@ public function testDescribeTable()
],
'title' => [
'type' => 'string',
'baseType' => null,
'null' => true,
'default' => 'testing',
'length' => 20,
Expand All @@ -296,6 +298,7 @@ public function testDescribeTable()
],
'body' => [
'type' => 'text',
'baseType' => null,
'null' => true,
'default' => null,
'length' => null,
Expand All @@ -304,6 +307,7 @@ public function testDescribeTable()
],
'author_id' => [
'type' => 'integer',
'baseType' => null,
'null' => false,
'default' => null,
'length' => 11,
Expand All @@ -314,6 +318,7 @@ public function testDescribeTable()
],
'published' => [
'type' => 'boolean',
'baseType' => null,
'null' => true,
'default' => 0,
'length' => null,
Expand All @@ -322,6 +327,7 @@ public function testDescribeTable()
],
'created' => [
'type' => 'datetime',
'baseType' => null,
'null' => true,
'default' => null,
'length' => null,
Expand Down
7 changes: 7 additions & 0 deletions tests/TestCase/Database/Schema/SqlserverSchemaTest.php
Expand Up @@ -283,6 +283,7 @@ public function testDescribeTable()
$expected = [
'id' => [
'type' => 'biginteger',
'baseType' => null,
'null' => false,
'default' => null,
'length' => 19,
Expand All @@ -293,6 +294,7 @@ public function testDescribeTable()
],
'title' => [
'type' => 'string',
'baseType' => null,
'null' => true,
'default' => null,
'length' => 20,
Expand All @@ -302,6 +304,7 @@ public function testDescribeTable()
],
'body' => [
'type' => 'string',
'baseType' => null,
'null' => true,
'default' => null,
'length' => 1000,
Expand All @@ -311,6 +314,7 @@ public function testDescribeTable()
],
'author_id' => [
'type' => 'integer',
'baseType' => null,
'null' => false,
'default' => null,
'length' => 10,
Expand All @@ -321,6 +325,7 @@ public function testDescribeTable()
],
'published' => [
'type' => 'boolean',
'baseType' => null,
'null' => true,
'default' => 0,
'length' => null,
Expand All @@ -329,6 +334,7 @@ public function testDescribeTable()
],
'views' => [
'type' => 'integer',
'baseType' => null,
'null' => true,
'default' => 0,
'length' => 5,
Expand All @@ -339,6 +345,7 @@ public function testDescribeTable()
],
'created' => [
'type' => 'timestamp',
'baseType' => null,
'null' => true,
'default' => null,
'length' => null,
Expand Down
10 changes: 10 additions & 0 deletions tests/TestCase/Database/Schema/TableTest.php
Expand Up @@ -41,9 +41,19 @@ class TableTest extends TestCase

public $fixtures = ['core.articles_tags', 'core.products', 'core.orders', 'core.tags'];

protected $_map;

public function setUp()
{
$this->_map = Type::map();
parent::setUp();
}

public function tearDown()
{
TableRegistry::clear();
Type::clear();
Type::map($this->_map);
parent::tearDown();
}

Expand Down

0 comments on commit 7daa24e

Please sign in to comment.