[TASK] Increase code coverage of Service/TypeHandlingService
authorAlexander Schnitzler <alex.schnitzler@typovision.de>
Thu, 17 Jan 2013 17:07:27 +0000 (18:07 +0100)
committerAlexander Schnitzler <typo3@alexanderschnitzler.de>
Fri, 18 Jan 2013 12:22:52 +0000 (13:22 +0100)
Added one missing tests to achieve 100% code coverage.
Also adjusted the copyright header.

Releases: 6.1
Resolves: #44612
Change-Id: If543b055c139d63edcb8960e7e0f89875017bdf3
Reviewed-on: https://review.typo3.org/17581
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
Reviewed-by: Alexander Schnitzler
Tested-by: Alexander Schnitzler
typo3/sysext/extbase/Tests/Unit/Service/TypeHandlingServiceTest.php

index 44a9280..d096465 100644 (file)
@@ -4,7 +4,8 @@ namespace TYPO3\CMS\Extbase\Tests\Unit\Service;
 /***************************************************************
  *  Copyright notice
  *
- *  (c) 2011 Extbase Team
+ *  (c) 2010-2012 Extbase Team (http://forge.typo3.org/projects/typo3v4-mvc)
+ *  Extbase is a backport of TYPO3 Flow. All credits go to the TYPO3 Flow team.
  *  All rights reserved
  *
  *  This script is part of the TYPO3 project. The TYPO3 project is
@@ -15,6 +16,9 @@ namespace TYPO3\CMS\Extbase\Tests\Unit\Service;
  *
  *  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
@@ -169,6 +173,36 @@ class TypeHandlingServiceTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase
        public function isLiteralReturnsTrueForLiteralType($type) {
                $this->assertTrue($this->typeHandlingService->isLiteral($type));
        }
+
+       /**
+        * data provider for isSimpleTypeReturnsTrueForSimpleTypes
+        *
+        * @author Alexander Schnitzler <alex.schnitzler@typovision.de>
+        * @return array
+        */
+       public function simpleTypes() {
+               return array(
+                       array('integer', TRUE),
+                       array('int', TRUE),
+                       array('float', TRUE),
+                       array('double', TRUE),
+                       array('boolean', TRUE),
+                       array('bool', TRUE),
+                       array('string', TRUE),
+                       array('DateTime', FALSE),
+               );
+       }
+
+       /**
+        * @test
+        * @dataProvider simpleTypes
+        * @author Alexander Schnitzler <alex.schnitzler@typovision.de>
+        * @param string $type
+        * @param boolean $result
+        */
+       public function isSimpleTypeReturnsOnlyTrueForSimpleTypes($type, $result) {
+               $this->assertSame($result, $this->typeHandlingService->isSimpleType($type));
+       }
 }
 
 ?>
\ No newline at end of file