Skip to content

Commit 5a93c2e

Browse files
committed
Fix tests VarDumperTest:.class.
1 parent 9d69938 commit 5a93c2e

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

tests/framework/helpers/VarDumperTest.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function testDumpObject(): void
5959
* Data provider for [[testExport()]].
6060
* @return array test data
6161
*/
62-
public static function dataProviderExport()
62+
public static function dataProviderExport(): array
6363
{
6464
// Regular :
6565

@@ -147,7 +147,7 @@ public static function dataProviderExport()
147147
$expectedResult = "unserialize('" . serialize($var) . "')";
148148
$data[] = [$var, $expectedResult];
149149

150-
$var = fn() => 2;
150+
$var = function () {return 2;};
151151
$expectedResult = 'function () {return 2;}';
152152
$data[] = [$var, $expectedResult];
153153

@@ -157,13 +157,14 @@ public static function dataProviderExport()
157157
/**
158158
* @dataProvider dataProviderExport
159159
*
160+
* @param mixed $var
160161
* @param string $expectedResult
161162
*/
162-
public function testExport(mixed $var, $expectedResult): void
163+
public function testExport(mixed $var, string $expectedResult): void
163164
{
164165
$exportResult = VarDumper::export($var);
165166
$this->assertEqualsWithoutLE($expectedResult, $exportResult);
166-
//$this->assertEquals($var, eval('return ' . $exportResult . ';'));
167+
$this->assertEquals($var, eval('return ' . $exportResult . ';'));
167168
}
168169

169170
/**
@@ -172,15 +173,15 @@ public function testExport(mixed $var, $expectedResult): void
172173
public function testExportObjectFallback(): void
173174
{
174175
$var = new \StdClass();
175-
$var->testFunction = fn() => 2;
176+
$var->testFunction = function () {return 2;};
176177
$exportResult = VarDumper::export($var);
177178
$this->assertNotEmpty($exportResult);
178179

179180
$master = new \StdClass();
180181
$slave = new \StdClass();
181182
$master->slave = $slave;
182183
$slave->master = $master;
183-
$master->function = fn() => true;
184+
$master->function = function () {return true;};
184185

185186
$exportResult = VarDumper::export($master);
186187
$this->assertNotEmpty($exportResult);
@@ -200,3 +201,4 @@ public function testDumpClassWithCustomDebugInfo(): void
200201
$this->assertStringNotContainsString('unitPrice', $dumpResult);
201202
}
202203
}
204+

0 commit comments

Comments
 (0)