public function testDayCountConventionInvalid() { $this->setExpectedException('Exception', ErrorMessages::getDayCountConventionNotDefinedMessage()); $availableDayCountConventions = Config::getConfigField('available_day_count_conventions'); $dayCountConvention = Config::getConfigField('day_count_convention'); Config::setConfigField('available_day_count_conventions', ['faulty']); Config::setConfigField('day_count_convention', 'faulty'); TimeUtils::getCurrentDayCountConvention(); Config::setConfigField('available_day_count_conventions', $availableDayCountConventions); Config::setConfigField('day_count_convention', $dayCountConvention); }
/** * @return string * @throws Exception */ public function getInterestDivisor() { return MathFuncs::div(TimeUtils::getCurrentDayCountConvention()['days_in_a_year'], MathFuncs::mul($this->annualInterestRate, 100)); }
/** * @return string [Length of the debt in months as a string] */ public function getDebtLengthInMonths() { return MathFuncs::div($this->getDebtLengthInDays(), TimeUtils::getCurrentDayCountConvention()['days_in_a_month']); }
/** * @return string * @throws Exception */ public function toMonths() { return MathFuncs::div($this->toDays(), TimeUtils::getCurrentDayCountConvention()['days_in_a_month']); }