function test_deleteAll()
 {
     $cuisine_name = "Italian";
     $id = null;
     $test_cuisine = new Cuisine($cuisine_name, $id);
     $test_cuisine->save();
     $restaraunt_name = "Mamas Home Country Cookin";
     $cuisine_id = $test_cuisine->getId();
     $test_restaraunt = new Restaraunt($restaraunt_name, $id, $cuisine_id);
     $test_restaraunt->save();
     $restaraunt_name2 = "Big Bobs Fried Alligator";
     $test_restaraunt2 = new Restaraunt($restaraunt_name2, $id, $cuisine_id);
     $test_restaraunt2->save();
     //Act
     Restaraunt::deleteAll();
     //Assert
     $result = Restaraunt::getAll();
     $this->assertEquals([], $result);
 }
 protected function tearDown()
 {
     Cuisine::deleteAll();
     Restaraunt::deleteAll();
 }
Example #3
0
    $cuisine = Cuisine::find($id);
    return $app['twig']->render('cuisine.html.twig', array('cuisine' => $cuisine, 'restaraunts' => $cuisine->getRestaraunts()));
});
$app->post("/restaraunts", function () use($app) {
    $restaraunt_name = $_POST['RestarauntName'];
    $cuisine_id = $_POST['cuisine_id'];
    $address = $_POST['address'];
    $menu = $_POST['menu'];
    $hours = $_POST['hours'];
    $restaraunt = new Restaraunt($restaraunt_name, $id = null, $cuisine_id, $address, $menu, $hours);
    $restaraunt->save();
    $cuisine = Cuisine::find($cuisine_id);
    return $app['twig']->render('cuisine.html.twig', array('cuisine' => $cuisine, 'restaraunts' => $cuisine->getRestaraunts()));
});
$app->post("/delete_restaraunts", function () use($app) {
    Restaraunt::deleteAll();
    return $app['twig']->render('index.html.twig');
});
$app->post("/cuisines", function () use($app) {
    $cuisine = new Cuisine($_POST['CuisineName']);
    $cuisine->save();
    return $app['twig']->render('index.html.twig', array('cuisines' => Cuisine::getAll()));
});
$app->post("/delete_cuisines", function () use($app) {
    Cuisine::deleteAll();
    return $app['twig']->render('index.html.twig');
});
$app->get("/cuisines/{id}/edit", function ($id) use($app) {
    $cuisine = Cuisine::find($id);
    return $app['twig']->render('cuisine_edit.html.twig', array('cuisine' => $cuisine));
});