Skip to content

Commit

Permalink
Merge pull request #344 from vlucas/issue-326
Browse files Browse the repository at this point in the history
Test against PHP 8
  • Loading branch information
willemwollebrants committed Jul 8, 2021
2 parents ba90097 + f189549 commit 5ebd5d7
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 12 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ composer.phar
composer.lock
vendor
.idea/
.phpunit.result.cache
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"php": ">=5.3.2"
},
"require-dev": {
"phpunit/phpunit": ">=4.8.35 <8"
"phpunit/phpunit": ">=4.8.35"
},
"suggest": {
"ext-mbstring": "It can support the multiple bytes string length."
Expand Down
5 changes: 2 additions & 3 deletions tests/Valitron/BaseTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@

class BaseTestCase extends TestCase
{
public function setUp()
{
}

/*
public function tearDown()
{
$this->resetProperty('_lang');
Expand All @@ -23,4 +21,5 @@ protected function resetProperty($name, $value = null)
$prop->setValue($value);
$prop->setAccessible(false);
}
*/
}
12 changes: 7 additions & 5 deletions tests/Valitron/LangTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ public function testLangDefinedStatically()
{
$lang = 'ar';
Validator::lang($lang);
$validator = new Validator(array());
$this->assertEquals($lang, Validator::lang());
Validator::lang('en');
}

/**
Expand All @@ -42,13 +42,15 @@ public function testDefaultLangDirShouldBePackageLangDir()
$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()
{
try{
new Validator(array(), array(), 'en', '/this/dir/does/not/exists');
} catch (Exception $exception){
$this->assertInstanceOf("InvalidArgumentException", $exception);
$this->assertEquals("Fail to load language file '/this/dir/does/not/exists/en.php'", $exception->getMessage());
}
}


Expand Down
1 change: 1 addition & 0 deletions tests/Valitron/StaticVsInstanceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public function testInstanceOverrideStaticLang()
$this->assertEquals(
'ar', Validator::lang(), 'instance defined lang should not replace static global lang'
);
Validator::lang('en');
}

/**
Expand Down
1 change: 0 additions & 1 deletion tests/Valitron/ValidateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

class ValidateTest extends BaseTestCase
{

public function testValidWithNoRules()
{
$v = new Validator(array('name' => 'Chester Tester'));
Expand Down

0 comments on commit 5ebd5d7

Please sign in to comment.