-
-
Notifications
You must be signed in to change notification settings - Fork 53
Expand file tree
/
Copy pathOrxTest.php
More file actions
42 lines (32 loc) · 1.19 KB
/
OrxTest.php
File metadata and controls
42 lines (32 loc) · 1.19 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
41
42
<?php
declare(strict_types=1);
namespace Arkitect\Tests\Unit\Expressions\Boolean;
use Arkitect\Analyzer\ClassDescriptionBuilder;
use Arkitect\Expression\Boolean\Orx;
use Arkitect\Expression\ForClasses\Extend;
use Arkitect\Rules\Violations;
use PHPUnit\Framework\TestCase;
final class OrxTest extends TestCase
{
public function test_it_should_throw_exception_if_no_expressions_provided(): void
{
$this->expectException(\InvalidArgumentException::class);
new Orx([]);
}
public function test_it_should_throw_exception_if_only_one_expression_provided(): void
{
$this->expectException(\InvalidArgumentException::class);
new Orx([new Extend('My\BaseClass')]);
}
public function test_it_should_return_no_violation_on_success(): void
{
$or = new Orx([new Extend('My\BaseClass'), new Extend('Your\OtherClass')]);
$classDescription = (new ClassDescriptionBuilder())
->setClassName('My\Class')
->setExtends('My\BaseClass', 10)
->build();
$violations = new Violations();
$or->evaluate($classDescription, $violations, 'because');
self::assertEquals(0, $violations->count());
}
}