1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* This file is part of graze/config-validation. |
4
|
|
|
* |
5
|
|
|
* Copyright (c) 2017 Nature Delivered Ltd. <https://www.graze.com> |
6
|
|
|
* |
7
|
|
|
* For the full copyright and license information, please view the LICENSE |
8
|
|
|
* file that was distributed with this source code. |
9
|
|
|
* |
10
|
|
|
* @license https://github.com/graze/config-validation/blob/master/LICENSE.md |
11
|
|
|
* @link https://github.com/graze/config-validation |
12
|
|
|
*/ |
13
|
|
|
|
14
|
|
|
namespace Graze\ConfigValidation\Test\Unit; |
15
|
|
|
|
16
|
|
|
use Graze\ConfigValidation\ArrayValidator; |
17
|
|
|
use Graze\ConfigValidation\ConfigValidatorInterface; |
18
|
|
|
use Graze\ConfigValidation\ObjectValidator; |
19
|
|
|
use Graze\ConfigValidation\Test\TestCase; |
20
|
|
|
use Graze\ConfigValidation\Validate; |
21
|
|
|
|
22
|
|
|
class ValidateTest extends TestCase |
23
|
|
|
{ |
24
|
|
|
public function testArr() |
25
|
|
|
{ |
26
|
|
|
$validator = Validate::arr(); |
27
|
|
|
|
28
|
|
|
$this->assertInstanceOf(ArrayValidator::class, $validator); |
29
|
|
|
$this->assertInstanceOf(ConfigValidatorInterface::class, $validator); |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
public function testObject() |
33
|
|
|
{ |
34
|
|
|
$validator = Validate::object(); |
35
|
|
|
|
36
|
|
|
$this->assertInstanceOf(ObjectValidator::class, $validator); |
37
|
|
|
$this->assertInstanceOf(ConfigValidatorInterface::class, $validator); |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
public function testArrayUnspecified() |
41
|
|
|
{ |
42
|
|
|
$validator = Validate::arr(false); |
43
|
|
|
|
44
|
|
|
$this->assertFalse($validator->isAllowUnspecified()); |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
public function testObjectUnspecified() |
48
|
|
|
{ |
49
|
|
|
$validator = Validate::object(false); |
50
|
|
|
|
51
|
|
|
$this->assertFalse($validator->isAllowUnspecified()); |
52
|
|
|
} |
53
|
|
|
} |
54
|
|
|
|