mirror of
https://github.com/vlucas/valitron.git
synced 2025-12-30 23:01:52 +00:00
Merge pull request #246 from peter279k/test_enhancement
Test enhancement
This commit is contained in:
commit
3c5463315b
12
.travis.yml
12
.travis.yml
@ -1,21 +1,27 @@
|
|||||||
# see http://about.travis-ci.org/docs/user/languages/php/ for more hints
|
# see http://about.travis-ci.org/docs/user/languages/php/ for more hints
|
||||||
language: php
|
language: php
|
||||||
dist: precise
|
|
||||||
|
|
||||||
# list any PHP version you want to test against
|
# list any PHP version you want to test against
|
||||||
php:
|
php:
|
||||||
- 5.3
|
|
||||||
- 5.4
|
- 5.4
|
||||||
- 5.5
|
- 5.5
|
||||||
- 5.6
|
- 5.6
|
||||||
|
- 7.0
|
||||||
|
- 7.1
|
||||||
|
- 7.2
|
||||||
|
- nightly
|
||||||
- hhvm
|
- hhvm
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
allow_failures:
|
allow_failures:
|
||||||
- php: hhvm
|
- php: hhvm
|
||||||
|
- php: nightly
|
||||||
|
include:
|
||||||
|
- php: 5.3
|
||||||
|
dist: precise
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
- composer install
|
- composer install
|
||||||
|
|
||||||
# Script to run tests
|
# Script to run tests
|
||||||
script: ./vendor/bin/phpunit
|
script: composer test
|
||||||
|
|||||||
@ -16,11 +16,19 @@
|
|||||||
"php": ">=5.3.2"
|
"php": ">=5.3.2"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"phpunit/phpunit": "~4.8.35"
|
"phpunit/phpunit": "^4.8.35 || ^5.5 || ^6.5"
|
||||||
|
},
|
||||||
|
"suggest": {
|
||||||
|
"ext-mbstring": "It can support the multiple bytes string length."
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-0": {
|
"psr-4": {
|
||||||
"Valitron": "src/"
|
"Valitron\\": "src/Valitron"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload-dev": {
|
||||||
|
"psr-4": {
|
||||||
|
"Valitron\\": "tests/Valitron"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@ -15,4 +15,12 @@
|
|||||||
<directory suffix="Test.php">tests/Valitron</directory>
|
<directory suffix="Test.php">tests/Valitron</directory>
|
||||||
</testsuite>
|
</testsuite>
|
||||||
</testsuites>
|
</testsuites>
|
||||||
|
<filter>
|
||||||
|
<whitelist>
|
||||||
|
<directory suffix=".php">src/</directory>
|
||||||
|
</whitelist>
|
||||||
|
<blacklist>
|
||||||
|
<directory suffix=".php">vendor/</directory>
|
||||||
|
</blacklist>
|
||||||
|
</filter>
|
||||||
</phpunit>
|
</phpunit>
|
||||||
|
|||||||
@ -15,11 +15,11 @@ class ValidateTest extends BaseTestCase
|
|||||||
$this->assertEquals($v->data(), array('foo' => 'bar'));
|
$this->assertEquals($v->data(), array('foo' => 'bar'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testAccurateErrorCount()
|
public function testAccurateErrorShouldReturnFalse()
|
||||||
{
|
{
|
||||||
$v = new Validator(array('name' => 'Chester Tester'));
|
$v = new Validator(array('name' => 'Chester Tester'));
|
||||||
$v->rule('required', 'name');
|
$v->rule('required', 'name');
|
||||||
$this->assertSame(1, count($v->errors('name')));
|
$this->assertFalse($v->errors('name'));
|
||||||
}
|
}
|
||||||
public function testArrayOfFieldsToValidate()
|
public function testArrayOfFieldsToValidate()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -16,4 +16,4 @@ if($vendorPos !== false) {
|
|||||||
$loader = require __DIR__.'/../vendor/autoload.php';
|
$loader = require __DIR__.'/../vendor/autoload.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once __DIR__ . '/Valitron/BaseTestCase.php';
|
require_once __DIR__ . '/Valitron/BaseTestCase.php';
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user