public static function run() { if ($_SERVER["REQUEST_METHOD"] == "POST") { $map = new Map($_POST); MapView::show($map->getLocations()); } else { MapView::show(null); } }
<!DOCTYPE html> <html> <head> <title>MapView Tests</title> </head> <body> <h1>MapView Tests</h1> <h3>Should call MapView::show()</h3> <hr/> <?php include_once "../includer.php"; $map = new Map(null); $map->addLocation("Rome"); MapView::show($map->getLocations()); ?> </body> </html>
<!DOCTYPE html> <html> <head> <title>Map Tests</title> </head> <body> <h1>Map Tests</h1> <?php include_once "../includer.php"; $map = new Map(null); echo "Map ID: " . $map->getMapID(); echo "<hr/>"; echo "<h3>Should add three locations to map and print</h3>"; $map->addLocation("New York"); $map->addLocation("London"); $map->addLocation("Rome"); foreach ($map->getLocations() as $location) { echo "<h4>{$location}</h4>"; } echo "<hr/>"; echo "<h3>Should remove last location and print remaining</h3>"; $map->removeLastLocation(); foreach ($map->getLocations() as $location) { echo "<h4>{$location}</h4>"; } echo "<hr/>"; ?> </body> </html>