make tests compatible with phpunit for php8

This commit is contained in:
Willem Wollebrants 2021-07-07 11:44:08 +02:00
parent d12a77deed
commit da91bdea70
7 changed files with 11 additions and 12 deletions

View File

@ -17,8 +17,8 @@ jobs:
- '7.2'
- '7.3'
- '7.4'
# - '8.0'
# - '8.1'
- '8.0'
- '8.1'
steps:
- name: Checkout
uses: actions/checkout@v2

1
.gitignore vendored
View File

@ -3,3 +3,4 @@ composer.phar
composer.lock
vendor
.idea/
.phpunit.result.cache

View File

@ -16,7 +16,7 @@
"php": ">=5.3.2"
},
"require-dev": {
"phpunit/phpunit": ">=4.8.35 <8"
"phpunit/phpunit": ">=4.8.35 <9"
},
"suggest": {
"ext-mbstring": "It can support the multiple bytes string length."

View File

@ -4,10 +4,8 @@ use PHPUnit\Framework\TestCase;
class BaseTestCase extends TestCase
{
public function setUp()
{
}
/*
public function tearDown()
{
$this->resetProperty('_lang');
@ -23,4 +21,5 @@ class BaseTestCase extends TestCase
$prop->setValue($value);
$prop->setAccessible(false);
}
*/
}

View File

@ -15,8 +15,8 @@ class LangTest extends BaseTestCase
{
$lang = 'ar';
Validator::lang($lang);
$validator = new Validator(array());
$this->assertEquals($lang, Validator::lang());
Validator::lang('en');
}
/**
@ -42,12 +42,11 @@ class LangTest extends BaseTestCase
$this->assertEquals(realpath($this->getLangDir()), realpath(Validator::langDir()));
}
/**
* @expectedException InvalidArgumentException
* @expectedExceptionMessage Fail to load language file '/this/dir/does/not/exists/en.php'
*/
public function testLangException()
{
$this->expectException("InvalidArgumentException");
$this->expectExceptionMessage("Fail to load language file '/this/dir/does/not/exists/en.php'");
new Validator(array(), array(), 'en', '/this/dir/does/not/exists');
}

View File

@ -10,6 +10,7 @@ class StaticVsInstanceTest extends BaseTestCase
$this->assertEquals(
'ar', Validator::lang(), 'instance defined lang should not replace static global lang'
);
Validator::lang('en');
}
/**

View File

@ -4,7 +4,6 @@ use Valitron\Validator;
class ValidateTest extends BaseTestCase
{
public function testValidWithNoRules()
{
$v = new Validator(array('name' => 'Chester Tester'));