mirror of
https://github.com/vlucas/valitron.git
synced 2025-12-30 23:01:52 +00:00
commit
5ebd5d7af8
4
.github/workflows/test.yml
vendored
4
.github/workflows/test.yml
vendored
@ -17,8 +17,8 @@ jobs:
|
|||||||
- '7.2'
|
- '7.2'
|
||||||
- '7.3'
|
- '7.3'
|
||||||
- '7.4'
|
- '7.4'
|
||||||
# - '8.0'
|
- '8.0'
|
||||||
# - '8.1'
|
# - '8.1'
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|||||||
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,3 +3,4 @@ composer.phar
|
|||||||
composer.lock
|
composer.lock
|
||||||
vendor
|
vendor
|
||||||
.idea/
|
.idea/
|
||||||
|
.phpunit.result.cache
|
||||||
@ -16,7 +16,7 @@
|
|||||||
"php": ">=5.3.2"
|
"php": ">=5.3.2"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"phpunit/phpunit": ">=4.8.35 <8"
|
"phpunit/phpunit": ">=4.8.35"
|
||||||
},
|
},
|
||||||
"suggest": {
|
"suggest": {
|
||||||
"ext-mbstring": "It can support the multiple bytes string length."
|
"ext-mbstring": "It can support the multiple bytes string length."
|
||||||
|
|||||||
@ -4,10 +4,8 @@ use PHPUnit\Framework\TestCase;
|
|||||||
|
|
||||||
class BaseTestCase extends TestCase
|
class BaseTestCase extends TestCase
|
||||||
{
|
{
|
||||||
public function setUp()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/*
|
||||||
public function tearDown()
|
public function tearDown()
|
||||||
{
|
{
|
||||||
$this->resetProperty('_lang');
|
$this->resetProperty('_lang');
|
||||||
@ -23,4 +21,5 @@ class BaseTestCase extends TestCase
|
|||||||
$prop->setValue($value);
|
$prop->setValue($value);
|
||||||
$prop->setAccessible(false);
|
$prop->setAccessible(false);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,8 +15,8 @@ class LangTest extends BaseTestCase
|
|||||||
{
|
{
|
||||||
$lang = 'ar';
|
$lang = 'ar';
|
||||||
Validator::lang($lang);
|
Validator::lang($lang);
|
||||||
$validator = new Validator(array());
|
|
||||||
$this->assertEquals($lang, Validator::lang());
|
$this->assertEquals($lang, Validator::lang());
|
||||||
|
Validator::lang('en');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -42,13 +42,15 @@ class LangTest extends BaseTestCase
|
|||||||
$this->assertEquals(realpath($this->getLangDir()), realpath(Validator::langDir()));
|
$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()
|
public function testLangException()
|
||||||
{
|
{
|
||||||
|
try{
|
||||||
new Validator(array(), array(), 'en', '/this/dir/does/not/exists');
|
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());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -10,6 +10,7 @@ class StaticVsInstanceTest extends BaseTestCase
|
|||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
'ar', Validator::lang(), 'instance defined lang should not replace static global lang'
|
'ar', Validator::lang(), 'instance defined lang should not replace static global lang'
|
||||||
);
|
);
|
||||||
|
Validator::lang('en');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -4,7 +4,6 @@ use Valitron\Validator;
|
|||||||
|
|
||||||
class ValidateTest extends BaseTestCase
|
class ValidateTest extends BaseTestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
public function testValidWithNoRules()
|
public function testValidWithNoRules()
|
||||||
{
|
{
|
||||||
$v = new Validator(array('name' => 'Chester Tester'));
|
$v = new Validator(array('name' => 'Chester Tester'));
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user