[TASK] Add test for NULL fields when comparing SQL field definitions 38/36538/2
authorStephan Großberndt <stephan@grossberndt.de>
Sat, 31 Jan 2015 16:43:33 +0000 (17:43 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Sat, 31 Jan 2015 18:15:38 +0000 (19:15 +0100)
Resolves: #64697
Releases: master, 6.2
Change-Id: I6d08445633af54d64f9176fc7b691e318d08d897
Reviewed-on: http://review.typo3.org/36538
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/install/Tests/Unit/Service/SqlSchemaMigrationServiceTest.php

index c7444df..f06df3c 100644 (file)
@@ -94,6 +94,50 @@ class SqlSchemaMigrationServiceTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
        /**
         * @test
         */
+       public function getDatabaseExtraFindsChangedFieldsIncludingNull() {
+               $subject = new SqlSchemaMigrationService();
+               $differenceArray = $subject->getDatabaseExtra(
+                       array(
+                               'tx_foo' => array(
+                                       'fields' => array(
+                                               'foo' => 'varchar(999) NULL'
+                                       )
+                               )
+                       ),
+                       array(
+                               'tx_foo' => array(
+                                       'fields' => array(
+                                               'foo' => 'varchar(255) NULL'
+                                       )
+                               )
+                       )
+               );
+
+               $this->assertEquals(
+                       $differenceArray,
+                       array(
+                               'extra' => array(),
+                               'diff' => array(
+                                       'tx_foo' => array(
+                                               'fields' => array(
+                                                       'foo' => 'varchar(999) NULL'
+                                               )
+                                       )
+                               ),
+                               'diff_currentValues' => array(
+                                       'tx_foo' => array(
+                                               'fields' => array(
+                                                       'foo' => 'varchar(255) NULL'
+                                               )
+                                       )
+                               )
+                       )
+               );
+       }
+
+       /**
+        * @test
+        */
        public function getDatabaseExtraFindsChangedFieldsIgnoreNotNull() {
                $subject = new SqlSchemaMigrationService();
                $differenceArray = $subject->getDatabaseExtra(