Skip to content

Commit 6850804

Browse files
committed
Add one for test for single value and single validation
1 parent b73173b commit 6850804

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

tests/system/Validation/ValidationTest.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -785,4 +785,31 @@ public function testRulesForSingleRuleWithAsteriskWillReturnError()
785785
'name_user.*' => 'The name_user.* field may only contain alphabetical characters.',
786786
], $this->validation->getErrors());
787787
}
788+
789+
//--------------------------------------------------------------------
790+
791+
public function testRulesForSingleRuleWithSingleValue()
792+
{
793+
$config = new App();
794+
$config->baseURL = 'http://example.com';
795+
796+
$_REQUEST = [
797+
'id_user' => 'gh',
798+
];
799+
800+
$request = new IncomingRequest($config, new URI(), 'php://input', new UserAgent());
801+
$request->setMethod('post');
802+
803+
$this->validation->setRules([
804+
'id_user' => 'numeric',
805+
]);
806+
807+
$this->validation->withRequest($request)
808+
->run();
809+
$this->assertEquals([
810+
'id_user' => 'The id_user field must contain only numbers.',
811+
], $this->validation->getErrors());
812+
}
813+
814+
//--------------------------------------------------------------------
788815
}

0 commit comments

Comments
 (0)