9208345f3b53d18d9f04822afc9c6c4b395d271e
[Packages/TYPO3.CMS.git] / typo3 / sysext / extbase / Tests / Unit / Utility / DebuggerUtilityTest.php
1 <?php
2 namespace TYPO3\CMS\Extbase\Tests\Unit\Utility;
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 DebuggerUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
21
22 /**
23 * @var \TYPO3\CMS\Extbase\Utility\DebuggerUtility
24 */
25 protected $debugger;
26
27 public function setUp() {
28 $this->debugger = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Utility\\DebuggerUtility', array('dummy'));
29 }
30
31 /**
32 * @test
33 * @author Alexander Schnitzler <alex.schnitzler@typovision.de>
34 */
35 public function debuggerRewindsInstancesOfIterator() {
36 /** @var $objectStorage \TYPO3\CMS\Extbase\Persistence\ObjectStorage */
37 $objectStorage = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage', array('dummy'));
38 for ($i = 0; $i < 5; $i++) {
39 $obj = new \StdClass();
40 $obj->property = $i;
41 $objectStorage->attach($obj);
42 }
43 $this->debugger->var_dump($objectStorage, NULL, 8, TRUE, FALSE, TRUE);
44 $this->assertTrue($objectStorage->valid());
45 }
46
47 /**
48 * @test
49 * @author Anja Leichsenring <anja.leichsenring@typo3.org>
50 */
51 public function debuggerDoesNotRewindInstanceOfArrayAccess() {
52
53 $parameters = array();
54 for ($i = 0; $i < 5; $i++) {
55 $argument = new \TYPO3\CMS\Extbase\Mvc\Controller\Argument('argument_' . $i, 'integer');
56 $parameters[$i] = $argument;
57 }
58
59 /** @var $arguments \TYPO3\CMS\Fluid\Core\ViewHelper\Arguments */
60 $arguments = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\ViewHelper\\Arguments', array('dummy'), array('arguments' => $parameters));
61
62 $arguments->expects($this->never())->method('rewind');
63 $this->debugger->var_dump($arguments, NULL, 8, TRUE, FALSE, TRUE);
64 }
65 }