Commit 94df8b04 authored by Dustin Wheeler's avatar Dustin Wheeler

Assert column position is maintained when retrieving table column list

parent 213fad75
...@@ -199,8 +199,10 @@ class SchemaManagerFunctionalTestCase extends \Doctrine\Tests\DbalFunctionalTest ...@@ -199,8 +199,10 @@ class SchemaManagerFunctionalTestCase extends \Doctrine\Tests\DbalFunctionalTest
$this->_sm->dropAndCreateTable($table); $this->_sm->dropAndCreateTable($table);
$columns = $this->_sm->listTableColumns('list_table_columns'); $columns = $this->_sm->listTableColumns('list_table_columns');
$columns_keys = array_keys($columns);
$this->assertArrayHasKey('id', $columns); $this->assertArrayHasKey('id', $columns);
$this->assertEquals(0, array_search('id', $columns_keys));
$this->assertEquals('id', strtolower($columns['id']->getname())); $this->assertEquals('id', strtolower($columns['id']->getname()));
$this->assertInstanceOf('Doctrine\DBAL\Types\IntegerType', $columns['id']->gettype()); $this->assertInstanceOf('Doctrine\DBAL\Types\IntegerType', $columns['id']->gettype());
$this->assertEquals(false, $columns['id']->getunsigned()); $this->assertEquals(false, $columns['id']->getunsigned());
...@@ -209,6 +211,7 @@ class SchemaManagerFunctionalTestCase extends \Doctrine\Tests\DbalFunctionalTest ...@@ -209,6 +211,7 @@ class SchemaManagerFunctionalTestCase extends \Doctrine\Tests\DbalFunctionalTest
$this->assertInternalType('array', $columns['id']->getPlatformOptions()); $this->assertInternalType('array', $columns['id']->getPlatformOptions());
$this->assertArrayHasKey('test', $columns); $this->assertArrayHasKey('test', $columns);
$this->assertEquals(1, array_search('test', $columns_keys));
$this->assertEquals('test', strtolower($columns['test']->getname())); $this->assertEquals('test', strtolower($columns['test']->getname()));
$this->assertInstanceOf('Doctrine\DBAL\Types\StringType', $columns['test']->gettype()); $this->assertInstanceOf('Doctrine\DBAL\Types\StringType', $columns['test']->gettype());
$this->assertEquals(255, $columns['test']->getlength()); $this->assertEquals(255, $columns['test']->getlength());
...@@ -218,6 +221,7 @@ class SchemaManagerFunctionalTestCase extends \Doctrine\Tests\DbalFunctionalTest ...@@ -218,6 +221,7 @@ class SchemaManagerFunctionalTestCase extends \Doctrine\Tests\DbalFunctionalTest
$this->assertInternalType('array', $columns['test']->getPlatformOptions()); $this->assertInternalType('array', $columns['test']->getPlatformOptions());
$this->assertEquals('foo', strtolower($columns['foo']->getname())); $this->assertEquals('foo', strtolower($columns['foo']->getname()));
$this->assertEquals(2, array_search('foo', $columns_keys));
$this->assertInstanceOf('Doctrine\DBAL\Types\TextType', $columns['foo']->gettype()); $this->assertInstanceOf('Doctrine\DBAL\Types\TextType', $columns['foo']->gettype());
$this->assertEquals(false, $columns['foo']->getunsigned()); $this->assertEquals(false, $columns['foo']->getunsigned());
$this->assertEquals(false, $columns['foo']->getfixed()); $this->assertEquals(false, $columns['foo']->getfixed());
...@@ -226,6 +230,7 @@ class SchemaManagerFunctionalTestCase extends \Doctrine\Tests\DbalFunctionalTest ...@@ -226,6 +230,7 @@ class SchemaManagerFunctionalTestCase extends \Doctrine\Tests\DbalFunctionalTest
$this->assertInternalType('array', $columns['foo']->getPlatformOptions()); $this->assertInternalType('array', $columns['foo']->getPlatformOptions());
$this->assertEquals('bar', strtolower($columns['bar']->getname())); $this->assertEquals('bar', strtolower($columns['bar']->getname()));
$this->assertEquals(3, array_search('bar', $columns_keys));
$this->assertInstanceOf('Doctrine\DBAL\Types\DecimalType', $columns['bar']->gettype()); $this->assertInstanceOf('Doctrine\DBAL\Types\DecimalType', $columns['bar']->gettype());
$this->assertEquals(null, $columns['bar']->getlength()); $this->assertEquals(null, $columns['bar']->getlength());
$this->assertEquals(10, $columns['bar']->getprecision()); $this->assertEquals(10, $columns['bar']->getprecision());
...@@ -237,18 +242,21 @@ class SchemaManagerFunctionalTestCase extends \Doctrine\Tests\DbalFunctionalTest ...@@ -237,18 +242,21 @@ class SchemaManagerFunctionalTestCase extends \Doctrine\Tests\DbalFunctionalTest
$this->assertInternalType('array', $columns['bar']->getPlatformOptions()); $this->assertInternalType('array', $columns['bar']->getPlatformOptions());
$this->assertEquals('baz1', strtolower($columns['baz1']->getname())); $this->assertEquals('baz1', strtolower($columns['baz1']->getname()));
$this->assertEquals(4, array_search('baz1', $columns_keys));
$this->assertInstanceOf('Doctrine\DBAL\Types\DateTimeType', $columns['baz1']->gettype()); $this->assertInstanceOf('Doctrine\DBAL\Types\DateTimeType', $columns['baz1']->gettype());
$this->assertEquals(true, $columns['baz1']->getnotnull()); $this->assertEquals(true, $columns['baz1']->getnotnull());
$this->assertEquals(null, $columns['baz1']->getdefault()); $this->assertEquals(null, $columns['baz1']->getdefault());
$this->assertInternalType('array', $columns['baz1']->getPlatformOptions()); $this->assertInternalType('array', $columns['baz1']->getPlatformOptions());
$this->assertEquals('baz2', strtolower($columns['baz2']->getname())); $this->assertEquals('baz2', strtolower($columns['baz2']->getname()));
$this->assertEquals(5, array_search('baz2', $columns_keys));
$this->assertContains($columns['baz2']->gettype()->getName(), array('time', 'date', 'datetime')); $this->assertContains($columns['baz2']->gettype()->getName(), array('time', 'date', 'datetime'));
$this->assertEquals(true, $columns['baz2']->getnotnull()); $this->assertEquals(true, $columns['baz2']->getnotnull());
$this->assertEquals(null, $columns['baz2']->getdefault()); $this->assertEquals(null, $columns['baz2']->getdefault());
$this->assertInternalType('array', $columns['baz2']->getPlatformOptions()); $this->assertInternalType('array', $columns['baz2']->getPlatformOptions());
$this->assertEquals('baz3', strtolower($columns['baz3']->getname())); $this->assertEquals('baz3', strtolower($columns['baz3']->getname()));
$this->assertEquals(6, array_search('baz3', $columns_keys));
$this->assertContains($columns['baz3']->gettype()->getName(), array('time', 'date', 'datetime')); $this->assertContains($columns['baz3']->gettype()->getName(), array('time', 'date', 'datetime'));
$this->assertEquals(true, $columns['baz3']->getnotnull()); $this->assertEquals(true, $columns['baz3']->getnotnull());
$this->assertEquals(null, $columns['baz3']->getdefault()); $this->assertEquals(null, $columns['baz3']->getdefault());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment