generated from yiisoft/package-template
-
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathDefinitionValidatorTest.php
More file actions
40 lines (33 loc) · 1.25 KB
/
DefinitionValidatorTest.php
File metadata and controls
40 lines (33 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
declare(strict_types=1);
namespace Yiisoft\Definitions\Tests\Php8_4\AsymmetricVisibility;
use PHPUnit\Framework\TestCase;
use Yiisoft\Definitions\Exception\InvalidConfigException;
use Yiisoft\Definitions\Helpers\DefinitionValidator;
final class DefinitionValidatorTest extends TestCase
{
public function testPrivateSet(): void
{
$definition = [
'class' => PublicGet::class,
'$privateVar' => 'test',
];
$this->expectException(InvalidConfigException::class);
$this->expectExceptionMessage(
'Invalid definition: property "Yiisoft\Definitions\Tests\Php8_4\AsymmetricVisibility\PublicGet::$privateVar" must be public and writable.',
);
DefinitionValidator::validate($definition);
}
public function testProtectedSet(): void
{
$definition = [
'class' => PublicGet::class,
'$protectedVar' => 'test',
];
$this->expectException(InvalidConfigException::class);
$this->expectExceptionMessage(
'Invalid definition: property "Yiisoft\Definitions\Tests\Php8_4\AsymmetricVisibility\PublicGet::$protectedVar" must be public and writable.',
);
DefinitionValidator::validate($definition);
}
}