Skip to content

Commit de91fff

Browse files
committed
Test omitting optionals
1 parent 01d28e1 commit de91fff

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/test/php/lang/reflection/unittest/ArgumentPassingTest.class.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ public function pass_named_out_of_order() {
4949
Assert::equals([1, 2], Routine::pass($f, ['b' => 2, 'a' => 1]));
5050
}
5151

52+
#[Test]
53+
public function omit_optional() {
54+
$f= new ReflectionFunction(fn($a, $b= 0, $c= 0) => null);
55+
Assert::equals([1, 0, 2], Routine::pass($f, ['a' => 1, 'c' => 2]));
56+
}
57+
5258
#[Test, Expect(class: Error::class, message: 'Missing parameter $b')]
5359
public function missing_named() {
5460
$f= new ReflectionFunction(fn($a, $b) => null);

0 commit comments

Comments
 (0)