コード例 #1
0
ファイル: billing_tests.php プロジェクト: radicaldesigns/gtd
 function testGetBillableHours()
 {
     # with discount
     $e = new Estimate();
     $e->set(array('name' => 'i am a test!'));
     $e->save();
     # gimme yo hours!
     $ho = new Hour();
     $ho->set(array('description' => 'did some stuff', 'date' => '2010-02-25', 'hours' => '2.75', 'estimate_id' => $e->id, 'discount' => '1'));
     $ho->save();
     # gimme yo hours!
     $ho2 = new Hour();
     $ho2->set(array('description' => 'did some more stuff', 'date' => '2010-02-26', 'hours' => '3', 'estimate_id' => $e->id, 'discount' => '1'));
     $ho2->save();
     # 1.75 + 2 = 3.75
     $date_range = array('start_date' => '2010-01-01', 'end_date' => '2010-03-01');
     $billable_hours = $e->getBillableHours($date_range);
     $this->assertEqual($billable_hours, 3.75);
     #destroy!!!!!
     $e->destroyAssociatedRecords();
     $e->delete();
 }