コード例 #1
0
ファイル: LoanTest.php プロジェクト: vasildakov/LendInvest
 public function testTranchesCanBeAddedToLoan()
 {
     $loan = new Loan();
     $this->assertFalse($loan->hasTranches());
     $loan->addTranche(new Tranche());
     $loan->addTranche(new Tranche());
     $loan->addTranche(new Tranche());
     $this->assertTrue($loan->hasTranches());
     $this->assertEquals(3, count($loan->getTranches()));
 }
コード例 #2
0
ファイル: LoanTest.php プロジェクト: pliski/lend2
 /**
  * @test
  */
 public function testAddaTranche()
 {
     $start = new \DateTime("2012-07-08");
     $end = new \DateTime("2015-11-15");
     $testLoan = new Loan($start, $end);
     $aParam = array('interest' => 3, 'maxAmount' => 1000);
     $testLoan->addTranche('test', $aParam, 'Tranche');
     $this->assertInstanceOf('Lendinvest\\Model\\Products\\TrancheSimple', $testLoan->aProducts['test']);
 }
コード例 #3
0
ファイル: mainController.php プロジェクト: pliski/lend2
/**
 * Created by PhpStorm.
 * User: pliski
 * Date: 06/12/2015
 * Time: 16:45
 */
namespace Lendinvest;

use Lendinvest\Model;
//Instancing Loan and tranches
$dateStart = new \DateTime("2015-10-01");
$dateEnd = new \DateTime("2015-11-15");
$loan = new Model\Loan($dateStart, $dateEnd);
$aParams = array('interest' => 3, 'maxAmount' => 1000);
$loan->addTranche("TrancheA", $aParams);
$aParams = array('interest' => 6, 'maxAmount' => 1000);
$loan->addTranche("TrancheB", $aParams);
//Investors
$aInvestors = array();
for ($i = 1; $i <= 4; $i++) {
    $aInvestors[$i] = new Model\Investor(1000, $i);
}
//Stream option
$aInvestors[1]->addStream('Sms');
$aInvestors[2]->addStream('Sms');
$aInvestors[3]->addStream('eMail');
$aInvestors[4]->addStream('eMail');
$_SESSION['loan'] = $loan;
$_SESSION['investors'] = $aInvestors;
$action = 'invest';