Skip to content

Commit

Permalink
Merge pull request #246 from peter279k/test_enhancement
Browse files Browse the repository at this point in the history
Test enhancement
  • Loading branch information
willemwollebrants committed May 6, 2018
2 parents 4c9ea18 + 9ec218f commit 3c54633
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 9 deletions.
12 changes: 9 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,27 @@
# see http://about.travis-ci.org/docs/user/languages/php/ for more hints
language: php
dist: precise

# list any PHP version you want to test against
php:
- 5.3
- 5.4
- 5.5
- 5.6
- 7.0
- 7.1
- 7.2
- nightly
- hhvm

matrix:
allow_failures:
- php: hhvm
- php: nightly
include:
- php: 5.3
dist: precise

before_script:
- composer install

# Script to run tests
script: ./vendor/bin/phpunit
script: composer test
14 changes: 11 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,19 @@
"php": ">=5.3.2"
},
"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": {
"psr-0": {
"Valitron": "src/"
"psr-4": {
"Valitron\\": "src/Valitron"
}
},
"autoload-dev": {
"psr-4": {
"Valitron\\": "tests/Valitron"
}
},
"scripts": {
Expand Down
8 changes: 8 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,12 @@
<directory suffix="Test.php">tests/Valitron</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">src/</directory>
</whitelist>
<blacklist>
<directory suffix=".php">vendor/</directory>
</blacklist>
</filter>
</phpunit>
4 changes: 2 additions & 2 deletions tests/Valitron/ValidateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ public function testOptionalFieldFilter()
$this->assertEquals($v->data(), array('foo' => 'bar'));
}

public function testAccurateErrorCount()
public function testAccurateErrorShouldReturnFalse()
{
$v = new Validator(array('name' => 'Chester Tester'));
$v->rule('required', 'name');
$this->assertSame(1, count($v->errors('name')));
$this->assertFalse($v->errors('name'));
}
public function testArrayOfFieldsToValidate()
{
Expand Down
2 changes: 1 addition & 1 deletion tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
$loader = require __DIR__.'/../vendor/autoload.php';
}

require_once __DIR__ . '/Valitron/BaseTestCase.php';
require_once __DIR__ . '/Valitron/BaseTestCase.php';

0 comments on commit 3c54633

Please sign in to comment.