Skip to content

Commit 5ebd5d7

Browse files
Merge pull request #344 from vlucas/issue-326
Test against PHP 8
2 parents ba90097 + f189549 commit 5ebd5d7

File tree

7 files changed

+14
-12
lines changed

7 files changed

+14
-12
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ jobs:
1717
- '7.2'
1818
- '7.3'
1919
- '7.4'
20-
# - '8.0'
21-
# - '8.1'
20+
- '8.0'
21+
# - '8.1'
2222
steps:
2323
- name: Checkout
2424
uses: actions/checkout@v2

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ composer.phar
33
composer.lock
44
vendor
55
.idea/
6+
.phpunit.result.cache

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"php": ">=5.3.2"
1717
},
1818
"require-dev": {
19-
"phpunit/phpunit": ">=4.8.35 <8"
19+
"phpunit/phpunit": ">=4.8.35"
2020
},
2121
"suggest": {
2222
"ext-mbstring": "It can support the multiple bytes string length."

tests/Valitron/BaseTestCase.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@
44

55
class BaseTestCase extends TestCase
66
{
7-
public function setUp()
8-
{
9-
}
107

8+
/*
119
public function tearDown()
1210
{
1311
$this->resetProperty('_lang');
@@ -23,4 +21,5 @@ protected function resetProperty($name, $value = null)
2321
$prop->setValue($value);
2422
$prop->setAccessible(false);
2523
}
24+
*/
2625
}

tests/Valitron/LangTest.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ public function testLangDefinedStatically()
1515
{
1616
$lang = 'ar';
1717
Validator::lang($lang);
18-
$validator = new Validator(array());
1918
$this->assertEquals($lang, Validator::lang());
19+
Validator::lang('en');
2020
}
2121

2222
/**
@@ -42,13 +42,15 @@ public function testDefaultLangDirShouldBePackageLangDir()
4242
$this->assertEquals(realpath($this->getLangDir()), realpath(Validator::langDir()));
4343
}
4444

45-
/**
46-
* @expectedException InvalidArgumentException
47-
* @expectedExceptionMessage Fail to load language file '/this/dir/does/not/exists/en.php'
48-
*/
45+
4946
public function testLangException()
5047
{
48+
try{
5149
new Validator(array(), array(), 'en', '/this/dir/does/not/exists');
50+
} catch (Exception $exception){
51+
$this->assertInstanceOf("InvalidArgumentException", $exception);
52+
$this->assertEquals("Fail to load language file '/this/dir/does/not/exists/en.php'", $exception->getMessage());
53+
}
5254
}
5355

5456

tests/Valitron/StaticVsInstanceTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ public function testInstanceOverrideStaticLang()
1010
$this->assertEquals(
1111
'ar', Validator::lang(), 'instance defined lang should not replace static global lang'
1212
);
13+
Validator::lang('en');
1314
}
1415

1516
/**

tests/Valitron/ValidateTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
class ValidateTest extends BaseTestCase
66
{
7-
87
public function testValidWithNoRules()
98
{
109
$v = new Validator(array('name' => 'Chester Tester'));

0 commit comments

Comments
 (0)