Skip to content

Commit

Permalink
update phpunit
Browse files Browse the repository at this point in the history
  • Loading branch information
TomK committed Dec 8, 2021
1 parent e19315a commit 30ab057
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
}
],
"require": {
"php": ">=7.1",
"php": ">=7.3",
"ext-json": "*"
},
"require-dev": {
"phpunit/phpunit": "~7.5"
"phpunit/phpunit": "~9"
},
"autoload": {
"psr-4": {
Expand Down
13 changes: 5 additions & 8 deletions tests/ArrayValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
namespace Packaged\Validate\Tests;

use Packaged\Validate\Validation;
use Packaged\Validate\ValidationException;
use Packaged\Validate\Validators\ArrayValidator;
use Packaged\Validate\Validators\IntegerValidator;
use Packaged\Validate\Validators\StringValidator;
Expand Down Expand Up @@ -33,22 +34,18 @@ public function testIntArray($testArray, $expectedValid)
$this->assertEquals($expectedValid, $validator->isValid($testArray));
}

/**
* @expectedException \Packaged\Validate\ValidationException
* @expectedExceptionMessage must be an array
*/
public function testNotArray()
{
$this->expectException(ValidationException::class);
$this->expectExceptionMessage('must be an array');
$validator = new ArrayValidator(new StringValidator());
$validator->assert('string');
}

/**
* @expectedException \Packaged\Validate\ValidationException
* @expectedExceptionMessage must contain at least 2 items
*/
public function testSubValidator()
{
$this->expectException(ValidationException::class);
$this->expectExceptionMessage('must contain at least 2 items');
$validator = new ArrayValidator(new IntegerValidator(3, 5), 2, 2);
$this->assertEquals(true, $validator->isValid([3, 5]));

Expand Down

0 comments on commit 30ab057

Please sign in to comment.