function testSave() { //Arrange $name = "Math"; $id = 1; $test_department = new Department($name, $id); $test_department->save(); //Act $result = Department::getAll(); //Assert $this->assertEquals($test_department, $result[0]); }
static function find($search_id) { $found_department = null; $department = Department::getAll(); foreach ($department as $department) { $department_id = $department->getId(); if ($department_id == $search_id) { $found_department = $department; } } return $found_department; }
static function find($search_id) { $found_department = null; $all_deps = Department::getAll(); foreach ($all_deps as $dep) { if ($dep->getId() == $search_id) { $found_department = $dep; } } return $found_department; }
require_once $root_path . 'include/care_api_classes/class_department.php'; require_once $root_path . 'include/inc_config_color.php'; // load color preferences $breakfile = 'nursing.php?sid=' . $sid . '&lang=' . $lang; if ($pday == '') { $pday = date('d'); } if ($pmonth == '') { $pmonth = date('m'); } if ($pyear == '') { $pyear = date('Y'); } $t_date = $pday . '.' . $pmonth . '.' . $pyear; $dept_obj = new Department(); $deptarray = $dept_obj->getAll(); $depttypes = $dept_obj->getTypes(); $dept = $dept_obj->getDeptAllInfo($dept_nr); while (list($x, $v) = each($dept)) { ${$x} = $v; } $dept_info = $dept_obj->getTypeInfo($dept['type']); ?> <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.0//EN" "html.dtd"> <HTML> <HEAD> <?php echo setCharSet(); ?>
function test_delete() { //Arrange $name = "Biology"; $address = "346 Stupid Avenue"; $test_department = new Department($name, $address); $test_department->save(); $name2 = "Chemiology"; $address2 = "55 Bo Ct"; $test_department2 = new Department($name2, $address2); $test_department2->save(); //Act $test_department->delete(); //Assert $result = Department::getAll(); $this->assertEquals([$test_department2], $result); }
* elpidio@care2x.org, * * See the file "copy_notice.txt" for the licence notice */ $thisfile = basename($_SERVER['PHP_SELF']); if (!isset($mode)) { $mode = 'show'; } elseif ($mode == 'create' || $mode == 'update') { } $lang_tables = array('departments.php'); require './include/init_show.php'; if ($parent_admit) { $sql = "SELECT dr.*, e.encounter_class_nr FROM care_encounter AS e, care_person AS p, care_encounter_diagnostics_report AS dr \n\t\tWHERE p.pid=" . $_SESSION['sess_pid'] . " \n\t\t\tAND p.pid=e.pid \n\t\t\tAND e.encounter_nr=" . $_SESSION['sess_en'] . " \n\t\t\tAND e.encounter_nr=dr.encounter_nr \n\t\tORDER BY dr.create_time DESC"; } else { $sql = "SELECT dr.*, e.encounter_class_nr FROM care_encounter AS e, care_person AS p, care_encounter_diagnostics_report AS dr \n\t\tWHERE p.pid=" . $_SESSION['sess_pid'] . " AND p.pid=e.pid AND e.encounter_nr=dr.encounter_nr \n\t\tORDER BY dr.create_time DESC"; } if ($result = $db->Execute($sql)) { $rows = $result->RecordCount(); include_once $root_path . 'include/care_api_classes/class_department.php'; $dept_obj = new Department(); $depts_array =& $dept_obj->getAll(); } else { echo $sql; } $subtitle = $LDDiagXResults; $notestype = 'diagnostics'; $_SESSION['sess_file_return'] = $thisfile; $buffer = str_replace('~tag~', $title . ' ' . $name_last, $LDNoRecordFor); $norecordyet = str_replace('~obj~', strtolower($subtitle), $buffer); /* Load GUI page */ require './gui_bridge/default/gui_show.php';