|
| 1 | +<?php |
| 2 | + |
| 3 | +/** |
| 4 | + * @copyright Copyright (C) Ibexa AS. All rights reserved. |
| 5 | + * @license For full copyright and license information view LICENSE file distributed with this source code. |
| 6 | + */ |
| 7 | +declare(strict_types=1); |
| 8 | + |
| 9 | +namespace Ibexa\Tests\Core\Specification; |
| 10 | + |
| 11 | +class AbstractSpecificationTest extends BaseSpecificationTest |
| 12 | +{ |
| 13 | + public function testSpecification(): void |
| 14 | + { |
| 15 | + $isStringSpecification = $this->getIsStringSpecification(); |
| 16 | + $isTestStringSpecification = $this->getIsTestStringSpecification(); |
| 17 | + |
| 18 | + self::assertTrue($isStringSpecification->isSatisfiedBy('test_string')); |
| 19 | + self::assertFalse($isStringSpecification->isSatisfiedBy(1234)); |
| 20 | + } |
| 21 | + |
| 22 | + public function testSpecificationAnd(): void |
| 23 | + { |
| 24 | + $isStringSpecification = $this->getIsStringSpecification(); |
| 25 | + $isTestStringSpecification = $this->getIsTestStringSpecification(); |
| 26 | + |
| 27 | + self::assertTrue($isStringSpecification->and($isTestStringSpecification)->isSatisfiedBy('test')); |
| 28 | + self::assertFalse($isStringSpecification->and($isTestStringSpecification)->isSatisfiedBy('test_string')); |
| 29 | + self::assertFalse($isStringSpecification->and($isTestStringSpecification)->isSatisfiedBy(1234)); |
| 30 | + } |
| 31 | + |
| 32 | + public function testSpecificationOr(): void |
| 33 | + { |
| 34 | + $isStringSpecification = $this->getIsStringSpecification(); |
| 35 | + $isTestStringSpecification = $this->getIsTestStringSpecification(); |
| 36 | + |
| 37 | + self::assertTrue($isStringSpecification->or($isTestStringSpecification)->isSatisfiedBy('test')); |
| 38 | + self::assertTrue($isStringSpecification->or($isTestStringSpecification)->isSatisfiedBy('test_string')); |
| 39 | + self::assertFalse($isStringSpecification->or($isTestStringSpecification)->isSatisfiedBy(1234)); |
| 40 | + } |
| 41 | + |
| 42 | + public function testSpecificationNot(): void |
| 43 | + { |
| 44 | + $isStringSpecification = $this->getIsStringSpecification(); |
| 45 | + |
| 46 | + self::assertFalse($isStringSpecification->not()->isSatisfiedBy('test_string')); |
| 47 | + self::assertTrue($isStringSpecification->not()->isSatisfiedBy(1234)); |
| 48 | + } |
| 49 | +} |
0 commit comments