/** * @param int $roundingMode The rounding mode. * @param BigDecimal $number The number to round. * @param string $divisor The divisor. * @param string|null $two The expected rounding to a scale of two, or null if an exception is expected. * @param string|null $one The expected rounding to a scale of one, or null if an exception is expected. * @param string|null $zero The expected rounding to a scale of zero, or null if an exception is expected. */ private function doTestRoundingMode($roundingMode, BigDecimal $number, $divisor, $two, $one, $zero) { foreach ([$zero, $one, $two] as $scale => $expected) { if ($expected === null) { $this->setExpectedException(RoundingNecessaryException::class); } $actual = $number->dividedBy($divisor, $scale, $roundingMode); if ($expected !== null) { $this->assertBigDecimalInternalValues($expected, $scale, $actual); } } }