[TASK] Namespace and move ModuleUtilityTest
authorFelix Kopp <felix-source@phorax.com>
Mon, 27 Aug 2012 14:08:32 +0000 (16:08 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Mon, 27 Aug 2012 15:04:14 +0000 (17:04 +0200)
Moves test for module/menu utility class to EXT: backend.
Also changes moduleMenuUtility to moduleController.

Change-Id: I258695f60335c8f2d15d597972b0cbc7a0b70083
Resolves: #40271
Related: #40095
Releases: 6.0
Reviewed-on: http://review.typo3.org/14137
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
tests/Unit/typo3/Classes/Utility/BackendModuleUtilityTest.php [deleted file]
typo3/sysext/backend/Tests/Unit/Module/ModuleControllerTest.php [new file with mode: 0644]

diff --git a/tests/Unit/typo3/Classes/Utility/BackendModuleUtilityTest.php b/tests/Unit/typo3/Classes/Utility/BackendModuleUtilityTest.php
deleted file mode 100644 (file)
index f5084ff..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-<?php
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2012 Susanne Moog <typo3@susannemoog.de>
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *  A copy is found in the textfile GPL.txt and important notices to the license
- *  from the author is found in LICENSE.txt distributed with these scripts.
- *
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-/**
- * Test class for module menu utilities
- *
- * @author Susanne Moog <typo3@susannemoog.de>
- * @package TYPO3
- * @subpackage tests
- */
-class Typo3_Utility_BackendModuleUtilityTest extends Tx_PhpUnit_TestCase {
-
-       /**
-        * @var Typo3_BackendModule_Utility
-        */
-       protected $moduleMenuUtility;
-
-       /**
-        * Helper function to call protected or private methods
-        *
-        * @param string $className The className
-        * @param string $name the name of the method to call
-        * @param mixed $argument The argument for the method call (only one in this test class needed)
-        * @return mixed
-        */
-       public function callInaccessibleMethod($className, $name, $argument) {
-               $class = new \ReflectionClass($className);
-               $object = new $className();
-               $method = $class->getMethod($name);
-               $method->setAccessible(TRUE);
-               return $method->invoke($object, $argument);
-       }
-
-       /**
-        * @test
-        */
-       public function createEntryFromRawDataGeneratesMenuEntry() {
-               $entry = $this->callInaccessibleMethod('TYPO3\\CMS\\Backend\\Module\\ModuleController', 'createEntryFromRawData', array());
-               $this->assertInstanceOf('TYPO3\\CMS\\Backend\\Domain\\Model\\Module\\BackendModule', $entry);
-       }
-
-       /**
-        * @test
-        */
-       public function createEntryFromRawDataSetsPropertiesInEntryObject() {
-               $rawModule = array(
-                       'name' => 'nameTest',
-                       'title' => 'titleTest',
-                       'onclick' => 'onclickTest',
-                       'icon' => array(
-                               'test' => '123'
-                       ),
-                       'link' => 'linkTest',
-                       'description' => 'descriptionTest',
-                       'navigationComponentId' => 'navigationComponentIdTest'
-               );
-               $entry = $this->callInaccessibleMethod('TYPO3\\CMS\\Backend\\Module\\ModuleController', 'createEntryFromRawData', $rawModule);
-               $this->assertEquals('nameTest', $entry->getName());
-               $this->assertEquals('titleTest', $entry->getTitle());
-               $this->assertEquals('linkTest', $entry->getLink());
-               $this->assertEquals('onclickTest', $entry->getOnClick());
-               $this->assertEquals('navigationComponentIdTest', $entry->getNavigationComponentId());
-               $this->assertEquals('descriptionTest', $entry->getDescription());
-               $this->assertEquals(array('test' => '123'), $entry->getIcon());
-       }
-
-       /**
-        * @test
-        */
-       public function createEntryFromRawDataSetsLinkIfPathIsGivenInEntryObject() {
-               $rawModule = array(
-                       'path' => 'pathTest'
-               );
-               $entry = $this->callInaccessibleMethod('TYPO3\\CMS\\Backend\\Module\\ModuleController', 'createEntryFromRawData', $rawModule);
-               $this->assertEquals('pathTest', $entry->getLink());
-       }
-
-}
-
-?>
\ No newline at end of file
diff --git a/typo3/sysext/backend/Tests/Unit/Module/ModuleControllerTest.php b/typo3/sysext/backend/Tests/Unit/Module/ModuleControllerTest.php
new file mode 100644 (file)
index 0000000..26bfcba
--- /dev/null
@@ -0,0 +1,105 @@
+<?php
+namespace TYPO3\CMS\Backend\Tests\Unit\Module;
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2012 Susanne Moog <typo3@susannemoog.de>
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *  A copy is found in the textfile GPL.txt and important notices to the license
+ *  from the author is found in LICENSE.txt distributed with these scripts.
+ *
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+/**
+ * Test class for module menu utilities
+ *
+ * @author Susanne Moog <typo3@susannemoog.de>
+ * @package TYPO3
+ * @subpackage backend
+ */
+class ModuleControllerTest extends \Tx_PhpUnit_TestCase {
+
+       /**
+        * @var TYPO3\CMS\Backend\Module\ModuleController
+        */
+       protected $moduleController;
+
+       /**
+        * Helper function to call protected or private methods
+        *
+        * @param string $className The className
+        * @param string $name the name of the method to call
+        * @param mixed $argument The argument for the method call (only one in this test class needed)
+        * @return mixed
+        */
+       public function callInaccessibleMethod($className, $name, $argument) {
+               $class = new \ReflectionClass($className);
+               $object = new $className();
+               $method = $class->getMethod($name);
+               $method->setAccessible(TRUE);
+               return $method->invoke($object, $argument);
+       }
+
+       /**
+        * @test
+        */
+       public function createEntryFromRawDataGeneratesMenuEntry() {
+               $entry = $this->callInaccessibleMethod('TYPO3\\CMS\\Backend\\Module\\ModuleController', 'createEntryFromRawData', array());
+               $this->assertInstanceOf('TYPO3\\CMS\\Backend\\Domain\\Model\\Module\\BackendModule', $entry);
+       }
+
+       /**
+        * @test
+        */
+       public function createEntryFromRawDataSetsPropertiesInEntryObject() {
+               $rawModule = array(
+                       'name' => 'nameTest',
+                       'title' => 'titleTest',
+                       'onclick' => 'onclickTest',
+                       'icon' => array(
+                               'test' => '123'
+                       ),
+                       'link' => 'linkTest',
+                       'description' => 'descriptionTest',
+                       'navigationComponentId' => 'navigationComponentIdTest'
+               );
+               $entry = $this->callInaccessibleMethod('TYPO3\\CMS\\Backend\\Module\\ModuleController', 'createEntryFromRawData', $rawModule);
+               $this->assertEquals('nameTest', $entry->getName());
+               $this->assertEquals('titleTest', $entry->getTitle());
+               $this->assertEquals('linkTest', $entry->getLink());
+               $this->assertEquals('onclickTest', $entry->getOnClick());
+               $this->assertEquals('navigationComponentIdTest', $entry->getNavigationComponentId());
+               $this->assertEquals('descriptionTest', $entry->getDescription());
+               $this->assertEquals(array('test' => '123'), $entry->getIcon());
+       }
+
+       /**
+        * @test
+        */
+       public function createEntryFromRawDataSetsLinkIfPathIsGivenInEntryObject() {
+               $rawModule = array(
+                       'path' => 'pathTest'
+               );
+               $entry = $this->callInaccessibleMethod('TYPO3\\CMS\\Backend\\Module\\ModuleController', 'createEntryFromRawData', $rawModule);
+               $this->assertEquals('pathTest', $entry->getLink());
+       }
+
+}
+
+?>
\ No newline at end of file