public function testReduceOnCalc() { $param = new Calc('1d6'); $actual = CalcOperation::reduce($param); $this->assertTrue(($actual >= 1)); $this->assertTrue(($actual <= 6)); }
/** * @dataProvider dataForAdd * * @param $num1 * @param $num2 * @param $expected */ public function testAdd($num1, $num2, $expected) { $actual = CalcOperation::calc('+', $num1, $num2); $this->assertSame($expected, $actual); }
/** * @dataProvider dataForGreaterThan * * @param $num1 * @param $num2 * @param $expected */ public function testGreaterThan($num1, $num2, $expected) { $actual = CalcOperation::calc('>', $num1, $num2); $this->assertSame($expected, $actual); }
/** * @expectedException \Exception */ public function testCalcUnknownOperator() { CalcOperation::calc('?', 1, 2); }
/** * @dataProvider dataForAddNaN * @param $num1 * @param $num2 * @expectedException \Exception * @expectedExceptionMessage This is not a number */ public function testAddNaN($num1, $num2) { CalcOperation::calc('+', $num1, $num2); }