Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita7d1f68

Browse files
author
denjas
committed
test: created own test for property hooks with default values
1 parent0d651a0 commita7d1f68

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

‎src/Symfony/Component/VarExporter/Tests/Fixtures/LazyProxy/Hooked.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,4 @@ class Hooked
2222
get {return$this->backed ??=234; }
2323
set {$this->backed =$value; }
2424
}
25-
26-
publicint$backedWithDefault =321 {
27-
get =>$this->backedWithDefault;
28-
set =>$this->backedWithDefault =$value;
29-
}
3025
}

‎src/Symfony/Component/VarExporter/Tests/LazyGhostTraitTest.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
useSymfony\Component\VarExporter\Tests\Fixtures\LazyGhost\TestClass;
2828
useSymfony\Component\VarExporter\Tests\Fixtures\LazyProxy\AsymmetricVisibility;
2929
useSymfony\Component\VarExporter\Tests\Fixtures\LazyProxy\Hooked;
30+
useSymfony\Component\VarExporter\Tests\Fixtures\LazyProxy\HookedWithDefaultValue;
3031
useSymfony\Component\VarExporter\Tests\Fixtures\SimpleObject;
3132

3233
class LazyGhostTraitTestextends TestCase
@@ -503,9 +504,20 @@ public function testPropertyHooks()
503504
$object->backed =345;
504505
$this->assertTrue($initialized);
505506
$this->assertSame(345,$object->backed);
507+
}
506508

509+
publicfunctiontestPropertyHooksWithDefaultValue()
510+
{
507511
$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) {
509521
$initialized =true;
510522
});
511523
$object->backedWithDefault =654;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp