function testGetHours() { $sc = new SupportContract(); $sc->set(array('domain_name' => 'Test', 'start_date' => '2010-01-01', 'end_date' => '2010-04-30', 'hourly_rate' => '120', 'support_hours' => '.5', 'monthly_rate' => '50')); $sc->save(); $h = new Hour(); $h->set(array('description' => 'Test', 'support_contract_id' => $sc->id, 'date' => '2010-02-20', 'hours' => '2.5')); $h->save(); $date_range = array('end_date' => '2010-03-31'); #Make sure we are getting the hours $hours = $sc->getHours(array('date_range' => $date_range)); $this->assertTrue(is_array($hours)); $this->assertEqual(count($hours), 1); $hour = array_pop($hours); $this->assertEqual(get_class($hour), 'Hour'); $this->assertEqual($hour->getBillableHours(), 2.5); ## clean up $sc->destroyAssociatedRecords(); $sc->delete(); }