| @@ 41-58 (lines=18) @@ | ||
| 38 | /** |
|
| 39 | * Test andX. |
|
| 40 | */ |
|
| 41 | public function testAndX() |
|
| 42 | { |
|
| 43 | $this |
|
| 44 | ->given( |
|
| 45 | /** @var \Cubiche\Core\Specification\SpecificationInterface $specification */ |
|
| 46 | $specification = $this->newDefaultTestedInstance(), |
|
| 47 | $other = $this->newRandomSpecification() |
|
| 48 | ) |
|
| 49 | ->then() |
|
| 50 | ->when($andSpecification = $specification->andX($other)) |
|
| 51 | ->object($andSpecification) |
|
| 52 | ->isInstanceOf(AndSpecification::class) |
|
| 53 | ->object($andSpecification->left()) |
|
| 54 | ->isIdenticalTo($specification) |
|
| 55 | ->object($andSpecification->right()) |
|
| 56 | ->isIdenticalTo($other) |
|
| 57 | ; |
|
| 58 | } |
|
| 59 | ||
| 60 | /** |
|
| 61 | * Test orX. |
|
| @@ 63-80 (lines=18) @@ | ||
| 60 | /** |
|
| 61 | * Test orX. |
|
| 62 | */ |
|
| 63 | public function testOrX() |
|
| 64 | { |
|
| 65 | $this |
|
| 66 | ->given( |
|
| 67 | /** @var \Cubiche\Core\Specification\SpecificationInterface $specification */ |
|
| 68 | $specification = $this->newDefaultTestedInstance(), |
|
| 69 | $other = $this->newRandomSpecification() |
|
| 70 | ) |
|
| 71 | ->then() |
|
| 72 | ->when($orSpecification = $specification->orX($other)) |
|
| 73 | ->object($orSpecification) |
|
| 74 | ->isInstanceOf(OrSpecification::class) |
|
| 75 | ->object($orSpecification->left()) |
|
| 76 | ->isIdenticalTo($specification) |
|
| 77 | ->object($orSpecification->right()) |
|
| 78 | ->isIdenticalTo($other) |
|
| 79 | ; |
|
| 80 | } |
|
| 81 | ||
| 82 | /** |
|
| 83 | * Test magic and/or. |
|