From f062f9bb75f65d5abbb01ef43c10bc7cdc5493cc Mon Sep 17 00:00:00 2001 From: Brown Date: Tue, 28 May 2019 10:47:54 -0400 Subject: [PATCH] Add more tests for key-of/value-of --- tests/ValueTest.php | 48 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 46 insertions(+), 2 deletions(-) diff --git a/tests/ValueTest.php b/tests/ValueTest.php index 349862ef8..5629d24d5 100644 --- a/tests/ValueTest.php +++ b/tests/ValueTest.php @@ -606,7 +606,11 @@ class ValueTest extends TestCase * @param key-of $i */ public static function foo(int $i) : void {} - }' + } + + A::foo(1); + A::foo(2); + A::foo(3);' ], 'valueOf' => [ ' $j */ public static function bar(string $j) : void {} - }' + } + + A::bar("a"); + A::bar("b"); + A::bar("c");' ], ]; } @@ -798,6 +806,42 @@ class ValueTest extends TestCase }', 'error_message' => 'RedundantCondition', ], + 'keyOfBadValue' => [ + ' "a", + 2 => "b", + 3 => "c" + ]; + + /** + * @param key-of $i + */ + public static function foo(int $i) : void {} + } + + A::foo(4);', + 'error_message' => 'InvalidArgument' + ], + 'valueOfBadValue' => [ + ' "a", + 2 => "b", + 3 => "c" + ]; + + /** + * @param value-of $j + */ + public static function bar(string $j) : void {} + } + + A::bar("d");', + 'error_message' => 'InvalidArgument' + ], ]; } }