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