[TASK] Add missing unit tests for TcaMigration class 39/43439/4
authorAnja Leichsenring <aleichsenring@ab-softlab.de>
Sun, 20 Sep 2015 11:13:50 +0000 (13:13 +0200)
committerFrank Nägler <frank.naegler@typo3.org>
Mon, 21 Sep 2015 09:59:47 +0000 (11:59 +0200)
The method migrateIconfileRelativePathOrFilenameOnlyToExtReference()
of class TcaMigration misses unit tests.

Change-Id: I598e1729600fe184ecc3d32afbe78f91d2c2afcb
Resolves: #69978
Relates: #69754
Releases: master
Reviewed-on: http://review.typo3.org/43439
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Frank Nägler <frank.naegler@typo3.org>
Tested-by: Frank Nägler <frank.naegler@typo3.org>
typo3/sysext/core/Tests/Unit/Migrations/TcaMigrationTest.php

index 826424f..19d3d86 100644 (file)
@@ -557,4 +557,70 @@ class TcaMigrationTest extends UnitTestCase {
                $subject = new TcaMigration();
                $this->assertEquals($expected, $subject->migrate($input));
        }
-}
+
+       /**
+        * @test
+        */
+       public function migrateRewritesRelativeIconPathToExtensionReference() {
+               $input = [
+                               'aTable' => [
+                                               'ctrl' => [
+                                                               'iconfile' => '../typo3conf/ext/myExt/iconfile.gif',
+                                               ],
+                               ],
+               ];
+               $expected = [
+                               'aTable' => [
+                                               'ctrl' => [
+                                                               'iconfile' => 'EXT:myExt/iconfile.gif',
+                                               ],
+                               ],
+               ];
+               $subject = new TcaMigration();
+               $this->assertEquals($expected, $subject->migrate($input));
+       }
+
+       /**
+        * @test
+        */
+       public function migrateRewritesIconFilenameOnlyToDefaultT3skinExtensionReference() {
+               $input = [
+                               'aTable' => [
+                                               'ctrl' => [
+                                                               'iconfile' => 'iconfile.gif',
+                                               ],
+                               ],
+               ];
+               $expected = [
+                               'aTable' => [
+                                               'ctrl' => [
+                                                               'iconfile' => 'EXT:t3skin/icons/gfx/i/iconfile.gif',
+                                               ],
+                               ],
+               ];
+               $subject = new TcaMigration();
+               $this->assertEquals($expected, $subject->migrate($input));
+       }
+
+       /**
+        * @test
+        */
+       public function migrateKeepsGivenExtensionReference() {
+               $input = [
+                               'aTable' => [
+                                               'ctrl' => [
+                                                               'iconfile' => 'EXT:myExt/iconfile.gif',
+                                               ],
+                               ],
+               ];
+               $expected = [
+                               'aTable' => [
+                                               'ctrl' => [
+                                                               'iconfile' => 'EXT:myExt/iconfile.gif',
+                                               ],
+                               ],
+               ];
+               $subject = new TcaMigration();
+               $this->assertEquals($expected, $subject->migrate($input));
+       }
+}
\ No newline at end of file