Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
122 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Unit-tests | ||
|
||
on: [push] | ||
|
||
jobs: | ||
test: | ||
name: Test on php ${{ matrix.php}} and ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
timeout-minutes: 10 | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
php: [7.1, 7.2, 7.3, 7.4] # | ||
os: [ubuntu-latest] # windows-latest, macOS-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
# usage refer https://github.com/shivammathur/setup-php | ||
- name: Setup PHP | ||
timeout-minutes: 5 | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php}} | ||
tools: pecl, php-cs-fixer, phpunit | ||
extensions: mbstring, dom, fileinfo, mysql, openssl, igbinary, redis # , swoole-4.4.19 #optional, setup extensions | ||
ini-values: post_max_size=56M, short_open_tag=On #optional, setup php.ini configuration | ||
coverage: none #optional, setup coverage driver: xdebug, none | ||
|
||
- name: Display Env | ||
run: env | ||
|
||
- name: Install dependencies | ||
run: composer install --no-progress --no-suggest | ||
|
||
# Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit" | ||
# Docs: https://getcomposer.org/doc/articles/scripts.md | ||
|
||
- name: Run test suite | ||
run: composer run test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace Inhere\Validate\Exception; | ||
|
||
/** | ||
* Class ArrayValueNotExists | ||
* | ||
* @package Inhere\Validate\Exception | ||
*/ | ||
final class ArrayValueNotExists | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace Inhere\Validate\Exception; | ||
|
||
use RuntimeException; | ||
|
||
/** | ||
* Class ValidateException | ||
* | ||
* @package Inhere\Validate\Exception | ||
*/ | ||
class ValidateException extends RuntimeException | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
public $field; | ||
|
||
/** | ||
* @param string $field | ||
* @param string $message | ||
* | ||
* @return static | ||
*/ | ||
public static function create(string $field, string $message): self | ||
{ | ||
return new self($field, $message); | ||
} | ||
|
||
/** | ||
* Class constructor. | ||
* | ||
* @param string $field | ||
* @param string $message | ||
*/ | ||
public function __construct(string $field, string $message) | ||
{ | ||
parent::__construct($field . ' ' . $message, 500); | ||
|
||
// save field | ||
$this->field = $field; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace Inhere\Validate; | ||
|
||
/** | ||
* Class GlobalOption TODO | ||
* | ||
* @package Inhere\Validate | ||
*/ | ||
final class GlobalOption | ||
{ | ||
/** | ||
* Prettify field name on get error message | ||
* | ||
* @var bool | ||
*/ | ||
public static $prettifyName = true; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters