public function testGetDaysFromMonths() { $this->assertEquals($this->DAYS, TimeUtils::getDaysFromMonths($this->MONTHS)); }
/** * @param array $resultArray */ private function processArray(array $resultArray) { $this->assertEquals("40000", $resultArray["debtPrincipal"]); $this->assertEquals("6", $resultArray["debtNoOfCompoundingPeriods"]); $this->assertEquals(MathFuncs::div($resultArray["debtPeriodLength"]["days"], TimeUtils::getDaysFromYears(1)), $resultArray["debtPeriodLength"]["years"]); $this->assertEquals(MathFuncs::div($resultArray["debtPeriodLength"]["days"], TimeUtils::getDaysFromMonths(1)), $resultArray["debtPeriodLength"]["months"]); $this->assertEquals(MathFuncs::div($resultArray["debtLength"]["days"], TimeUtils::getDaysFromYears(1)), $resultArray["debtLength"]["years"]); $this->assertEquals(MathFuncs::div($resultArray["debtLength"]["days"], TimeUtils::getDaysFromMonths(1)), $resultArray["debtLength"]["months"]); $this->assertEquals("0.12", $resultArray["debtInterest"]); $repayments = $resultArray["debtRepayments"]; $INDIVIDUAL_REPAYMENT = "9729.03"; $this->assertEquals("4929.03", round($repayments[1]["principalAmount"], 2)); $this->assertEquals("4800.00", round($repayments[1]["interestAmount"], 2)); $this->assertEquals($INDIVIDUAL_REPAYMENT, round($repayments[1]["totalAmount"], 2)); $this->assertEquals("5520.51", round($repayments[2]["principalAmount"], 2)); $this->assertEquals("4208.52", round($repayments[2]["interestAmount"], 2)); $this->assertEquals($INDIVIDUAL_REPAYMENT, round($repayments[2]["totalAmount"], 2)); $this->assertEquals("6182.97", round($repayments[3]["principalAmount"], 2)); $this->assertEquals("3546.06", round($repayments[3]["interestAmount"], 2)); $this->assertEquals($INDIVIDUAL_REPAYMENT, round($repayments[3]["totalAmount"], 2)); $this->assertEquals("6924.93", round($repayments[4]["principalAmount"], 2)); $this->assertEquals("2804.10", round($repayments[4]["interestAmount"], 2)); $this->assertEquals($INDIVIDUAL_REPAYMENT, round($repayments[4]["totalAmount"], 2)); $this->assertEquals("7755.92", round($repayments[5]["principalAmount"], 2)); $this->assertEquals("1973.11", round($repayments[5]["interestAmount"], 2)); $this->assertEquals($INDIVIDUAL_REPAYMENT, round($repayments[5]["totalAmount"], 2)); $this->assertEquals("8686.63", round($repayments[6]["principalAmount"], 2)); $this->assertEquals("1042.4", round($repayments[6]["interestAmount"], 2)); $this->assertEquals($INDIVIDUAL_REPAYMENT, round($repayments[6]["totalAmount"], 2)); }
/** * @return string * @throws Exception */ public function toDays() { $yearsComponent = TimeUtils::getDaysFromYears($this->getYearsComponent()); $monthsComponent = TimeUtils::getDaysFromMonths($this->getMonthsComponent()); return MathFuncs::add(MathFuncs::add($yearsComponent, $monthsComponent), $this->getDaysComponent()); }