Skip to content

Commit 5bf8b3e

Browse files
minor symfony#61197 [ObjectMapper] Fix test using LazyObjectInterface (nicolas-grekas)
This PR was merged into the 7.3 branch. Discussion ---------- [ObjectMapper] Fix test using LazyObjectInterface | Q | A | ------------- | --- | Branch? | 7.3 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | - | License | MIT Instead of symfony#61191 and symfony#61192 Commits ------- 168b3a3 [ObjectMapper] Fix test using LazyObjectInterface
2 parents 208ddc9 + 168b3a3 commit 5bf8b3e

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

src/Symfony/Component/ObjectMapper/Tests/Fixtures/LazyFoo.php

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,28 @@
1111

1212
namespace Symfony\Component\ObjectMapper\Tests\Fixtures;
1313

14-
use Symfony\Component\VarExporter\LazyGhostTrait;
1514
use Symfony\Component\VarExporter\LazyObjectInterface;
1615

1716
class LazyFoo extends \stdClass implements LazyObjectInterface
1817
{
19-
use LazyGhostTrait;
18+
private bool $initialized = false;
2019

21-
public string $name = 'foo';
20+
public function isLazyObjectInitialized(bool $partial = false): bool
21+
{
22+
return $this->initialized;
23+
}
24+
25+
public function initializeLazyObject(): object
26+
{
27+
$this->initialized = true;
28+
29+
return $this;
30+
}
31+
32+
public function resetLazyObject(): bool
33+
{
34+
$this->initialized = false;
35+
36+
return true;
37+
}
2238
}

src/Symfony/Component/ObjectMapper/Tests/ObjectMapperTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -371,9 +371,6 @@ public static function objectMapperProvider(): iterable
371371
yield [new ObjectMapper(new ReflectionObjectMapperMetadataFactory(), PropertyAccess::createPropertyAccessor())];
372372
}
373373

374-
/**
375-
* @group legacy
376-
*/
377374
public function testMapInitializesLazyObject()
378375
{
379376
$lazy = new LazyFoo();

0 commit comments

Comments
 (0)