Skip to content

Commit 24b9c66

Browse files
committed
fix(php-validation): fix test rule names
1 parent 5b4ff72 commit 24b9c66

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

src/Validator.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<?php
22

33
namespace Atakde\PhpValidation;
4-
54
use Atakde\PhpValidation\Exception\InvalidRuleException;
65

76
class Validator
@@ -27,7 +26,7 @@ public function validate($rules, $params)
2726
$ruleArray = explode('|', $ruleString);
2827
foreach ($ruleArray as $rule) {
2928
if (isset($this->validators[$rule])) {
30-
$checkValue = isset($params[$ruleField]) ? $params[$ruleField] : null; // test fail if not doing this for now.
29+
$checkValue = isset($params[$ruleField]) ? $params[$ruleField] : null;
3130
if (!$this->validators[$rule]->check($checkValue)) {
3231
$this->errors[$ruleField][] = $this->validators[$rule]->getMessage();
3332
}

tests/Rules/RequiredRuleTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ protected function setUp()
1717
/**
1818
* Check required rule is working or not
1919
*/
20-
public function testEmptyRule()
20+
public function testRequiredRule()
2121
{
22-
$this->validator->validate(['myInput' => 'required'], ['myInput' => '']); // giving an the input value in array
22+
$this->validator->validate(['myInput' => 'required'], ['myInput' => '']); // giving correct params
2323
$this->assertTrue($this->validator->passes());
2424

2525
$this->validator->validate(['myInput' => 'required'], []); // sending an empty array

tests/Rules/StringRuleTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ protected function setUp()
1717
/**
1818
* Check string rule is working or not
1919
*/
20-
public function testEmptyRule()
20+
public function testStringRule()
2121
{
2222
$this->validator->validate(['myInput' => 'string'], ['myInput' => 'my string']); // giving a string value
2323
$this->assertTrue($this->validator->passes());

0 commit comments

Comments
 (0)