Skip to content

Commit 60373fd

Browse files
authored
Merge pull request #62 from peter279k/test_enhancement
Test enhancement
2 parents 61ed77b + aa5f9c9 commit 60373fd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+214
-85
lines changed

.travis.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
language: php
22

33
php:
4-
- 5.5
5-
- 5.6
64
- 7.0
5+
- 7.1
6+
- 7.2
77

88
before_script:
9-
- composer self-update
10-
- composer install --dev
9+
- composer install
1110

12-
script: phpunit --coverage-text
11+
script: phpunit --coverage-text

composer.json

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,16 @@
1313
"Rakit\\Validation\\": "src"
1414
}
1515
},
16+
"autoload-dev": {
17+
"psr-4": {
18+
"Rakit\\Validation\\Tests\\": ["tests", "tests/Fixtures"]
19+
}
20+
},
1621
"require": {
17-
"php": ">=5.5.0",
22+
"php": ">=7.0",
1823
"ext-mbstring": "*"
1924
},
2025
"require-dev": {
21-
"phpunit/phpunit": "4.*"
26+
"phpunit/phpunit": "^6.5"
2227
}
23-
}
28+
}

phpunit.xml.dist

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
1-
<phpunit bootstrap="vendor/autoload.php">
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit backupGlobals="false"
3+
backupStaticAttributes="false"
4+
bootstrap="tests/bootstrap.php"
5+
colors="true"
6+
convertErrorsToExceptions="true"
7+
convertNoticesToExceptions="true"
8+
convertWarningsToExceptions="true"
9+
processIsolation="false"
10+
stopOnFailure="false"
11+
>
212
<testsuites>
3-
<testsuite name="Block">
13+
<testsuite name="Validation test suites">
414
<directory>./tests</directory>
515
</testsuite>
616
</testsuites>
7-
817
<filter>
918
<whitelist>
10-
<directory>./src</directory>
19+
<directory suffix=".php">./src</directory>
1120
</whitelist>
1221
</filter>
13-
</phpunit>
22+
</phpunit>

src/Rule.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public function setMessage($message)
9292
{
9393
$this->message = $message;
9494
return $this;
95-
}
95+
}
9696

9797
public function getMessage()
9898
{
@@ -109,4 +109,4 @@ protected function requireParameters(array $params)
109109
}
110110
}
111111

112-
}
112+
}

src/Rules/Defaults.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class Defaults extends Rule
1414
public function check($value)
1515
{
1616
$this->requireParameters($this->fillable_params);
17-
17+
1818
$default = $this->parameter('default');
1919
return $default;
2020
}

src/Rules/Json.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public function check($value)
1414
if (! is_string($value) || empty($value)) {
1515
return false;
1616
}
17-
17+
1818
json_decode($value);
1919

2020
if (json_last_error() !== JSON_ERROR_NONE) {
@@ -24,4 +24,4 @@ public function check($value)
2424
return true;
2525
}
2626

27-
}
27+
}

src/Rules/Min.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class Min extends Rule
1414
public function check($value)
1515
{
1616
$this->requireParameters($this->fillable_params);
17-
17+
1818
$min = (int) $this->parameter('min');
1919
if (is_int($value)) {
2020
return $value >= $min;

src/Rules/RequiredIf.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function check($value)
3030

3131
if (in_array($anotherValue, $definedValues)) {
3232
$this->setAttributeAsRequired();
33-
return $required_validator->check($value, []);
33+
return $required_validator->check($value, []);
3434
}
3535

3636
return true;

src/Rules/RequiredUnless.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function check($value)
3030

3131
if (!in_array($anotherValue, $definedValues)) {
3232
$this->setAttributeAsRequired();
33-
return $required_validator->check($value, []);
33+
return $required_validator->check($value, []);
3434
}
3535

3636
return true;

src/Rules/RequiredWith.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function check($value)
2626
foreach($fields as $field) {
2727
if ($this->validation->hasValue($field)) {
2828
$this->setAttributeAsRequired();
29-
return $required_validator->check($value, []);
29+
return $required_validator->check($value, []);
3030
}
3131
}
3232

0 commit comments

Comments
 (0)