From dbff203d1e27a3b1ab66107d14b683775743d6e3 Mon Sep 17 00:00:00 2001 From: kenjis Date: Fri, 23 Aug 2024 08:25:00 +0900 Subject: [PATCH] test: add test for numeric field name --- tests/system/Validation/ValidationTest.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/system/Validation/ValidationTest.php b/tests/system/Validation/ValidationTest.php index b5493a682c8e..00360f368e66 100644 --- a/tests/system/Validation/ValidationTest.php +++ b/tests/system/Validation/ValidationTest.php @@ -270,6 +270,16 @@ public function testRunDoesTheBasics(): void $this->assertSame([], $this->validation->getValidated()); } + public function testRunWithNumericFieldName(): void + { + // The array key will be int. + $data = ['123' => 'notanumber']; + $this->validation->setRules(['123' => 'is_numeric']); + + $this->assertFalse($this->validation->run($data)); + $this->assertSame([], $this->validation->getValidated()); + } + public function testClosureRule(): void { $this->validation->setRules(