[TASK] Re-work/simplify copyright header in PHP files - Part 9
[Packages/TYPO3.CMS.git] / typo3 / sysext / extensionmanager / Tests / Unit / Domain / Model / ExtensionTest.php
1 <?php
2 namespace TYPO3\CMS\Extensionmanager\Tests\Unit\Domain\Model;
3
4 /**
5 * This file is part of the TYPO3 CMS project.
6 *
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
10 *
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
13 *
14 * The TYPO3 project - inspiring people to share!
15 */
16
17 /**
18 * Extension test
19 */
20 class ExtensionTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
21
22 /**
23 * Data provider for getCategoryIndexFromStringOrNumberReturnsIndex
24 *
25 * @return array
26 */
27 public function getCategoryIndexFromStringOrNumberReturnsIndexDataProvider() {
28 return array(
29 'empty string' => array(
30 '',
31 4
32 ),
33 'existing category string' => array(
34 'plugin',
35 3
36 ),
37 'not existing category string' => array(
38 'foo',
39 4
40 ),
41 'string number 3' => array(
42 '3',
43 3
44 ),
45 'integer 3' => array(
46 3,
47 3
48 ),
49 'string number not in range -1' => array(
50 '-1',
51 4
52 ),
53 'integer not in range -1' => array(
54 -1,
55 4
56 ),
57 'string number not in range 11' => array(
58 '11',
59 4
60 ),
61 'integer not in range 11' => array(
62 11,
63 4
64 ),
65 'object' => array(
66 new \stdClass(),
67 4
68 ),
69 'array' => array(
70 array(),
71 4
72 ),
73 );
74 }
75
76 /**
77 * @test
78 * @dataProvider getCategoryIndexFromStringOrNumberReturnsIndexDataProvider
79 * @param string|integer $input Given input
80 * @param integer $expected Expected result
81 * @return void
82 */
83 public function getCategoryIndexFromStringOrNumberReturnsIndex($input, $expected) {
84 $extension = new \TYPO3\CMS\Extensionmanager\Domain\Model\Extension;
85 $this->assertEquals($expected, $extension->getCategoryIndexFromStringOrNumber($input));
86 }
87 }