File tree Expand file tree Collapse file tree 1 file changed +22
-1
lines changed
src/test/php/lang/reflection/unittest Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change 11<?php namespace lang \reflection \unittest ;
22
3- use lang \Reflection ;
3+ use lang \{ Reflection , Runnable } ;
44use test \{Assert , Test };
55
66class AnonymousClassTest {
@@ -21,4 +21,25 @@ public function fixture() { }
2121
2222 Assert::equals (Test::class, $ type ->method ('fixture ' )->annotation (Test::class)->type ());
2323 }
24+
25+ #[Test]
26+ public function newinstance_string () {
27+ $ type = Reflection::type (newinstance (Runnable::class, [], '{
28+
29+ #[\test\Test]
30+ public function run() { }
31+ } ' ));
32+
33+ Assert::equals (Test::class, $ type ->method ('run ' )->annotation (Test::class)->type ());
34+ }
35+
36+ #[Test]
37+ public function newinstance_map () {
38+ $ type = Reflection::type (newinstance (Runnable::class, [], [
39+
40+ '#[\test\Test] run ' => function () { }
41+ ]));
42+
43+ Assert::equals (Test::class, $ type ->method ('run ' )->annotation (Test::class)->type ());
44+ }
2445}
You can’t perform that action at this time.
0 commit comments