File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -6,11 +6,15 @@ class DocumentWithAfterConstructEvent extends Document
6
6
{
7
7
public $ status ;
8
8
9
+ public $ param = 42 ;
10
+
9
11
public function beforeConstruct ()
10
12
{
11
13
$ that = $ this ;
12
- $ this ->onAfterConstruct (function () use ($ that ) {
13
- $ that ->status = true ;
14
+
15
+ $ this ->onAfterConstruct (function (Event $ event ) use ($ that ) {
16
+
17
+ $ that ->status = $ event ->getTarget ()->param ;
14
18
});
15
19
}
16
20
}
@@ -55,7 +59,7 @@ public function testOnAfterConstruct()
55
59
56
60
$ document = $ collectionMock ->createDocument ();
57
61
58
- $ this ->assertEquals (true , $ document ->status );
62
+ $ this ->assertEquals (42 , $ document ->status );
59
63
60
64
}
61
65
@@ -417,4 +421,4 @@ public function testCancelOperation_BeforeValidate()
417
421
})
418
422
->validate ();
419
423
}
420
- }
424
+ }
You can’t perform that action at this time.
0 commit comments