Skip to content

Commit 72ecc2e

Browse files
committed
format test files
1 parent 1e4247e commit 72ecc2e

25 files changed

+68
-50
lines changed

.php_cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ return PhpCsFixer\Config::create()
2525
])
2626
->setFinder(
2727
PhpCsFixer\Finder::create()
28-
->exclude('test')
28+
// ->exclude('test')
2929
->exclude('docs')
3030
->exclude('vendor')
3131
->in(__DIR__)

docs/Valid.php renamed to src/Valid.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,5 +71,4 @@ public static function getStrings(string $field, int $min = null, int $max = nul
7171
{
7272
return 0;
7373
}
74-
7574
}

src/ValidateException.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php declare(strict_types=1);
2+
3+
namespace Inhere\Validate;
4+
5+
use RuntimeException;
6+
7+
/**
8+
* Class ValidateException
9+
*
10+
* @package Inhere\Validate
11+
*/
12+
class ValidateException extends RuntimeException
13+
{
14+
}

src/Validation.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@
1010

1111
/**
1212
* Class Validation
13+
*
1314
* @package Inhere\Validate
14-
* usage:
15+
*
16+
* Usage:
1517
* $vd = Validation::make($_POST, [
1618
* ['tagId,userId,name,email,freeTime', 'required'],
1719
* ['email', 'email'],

src/Validator/ValidatorInterface.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,16 @@
33
namespace Inhere\Validate\Validator;
44

55
/**
6-
*
7-
* 验证器借口
6+
* Interface ValidatorInterface
87
*/
98
interface ValidatorInterface
109
{
1110
/**
12-
* 验证方法,进行验证返回bool类型
13-
* @param type $value 当前值
14-
* @param type $data 全部的值
11+
* Verification method, verify and return bool type
12+
*
13+
* @param mixed $value current value for field
14+
* @param array $data all data in the validation
15+
*
1516
* @return bool
1617
*/
1718
public function validate($value, $data): bool;

test/FieldValidationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?php
1+
<?php declare(strict_types=1);
22

33
namespace Inhere\ValidateTest;
44

test/Filter/FiltersTest.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?php
1+
<?php declare(strict_types=1);
22

33
namespace Inhere\ValidateTest\Filter;
44

@@ -231,10 +231,14 @@ public function testEncodeOrClearTag(): void
231231
$this->assertSame('abc.com%3Fa%3D7%2B9', Filters::encoded('abc.com?a=7+9'));
232232
$this->assertSame('abc.com%3Fa%3D7%2B9%26b%3D', Filters::encoded('abc.com?a=7+9&b=你', FILTER_FLAG_STRIP_HIGH));
233233
$this->assertSame('abc.com%3Fa%3D7%2B9%26b%3D%E4%BD%A0', Filters::encoded('abc.com?a=7+9&b=你'));
234-
$this->assertSame('abc.com%3Fa%3D7%2B9%26b%3D%E4%BD%A0',
235-
Filters::encoded('abc.com?a=7+9&b=你', FILTER_FLAG_ENCODE_LOW));
236-
$this->assertSame('abc.com%3Fa%3D7%2B9%26b%3D%E4%BD%A0',
237-
Filters::encoded('abc.com?a=7+9&b=你', FILTER_FLAG_ENCODE_HIGH));
234+
$this->assertSame(
235+
'abc.com%3Fa%3D7%2B9%26b%3D%E4%BD%A0',
236+
Filters::encoded('abc.com?a=7+9&b=你', FILTER_FLAG_ENCODE_LOW)
237+
);
238+
$this->assertSame(
239+
'abc.com%3Fa%3D7%2B9%26b%3D%E4%BD%A0',
240+
Filters::encoded('abc.com?a=7+9&b=你', FILTER_FLAG_ENCODE_HIGH)
241+
);
238242

239243
// url
240244
$this->assertSame('', Filters::url(''));

test/Filter/FiltrationTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?php
1+
<?php declare(strict_types=1);
22
/**
33
* Created by PhpStorm.
44
* User: inhere
@@ -117,7 +117,7 @@ public function testUseClosure(): void
117117
{
118118
$fl = Filtration::make($this->data);
119119
$fl->setRules([
120-
['name', function($val) {
120+
['name', function ($val) {
121121
$this->assertSame(' tom ', $val);
122122
return trim($val);
123123
}]

test/Filter/UserFiltersTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?php
1+
<?php declare(strict_types=1);
22
/**
33
* Created by PhpStorm.
44
* User: inhere

test/FiltrationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?php
1+
<?php declare(strict_types=1);
22
/**
33
* Created by PhpStorm.
44
* User: inhere

0 commit comments

Comments
 (0)