Skip to content

Commit 96d45da

Browse files
committed
Verify reflective access to property works as expected
1 parent 9d00be1 commit 96d45da

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/test/php/lang/ast/unittest/emit/InitializeWithExpressionsTest.class.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,18 @@ public function run() {
3939
}', $declaration)));
4040
}
4141

42+
#[Test, Values('expressions')]
43+
public function reflective_access_to_property($declaration, $expected) {
44+
Assert::equals($expected, $this->run(sprintf('use lang\ast\unittest\emit\{FileInput, Handle}; class <T> {
45+
const INITIAL= "initial";
46+
private $h= %s;
47+
48+
public function run() {
49+
return typeof($this)->getField("h")->get($this);
50+
}
51+
}', $declaration)));
52+
}
53+
4254
#[Test, Values(['fn($arg) => $arg->redirect(1)', 'function($arg) { return $arg->redirect(1); }'])]
4355
public function using_closures($declaration) {
4456
$r= $this->run(sprintf('class <T> {

0 commit comments

Comments
 (0)