File tree 2 files changed +13
-6
lines changed
src/Symfony/Component/VarExporter/Tests
2 files changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -22,9 +22,4 @@ class Hooked
22
22
get { return $ this ->backed ??= 234 ; }
23
23
set { $ this ->backed = $ value ; }
24
24
}
25
-
26
- public int $ backedWithDefault = 321 {
27
- get => $ this ->backedWithDefault ;
28
- set => $ this ->backedWithDefault = $ value ;
29
- }
30
25
}
Original file line number Diff line number Diff line change 27
27
use Symfony \Component \VarExporter \Tests \Fixtures \LazyGhost \TestClass ;
28
28
use Symfony \Component \VarExporter \Tests \Fixtures \LazyProxy \AsymmetricVisibility ;
29
29
use Symfony \Component \VarExporter \Tests \Fixtures \LazyProxy \Hooked ;
30
+ use Symfony \Component \VarExporter \Tests \Fixtures \LazyProxy \HookedWithDefaultValue ;
30
31
use Symfony \Component \VarExporter \Tests \Fixtures \SimpleObject ;
31
32
32
33
class LazyGhostTraitTest extends TestCase
@@ -503,9 +504,20 @@ public function testPropertyHooks()
503
504
$ object ->backed = 345 ;
504
505
$ this ->assertTrue ($ initialized );
505
506
$ this ->assertSame (345 , $ object ->backed );
507
+ }
506
508
509
+ public function testPropertyHooksWithDefaultValue ()
510
+ {
507
511
$ initialized = false ;
508
- $ object = $ this ->createLazyGhost (Hooked::class, function ($ instance ) use (&$ initialized ) {
512
+ $ object = $ this ->createLazyGhost (HookedWithDefaultValue::class, function ($ instance ) use (&$ initialized ) {
513
+ $ initialized = true ;
514
+ });
515
+
516
+ $ this ->assertSame (321 , $ object ->backedWithDefault );
517
+ $ this ->assertTrue ($ initialized );
518
+
519
+ $ initialized = false ;
520
+ $ object = $ this ->createLazyGhost (HookedWithDefaultValue::class, function ($ instance ) use (&$ initialized ) {
509
521
$ initialized = true ;
510
522
});
511
523
$ object ->backedWithDefault = 654 ;
You can’t perform that action at this time.
0 commit comments