Skip to content

Commit 24f3b2c

Browse files
committed
Add variations to variable method reference tests
1 parent 6b85e46 commit 24f3b2c

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php namespace lang\ast\unittest\emit;
22

3-
use unittest\{Assert, Test};
3+
use unittest\{Assert, Test, Values};
44

55
class CallableSyntaxTest extends EmittingTest {
66

@@ -67,26 +67,26 @@ public function run() {
6767
Assert::equals(4, $f('Test'));
6868
}
6969

70-
#[Test]
71-
public function variable_instance_method() {
70+
#[Test, Values(['$this->$func(...)', '$this->{$func}(...)'])]
71+
public function variable_instance_method($expr) {
7272
$f= $this->run('class <T> {
7373
private function length($arg) { return strlen($arg); }
7474
public function run() {
7575
$func= "length";
76-
return $this->$func(...);
76+
return '.$expr.';
7777
}
7878
}');
7979

8080
Assert::equals(4, $f('Test'));
8181
}
8282

83-
#[Test]
84-
public function variable_class_method() {
83+
#[Test, Values(['self::$func(...)', 'self::{$func}(...)'])]
84+
public function variable_class_method($expr) {
8585
$f= $this->run('class <T> {
8686
private static function length($arg) { return strlen($arg); }
8787
public function run() {
8888
$func= "length";
89-
return self::$func(...);
89+
return '.$expr.';
9090
}
9191
}');
9292

0 commit comments

Comments
 (0)