class PenaltyCalcuationTest extends PHPUnit_Framework_TestCase{
private $_mObj = null;
/* set test values */
private $_mDeadLineYear = '2001';
private $_mAmountOwed = '1000';
/* expected result values */
private $_mFilePenalty = 250;
private $_mPayPenalty = 705;
private $_mInterestPenalty = 467.7260;
protected function setUp(){
$_POST['deadline-year'] = '2001';
$_POST['amount-owed'] = '1000';
$this->_mObj = new PenaltyCalculation;
/* Normalize interest rate */
$this->_mObj->setInterestRate( 0.04 );
/* Normalize accumulated interest penalty to this date */
$this->_mObj->setDateNow( Date('2012-12-21') );
$this->_mObj->init();
}
public function testFilePenalty(){
$this->assertEquals( $this->_mFilePenalty, $this->_mObj->mFailureToFilePenalty );
}/* End of method testFilePenalty() */
public function testPayPenalty(){
$this->assertEquals( number_format($this->_mPayPenalty, 2, '.', ''), number_format($this->_mObj->mFailureToPayPenalty, 2, '.', '') );
}/* End of method testPayPenalty() */
public function testInterestPenalty(){
$this->assertEquals( number_format($this->_mInterestPenalty, 2, '.', ''), number_format($this->_mObj->mInterestPenalty, 2, '.', '') );
}/* End of method testInterestPenalty() */
}/* End of class PenaltyCalculationTest */
$testSuite = new PHPUnit_Framework_TestSuite();
$testSuite->addTest( new PenaltyCalcuationTest( 'testFilePenalty' ) );
$testSuite->addTest( new PenaltyCalcuationTest( 'testPayPenalty' ) );
$testSuite->addTest( new PenaltyCalcuationTest( 'testInterestPenalty' ) );
PHPUnit_TextUI_TestRunner::run( $testSuite );