function testdbWeeksModule() { //Create two weeks and add them to the database $days1 = array(); for ($i = 9; $i < 16; $i++) { $days1[] = new RMHDate(date('y-m-d', mktime(0, 0, 0, 2, $i, 2015)), "house", array(), ""); } $days2 = array(); for ($i = 16; $i < 23; $i++) { $days2[] = new RMHDate(date('y-m-d', mktime(0, 0, 0, 2, $i, 2015)), "fam", array(), ""); } $w1 = new Week($days1, "house", "archived"); $w2 = new Week($days2, "fam", "unpublished"); $this->assertTrue(insert_dbWeeks($w1)); $this->assertTrue(insert_dbWeeks($w2)); //retrieve the first Week and check its fields $w = get_dbWeeks("02-09-15:house"); $this->assertTrue($w !== false); $this->assertTrue($w->get_status() == "archived"); $this->assertTrue($w->get_venue() == "house"); $a = get_all_dbWeeks("house"); $this->assertEqual($a[0], $w1); //update the second Week by a change of status // $w2 = new Week($days2,"fam","published"); // $this->assertTrue(update_dbWeeks($w2)); // $this->assertEqual(get_dbWeeks($w2->get_id())->get_status(),"published"); //Remove the Weeks from the database $this->assertTrue(delete_dbWeeks($w1)); $this->assertTrue(delete_dbWeeks($w2)); echo "testdbWeeks complete"; }
include 'header.php'; ?> <div id="content"> <?php $venue = $_GET['venue']; include_once 'database/dbWeeks.php'; include_once 'database/dbMasterSchedule.php'; include_once 'database/dbPersons.php'; include_once 'database/dbLog.php'; include_once 'domain/Shift.php'; include_once 'domain/RMHdate.php'; include_once 'domain/Week.php'; include_once 'domain/Person.php'; // Check to see if there are already weeks in the db // connects to the database to see if there are any weeks in the dbWeeks table $result = get_all_dbWeeks($venue); // If no weeks for either the house or the family room, show first week form if (sizeof($result) == 0) { $firstweek = true; } else { $firstweek = false; } // publishes a week if the user is a manager if (!$firstweek && $_GET['publish'] && $_SESSION['access_level'] >= 2) { $id = $_GET['publish']; $week = get_dbWeeks($id); if ($week->get_status() == "unpublished") { $week->set_status("published"); } else { if ($week->get_status() == "published") { $week->set_status("unpublished");
function testget_all_dbWeeks() { $newWeek = new Week("03-30-14", "Bscah", "Active"); $nd = insert_dbWeeks($newWeek); $id = "03-30-14"; echo 'will test select_dbWeeks</br>'; $result = get_all_dbWeeks(); if ($result != null) { echo 'select_dbDates failed</br>'; } $res = delete_dbWeeks($newWeek); if ($res == null) { echo 'Delete failed</br>'; } }