Skip to content

Commit 54e0997

Browse files
committed
Invoke from() directly
1 parent 1678c20 commit 54e0997

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

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

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -102,27 +102,19 @@ public function backed_enum_from_int($arg, $expected) {
102102
$t= $this->type('enum <T>: int {
103103
case NO = 0;
104104
case YES = 1;
105-
106-
public static function run($arg) {
107-
return self::from($arg)->name;
108-
}
109105
}');
110106

111-
Assert::equals($expected, $t->getMethod('run')->invoke(null, [$arg]));
107+
Assert::equals($expected, $t->getMethod('from')->invoke(null, [$arg])->name);
112108
}
113109

114110
#[Test, Values([['asc', 'ASC'], ['desc', 'DESC']])]
115111
public function backed_enum_from_string($arg, $expected) {
116112
$t= $this->type('enum <T>: string {
117113
case ASC = "asc";
118114
case DESC = "desc";
119-
120-
public static function run($arg) {
121-
return self::from($arg)->name;
122-
}
123115
}');
124116

125-
Assert::equals($expected, $t->getMethod('run')->invoke(null, [$arg]));
117+
Assert::equals($expected, $t->getMethod('from')->invoke(null, [$arg])->name);
126118
}
127119

128120
#[Test]

0 commit comments

Comments
 (0)