From 8fe1f4964fdc0663775ecb4419acf6f9a53e6c54 Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Wed, 5 Feb 2025 21:19:20 +0800 Subject: [PATCH 1/2] Test Improvements fixes tests failure introduced in #54425 Signed-off-by: Mior Muhammad Zaki --- tests/Validation/ValidationNumericRuleTest.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/Validation/ValidationNumericRuleTest.php b/tests/Validation/ValidationNumericRuleTest.php index a8393e742123..acb135f84a31 100644 --- a/tests/Validation/ValidationNumericRuleTest.php +++ b/tests/Validation/ValidationNumericRuleTest.php @@ -64,7 +64,7 @@ public function testGreaterThanRule() public function testGreaterThanOrEqualRule() { - $rule = Rule::numeric()->greaterThanOrEqual('some_field'); + $rule = Rule::numeric()->greaterThanOrEqualTo('some_field'); $this->assertEquals('numeric|gte:some_field', (string) $rule); } @@ -82,7 +82,7 @@ public function testLessThanRule() public function testLessThanOrEqualRule() { - $rule = Rule::numeric()->lessThanOrEqual('some_field'); + $rule = Rule::numeric()->lessThanOrEqualTo('some_field'); $this->assertEquals('numeric|lte:some_field', (string) $rule); } @@ -139,7 +139,7 @@ public function testChainedRules() $rule = Rule::numeric() ->integer() ->multipleOf(10) - ->lessThanOrEqual('some_field') + ->lessThanOrEqualTo('some_field') ->max(100); $this->assertEquals('numeric|integer|multiple_of:10|lte:some_field|max:100', (string) $rule); @@ -229,7 +229,7 @@ public function testNumericValidation() $this->assertEmpty($validator->errors()->first('numeric')); - $rule = Rule::numeric()->greaterThanOrEqual('some_field'); + $rule = Rule::numeric()->greaterThanOrEqualTo('some_field'); $validator = new Validator( $trans, @@ -259,7 +259,7 @@ public function testNumericValidation() $this->assertEmpty($validator->errors()->first('numeric')); - $rule = Rule::numeric()->lessThanOrEqual('some_field'); + $rule = Rule::numeric()->lessThanOrEqualTo('some_field'); $validator = new Validator( $trans, @@ -329,7 +329,7 @@ public function testNumericValidation() $this->assertEmpty($validator->errors()->first('numeric')); - $rule = Rule::numeric()->size(10); + $rule = Rule::numeric()->exactly(10); $validator = new Validator( $trans, @@ -342,7 +342,7 @@ public function testNumericValidation() public function testUniquenessValidation() { - $rule = Rule::numeric()->integer()->digits(2)->size(2); + $rule = Rule::numeric()->integer()->digits(2)->exactly(2); $this->assertEquals('numeric|integer|digits:2|size:2', (string) $rule); } } From 6ba0c91dabefa138494cc15674839a4b16cc88fe Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Wed, 5 Feb 2025 21:32:42 +0800 Subject: [PATCH 2/2] wip Signed-off-by: Mior Muhammad Zaki --- types/Support/LazyCollection.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/Support/LazyCollection.php b/types/Support/LazyCollection.php index 3c97da5a3714..287eb69a2127 100644 --- a/types/Support/LazyCollection.php +++ b/types/Support/LazyCollection.php @@ -398,12 +398,12 @@ public function toArray(): array return true; })); -assertType('string|User', $collection->last(function ($user) { +assertType("'string'|User", $collection->last(function ($user) { assertType('User', $user); return false; }, 'string')); -assertType('string|User', $collection->last(null, function () { +assertType("'string'|User", $collection->last(null, function () { return 'string'; }));