public function testAddDeleteGenre() { $all_genres = get_all_genres(); $this->assertTrue(sizeof($all_genres) > 0, "there should be genres"); $this->assertTrue(is_numeric(array_search($this->genre, $all_genres)), "{$this->genre} must be there"); }
session_start(); require_once "dvd-util.php"; require_once "dvd-db.php"; ensure_authenticated(); if (array_key_exists('title', $_GET)) { $title = ""; if (array_key_exists('title', $_GET)) { $title = $_GET['title']; } else { error("Did you select a DVD?"); return 1; } include "../dvd-lib-common/head.php"; echo "<h2>Please make any necessary changes below</h2><br />"; $the_dvd = get_dvd_by_title($title); $all_genres = get_all_genres(); $_SESSION['dvd_title'] = $the_dvd[0]; if ($the_dvd[0] == $_SESSION['last_edit']) { echo "<b>DVD Updated!</b><br/>\n"; $_SESSION['last_edit'] = NULL; } $title = $the_dvd[0]; $release_year = $the_dvd[1]; $director = $the_dvd[2]; $rating = $the_dvd[3]; $genre = $the_dvd[4]; $genre_option_list = ""; foreach ($all_genres as $g) { $selected = ""; if ($g == $genre) { $selected = " selected ";