public function testGetCostOfAttendance_HasItems_ReturnsItem()
 {
     $key = CostOfAttendanceEstimator::getCostOfAttendanceKey(EducationLevel::Graduate, HousingOption::OffCampus);
     $coa = new CostOfAttendance();
     $coaItem = new CostOfAttendanceItem();
     $coaItem->value = 100;
     $coa->items[] = $coaItem;
     $constants = array();
     $constants[$key] = $coa;
     $estimator = new CostOfAttendanceEstimator($constants);
     $testCoa = $estimator->getCostOfAttendance(EducationLevel::Graduate, HousingOption::OffCampus);
     $this->assertEquals(100, $coa->items[0]->value);
 }
 public static function getCostOfAttendanceEstimator($key)
 {
     // Construct constants object
     $constantType = 'AidEstimationConstants' . $key;
     require_once self::$constantsPath . $constantType . '.php';
     $constants = new $constantType();
     $coaList = array();
     // Loop through the Education Levels
     foreach ($constants->costOfAttendanceValues as $educationLevel => $housingCoaValues) {
         // Parse Education Level
         if ($educationLevel == "graduate") {
             $currEducationLevel = EducationLevel::Graduate;
         } elseif ($educationLevel == "undergraduate") {
             $currEducationLevel = EducationLevel::Undergraduate;
         } else {
             // Invalid education level
             continue;
         }
         // Loop through the Housing Options
         foreach ($housingCoaValues as $housingOption => $coaItems) {
             // Parse Housing Option
             if ($housingOption == "oncampus") {
                 $currHousingOption = HousingOption::OnCampus;
             } elseif ($housingOption == "offcampus") {
                 $currHousingOption = HousingOption::OffCampus;
             } elseif ($housingOption == "commuter") {
                 $currHousingOption = HousingOption::Commuter;
             } else {
                 // Invalid housing option
                 continue;
             }
             $coa = new CostOfAttendance();
             // Loop through the Cost of Attendance Items
             foreach ($coaItems as $name => $info) {
                 $coaItem = new CostOfAttendanceItem();
                 $coaItem->name = $name;
                 $coaItem->value = $info['value'];
                 $coaItem->description = $info['description'];
                 $coa->items[] = $coaItem;
             }
             $key = CostOfAttendanceEstimator::getCostOfAttendanceKey($currEducationLevel, $currHousingOption);
             $coaList[$key] = $coa;
         }
     }
     return new CostOfAttendanceEstimator($coaList);
 }