f03ef1815c5f95431c7854966665afc6bf220492
[Packages/TYPO3.CMS.git] / typo3 / sysext / extbase / Tests / Unit / Reflection / ReflectionServiceTest.php
1 <?php
2 namespace TYPO3\CMS\Extbase\Tests\Unit\Reflection;
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 * Test case
19 */
20 class ReflectionServiceTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
21
22 /**
23 * @param array $foo The foo parameter
24 * @return void
25 */
26 public function fixtureMethodForMethodTagsValues(array $foo) {
27 }
28
29 /**
30 * @test
31 */
32 public function hasMethod() {
33 $service = new \TYPO3\CMS\Extbase\Reflection\ReflectionService();
34 $this->assertTrue($service->hasMethod(get_class($this), 'fixtureMethodForMethodTagsValues'));
35 $this->assertFalse($service->hasMethod(get_class($this), 'notExistentMethod'));
36 }
37
38 /**
39 * @test
40 */
41 public function getMethodTagsValues() {
42 $service = new \TYPO3\CMS\Extbase\Reflection\ReflectionService();
43 $tagsValues = $service->getMethodTagsValues(get_class($this), 'fixtureMethodForMethodTagsValues');
44 $this->assertEquals(array(
45 'param' => array('array $foo The foo parameter'),
46 'return' => array('void')
47 ), $tagsValues);
48 }
49
50 /**
51 * @test
52 */
53 public function getMethodParameters() {
54 $service = new \TYPO3\CMS\Extbase\Reflection\ReflectionService();
55 $parameters = $service->getMethodParameters(get_class($this), 'fixtureMethodForMethodTagsValues');
56 $this->assertEquals(array(
57 'foo' => array(
58 'position' => 0,
59 'byReference' => FALSE,
60 'array' => TRUE,
61 'optional' => FALSE,
62 'allowsNull' => FALSE,
63 'class' => NULL,
64 'type' => 'array'
65 )
66 ), $parameters);
67 }
68 }