4 * This script belongs to the Extbase framework. *
6 * It is free software; you can redistribute it and/or modify it under *
7 * the terms of the GNU Lesser General Public License as published by the *
8 * Free Software Foundation, either version 3 of the License, or (at your *
9 * option) any later version. *
11 * This script is distributed in the hope that it will be useful, but *
12 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- *
13 * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser *
14 * General Public License for more details. *
16 * You should have received a copy of the GNU Lesser General Public *
17 * License along with the script. *
18 * If not, see http://www.gnu.org/licenses/lgpl.html *
20 * The TYPO3 project - inspiring people to share! *
24 * Testcase for the Utility\TypeHandling class
26 * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
27 * @deprecated since Extbase 1.4.0; will be removed in Extbase 1.6.0. Please use Tx_Extbase_Tests_Unit_Service_TypeHandlingServiceTest instead
29 class Tx_Extbase_Tests_Unit_Utility_TypeHandlingTest
extends Tx_Extbase_Tests_Unit_BaseTestCase
{
33 * @expectedException InvalidArgumentException
34 * @author Karsten Dambekalns <karsten@typo3.org>
36 public function parseTypeThrowsExceptionOnInvalidType() {
37 Tx_Extbase_Utility_TypeHandling
::parseType('something not a type');
42 * @expectedException InvalidArgumentException
43 * @author Karsten Dambekalns <karsten@typo3.org>
45 public function parseTypeThrowsExceptionOnInvalidElementTypeHint() {
46 Tx_Extbase_Utility_TypeHandling
::parseType('string<integer>');
50 * data provider for parseTypeReturnsArrayWithInformation
51 * @author Karsten Dambekalns <karsten@typo3.org>
53 public function types() {
55 array('int', array('type' => 'integer', 'elementType' => NULL
)),
56 array('string', array('type' => 'string', 'elementType' => NULL
)),
57 array('DateTime', array('type' => 'DateTime', 'elementType' => NULL
)),
58 array('Tx_Extbase_Bar', array('type' => 'Tx_Extbase_Bar', 'elementType' => NULL
)),
59 array('Tx_Extbase_Bar', array('type' => 'Tx_Extbase_Bar', 'elementType' => NULL
)),
60 array('array<integer>', array('type' => 'array', 'elementType' => 'integer')),
61 array('ArrayObject<string>', array('type' => 'ArrayObject', 'elementType' => 'string')),
62 array('SplObjectStorage<Tx_Extbase_Bar>', array('type' => 'SplObjectStorage', 'elementType' => 'Tx_Extbase_Bar')),
63 array('SplObjectStorage<Tx_Extbase_Bar>', array('type' => 'SplObjectStorage', 'elementType' => 'Tx_Extbase_Bar')),
70 * @author Karsten Dambekalns <karsten@typo3.org>
72 public function parseTypeReturnsArrayWithInformation($type, $expectedResult) {
74 Tx_Extbase_Utility_TypeHandling
::parseType($type),
80 * data provider for normalizeTypesReturnsNormalizedType
81 * @author Karsten Dambekalns <karsten@typo3.org>
83 public function normalizeTypes() {
85 array('int', 'integer'),
86 array('double', 'float'),
87 array('bool', 'boolean'),
88 array('string', 'string')
94 * @dataProvider normalizeTypes
95 * @author Karsten Dambekalns <karsten@typo3.org>
97 public function normalizeTypesReturnsNormalizedType($type, $normalized) {
98 $this->assertEquals(Tx_Extbase_Utility_TypeHandling
::normalizeType($type), $normalized);