[TASK] Add test for NULL fields when comparing SQL field definitions
[Packages/TYPO3.CMS.git] / typo3 / sysext / install / Tests / Unit / Service / SqlSchemaMigrationServiceTest.php
index ca4eb9e..61dd4e5 100644 (file)
@@ -91,6 +91,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
         */