‪TYPO3CMS  9.5
DebuggerUtilityTest.php
Go to the documentation of this file.
1 <?php
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  */
17 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
18 
22 class ‪DebuggerUtilityTest extends UnitTestCase
23 {
28  {
30  $objectStorage = $this->getMockBuilder(\‪TYPO3\CMS\‪Extbase\Persistence\ObjectStorage::class)
31  ->setMethods(['dummy'])
32  ->getMock();
33  for ($i = 0; $i < 5; $i++) {
34  $obj = new \stdClass();
35  $obj->property = $i;
36  $objectStorage->attach($obj);
37  }
38  ‪DebuggerUtility::var_dump($objectStorage, null, 8, true, false, true);
39  $this->assertTrue($objectStorage->valid());
40  }
41 
46  {
47  $generator = (function () {
48  yield 1;
49  yield 2;
50  yield 3;
51  })();
52  $result = ‪DebuggerUtility::var_dump($generator, null, 8, true, false, true);
53  $this->assertContains('Generator', $result);
54  }
55 
60  {
61  $testObject = new \stdClass();
62  $testObject->foo = 'bar';
63  $result = ‪DebuggerUtility::var_dump($testObject, null, 8, true, false, true);
64  $this->assertRegExp('/foo.*bar/', $result);
65  }
66 
71  {
72  $result = ‪DebuggerUtility::var_dump(function (...‪$args) {
73  }, null, 8, true, false, true);
74  $this->assertContains('function (...$args)', $result);
75  }
76 
81  {
82  $testClass = new \stdClass();
83  $testClass->secretData = 'I like cucumber.';
84  $testClass->notSoSecretData = 'I like burger.';
85 
86  $result = ‪DebuggerUtility::var_dump($testClass, null, 8, true, false, true, null, ['secretData']);
87  self::assertNotContains($testClass->secretData, $result);
88  }
89 
94  {
95  $testClass = new \stdClass();
96  $testClass->data = 'I like burger.';
97 
98  $result = ‪DebuggerUtility::var_dump($testClass, null, 8, true, false, true, [\stdClass::class]);
99  self::assertNotContains($testClass->data, $result);
100  }
101 
106  {
107  $date = \DateTime::createFromFormat('Y-m-d H:i:s', '2018-11-26 09:27:28', new \DateTimeZone('UTC'));
108 
109  $result = ‪DebuggerUtility::var_dump($date, null, 8, true, false, true, [\stdClass::class]);
110  self::assertContains('2018-11-26T09:27:28', $result);
111  }
112 
117  {
118  $date = \DateTimeImmutable::createFromFormat('Y-m-d H:i:s', '2018-11-26 09:27:28', new \DateTimeZone('UTC'));
119 
120  $result = ‪DebuggerUtility::var_dump($date, null, 8, true, false, true, [\stdClass::class]);
121  self::assertContains('2018-11-26T09:27:28', $result);
122  }
123 }
‪TYPO3\CMS\Extbase\Tests\Unit\Utility\DebuggerUtilityTest\varDumpShowsDumpOfDateTime
‪varDumpShowsDumpOfDateTime()
Definition: DebuggerUtilityTest.php:105
‪TYPO3\CMS\Extbase\Tests\Unit\Utility\DebuggerUtilityTest\varDumpShowsPropertiesOfStdClassObjects
‪varDumpShowsPropertiesOfStdClassObjects()
Definition: DebuggerUtilityTest.php:59
‪TYPO3\CMS\Extbase\Annotation
Definition: IgnoreValidation.php:4
‪$args
‪$args
Definition: checkIntegrityCsvFixtures.php:230
‪TYPO3\CMS\Extbase\Tests\Unit\Utility\DebuggerUtilityTest\varDumpShowsDumpOfDateTimeImmutable
‪varDumpShowsDumpOfDateTimeImmutable()
Definition: DebuggerUtilityTest.php:116
‪TYPO3\CMS\Extbase\Tests\Unit\Utility\DebuggerUtilityTest\debuggerRewindsInstancesOfIterator
‪debuggerRewindsInstancesOfIterator()
Definition: DebuggerUtilityTest.php:27
‪TYPO3\CMS\Extbase\Tests\Unit\Utility\DebuggerUtilityTest\varDumpRespectsBlacklistedClasses
‪varDumpRespectsBlacklistedClasses()
Definition: DebuggerUtilityTest.php:93
‪TYPO3
‪TYPO3\CMS\Extbase\Tests\Unit\Utility\DebuggerUtilityTest\varDumpRespectsBlacklistedProperties
‪varDumpRespectsBlacklistedProperties()
Definition: DebuggerUtilityTest.php:80
‪TYPO3\CMS\Extbase\Tests\Unit\Utility\DebuggerUtilityTest
Definition: DebuggerUtilityTest.php:23
‪TYPO3\CMS\Extbase\Tests\Unit\Utility\DebuggerUtilityTest\varDumpHandlesVariadicArguments
‪varDumpHandlesVariadicArguments()
Definition: DebuggerUtilityTest.php:70
‪TYPO3\CMS\Extbase\Tests\Unit\Utility
Definition: DebuggerUtilityTest.php:2
‪TYPO3\CMS\Extbase\Utility\DebuggerUtility
Definition: DebuggerUtility.php:24
‪TYPO3\CMS\Extbase\Utility\DebuggerUtility\var_dump
‪static string var_dump($variable, $title=null, $maxDepth=8, $plainText=false, $ansiColors=true, $return=false, $blacklistedClassNames=null, $blacklistedPropertyNames=null)
Definition: DebuggerUtility.php:496
‪TYPO3\CMS\Extbase\Tests\Unit\Utility\DebuggerUtilityTest\debuggerDoesNotRewindInstancesOfGenerator
‪debuggerDoesNotRewindInstancesOfGenerator()
Definition: DebuggerUtilityTest.php:45