static function testSpot() { $logout = User::logout(); $spot = new Spot(); $uid = $_SESSION["uid"] = "378984"; if (($create = $spot->createSpot()) !== NULL) { echo 'CREATE SPOT: <font color="green">STWORZONO: ' . $create . '</font></br>'; } else { echo 'CREATE SPOT: <font color="red">ERROR!</font></br>'; return false; } if ($spot->getSpots() !== NULL) { echo 'GET SPOTS: <font color="green">ODNALEZIONO</font></br>'; } else { echo 'GET SPOTS: <font color="red">ERROR!</font></br>'; return false; } if ($spot->getSpotsByUser() !== NULL) { echo 'GET SPOTS BY USER: <font color="green">ODNALEZIONO</font></br>'; } else { echo 'GET SPOTS BY USER: <font color="red">ERROR!</font></br>'; return false; } if ($spot->getSpotById($create) !== NULL) { echo 'GET SPOTS BY ID: <font color="green">ODNALEZIONO</font></br>'; } else { echo 'GET SPOTS BY ID: <font color="red">ERROR!</font></br>'; return false; } $spot = $spot->getSpotById($create); $oldMapIcon = $spot->map_icon; $oldBanner = $spot->map_banner; $oldLat = $spot->lat; $oldLng = $spot->lng; $oldAddress = $spot->address; $string = self::generateRandomString(); $spot->updateTitle($string); $spot = $spot->getSpotById($create); if ($spot->title == $string) { echo 'UPDATE TITLE: <font color="green">UDANE</font></br>'; } else { echo 'UPDATE TITLE: <font color="red">ERROR!</font></br>'; return false; } $spot->updateMapIcon("312312"); $spot = $spot->getSpotById($create); if ($oldMapIcon !== $spot->map_icon) { echo 'UPDATE MAP ICON: <font color="green">UDANE</font></br>'; } else { echo 'UPDATE MAP ICON: <font color="red">ERROR!</font></br>'; return false; } $spot->updateBanner("312312"); $spot = $spot->getSpotById($create); if ($oldBanner !== $spot->map_banner) { echo 'UPDATE BANNER: <font color="green">UDANE</font></br>'; } else { echo 'UPDATE BANNER: <font color="red">ERROR!</font></br>'; return false; } $spot->updateLocation("312312", "312312", "312312"); $spot = $spot->getSpotById($create); if ($oldLat !== $spot->lat && $oldLng !== $spot->lng && $oldAddress !== $spot->address) { echo 'UPDATE LOCATION: <font color="green">UDANE</font></br>'; } else { echo 'UPDATE LOCATION: <font color="red">ERROR!</font></br>'; return false; } $_POST["id"] = $create; $spot->deleteSpot(); if (($spot = $spot->getSpotById($create)) == NULL) { echo 'DELETE SPOT: <font color="green">UDANE</font></br>'; } else { echo 'DELETE SPOT: <font color="red">ERROR!</font></br>'; return false; } return true; }
static function update() { if (isset($_POST["new"])) { switch ($_GET["sub"]) { case "spots": echo "kurwa"; Spot::createSpot(); break; case "menus": case "subscriptions": break; } } }
<?php require_once 'Connections.php'; require_once 'models/User.php'; require_once 'models/Spot.php'; (new Database())->reinstall(); $_POST["login"] = "******"; $_POST["pass"] = "******"; $_POST["email"] = "*****@*****.**"; User::createUser(); User::login(); assert(User::checkLogin()); $id = Spot::createSpot(); echo "spot id:" . $id; $spot = Spot::getSpotById($id); assert($spot->id == $id);