public function setUp() { $definition = new InputDefinition([new InputArgument('investment', InputArgument::OPTIONAL), new InputArgument('interest', InputArgument::OPTIONAL), new InputArgument('years', InputArgument::OPTIONAL)]); $this->input = new ArgvInput(['', '10000', '2.5', '10'], $definition); $calculation = new CalculateInterest(); $this->calculateInterest = $calculation->getInvestmentResults($this->input); }
public function testResultForYearEight() { $calculateInterest = new CalculateInterest(); $results = $calculateInterest->getInvestmentResults($this->input); $profitYearEight = number_format($results[8]['profit'], 2, '.', ''); $balanceYearEight = number_format($results[8]['accountTotal'], 2, '.', ''); $expectedProfit = 297.17; $expectedBalance = 12184.03; $this->assertEquals($expectedProfit, $profitYearEight); $this->assertEquals($expectedBalance, $balanceYearEight); }