| @@ 15-60 (lines=46) @@ | ||
| 12 | * @author Kristjan Siimson <[email protected]> |
|
| 13 | * @package Evaluator\Tests |
|
| 14 | */ |
|
| 15 | class LogicalAndTest extends LogicalEvaluatorTest |
|
| 16 | { |
|
| 17 | /** |
|
| 18 | * @var Evaluator |
|
| 19 | */ |
|
| 20 | private $firstMock; |
|
| 21 | ||
| 22 | /** |
|
| 23 | * @var Evaluator |
|
| 24 | */ |
|
| 25 | private $secondMock; |
|
| 26 | ||
| 27 | /** |
|
| 28 | * @uses Evaluator |
|
| 29 | */ |
|
| 30 | public function setUp() |
|
| 31 | { |
|
| 32 | $this->firstMock = $this->createMock(); |
|
| 33 | $this->secondMock = $this->createMock(); |
|
| 34 | } |
|
| 35 | ||
| 36 | /** |
|
| 37 | * @dataProvider logicalAndProvider |
|
| 38 | * @param bool $result |
|
| 39 | * @param bool $left |
|
| 40 | * @param bool $right |
|
| 41 | */ |
|
| 42 | public function testLogicalAndIsTrueIfBothSidesAreTrue($result, $left, $right) |
|
| 43 | { |
|
| 44 | $this->mockReturns($this->firstMock, $left); |
|
| 45 | $this->mockReturns($this->secondMock, $right); |
|
| 46 | ||
| 47 | $evaluator = new LogicalAnd($this->firstMock, $this->secondMock); |
|
| 48 | $this->assertEquals($result, $evaluator->is('2014-01-01')); |
|
| 49 | } |
|
| 50 | ||
| 51 | public function logicalAndProvider() |
|
| 52 | { |
|
| 53 | return array( |
|
| 54 | array(true, true, true), |
|
| 55 | array(false, true, false), |
|
| 56 | array(false, false, false), |
|
| 57 | array(false, false, true) |
|
| 58 | ); |
|
| 59 | } |
|
| 60 | } |
|
| 61 | } |
|
| @@ 15-60 (lines=46) @@ | ||
| 12 | * @author Kristjan Siimson <[email protected]> |
|
| 13 | * @package Evaluator\Tests |
|
| 14 | */ |
|
| 15 | class LogicalOrTest extends LogicalEvaluatorTest |
|
| 16 | { |
|
| 17 | /** |
|
| 18 | * @var Evaluator |
|
| 19 | */ |
|
| 20 | protected $firstMock; |
|
| 21 | ||
| 22 | /** |
|
| 23 | * @var Evaluator |
|
| 24 | */ |
|
| 25 | protected $secondMock; |
|
| 26 | ||
| 27 | /** |
|
| 28 | * @uses Evaluator |
|
| 29 | */ |
|
| 30 | public function setUp() |
|
| 31 | { |
|
| 32 | $this->firstMock = $this->createMock(); |
|
| 33 | $this->secondMock = $this->createMock(); |
|
| 34 | } |
|
| 35 | ||
| 36 | /** |
|
| 37 | * @dataProvider logicalOrProvider |
|
| 38 | * @param bool $result |
|
| 39 | * @param bool $left |
|
| 40 | * @param bool $right |
|
| 41 | */ |
|
| 42 | public function testLogicalAndIsTrueIfBothSidesAreTrue($result, $left, $right) |
|
| 43 | { |
|
| 44 | $this->mockReturns($this->firstMock, $left); |
|
| 45 | $this->mockReturns($this->secondMock, $right); |
|
| 46 | ||
| 47 | $evaluator = new LogicalOr($this->firstMock, $this->secondMock); |
|
| 48 | $this->assertEquals($result, $evaluator->is('2014-01-01')); |
|
| 49 | } |
|
| 50 | ||
| 51 | public function logicalOrProvider() |
|
| 52 | { |
|
| 53 | return array( |
|
| 54 | array(true, true, true), |
|
| 55 | array(true, true, false), |
|
| 56 | array(false, false, false), |
|
| 57 | array(true, false, true) |
|
| 58 | ); |
|
| 59 | } |
|
| 60 | } |
|
| 61 | } |
|