Skip to content

Commit dbff203

Browse files
committed
test: add test for numeric field name
1 parent 655bd1d commit dbff203

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

tests/system/Validation/ValidationTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,16 @@ public function testRunDoesTheBasics(): void
270270
$this->assertSame([], $this->validation->getValidated());
271271
}
272272

273+
public function testRunWithNumericFieldName(): void
274+
{
275+
// The array key will be int.
276+
$data = ['123' => 'notanumber'];
277+
$this->validation->setRules(['123' => 'is_numeric']);
278+
279+
$this->assertFalse($this->validation->run($data));
280+
$this->assertSame([], $this->validation->getValidated());
281+
}
282+
273283
public function testClosureRule(): void
274284
{
275285
$this->validation->setRules(

0 commit comments

Comments
 (0)