function test_save() { //Arrange $stylist_name = "Work stuff"; $test_Stylist = new Stylist($name); $test_Stylist->save(); //Act $result = Stylist::getAll(); //Assert $this->assertEquals($test_Stylist, $result[0]); }
function test_stylist_save() { //Arrange $style = "Thai"; $test_stylist = new Stylist($style); //Act $test_stylist->save(); //Assert $result = Stylist::getAll(); $this->assertEquals($test_stylist, $result[0]); }
static function find($search_id) { $found_stylist = null; $all_stylists = Stylist::getAll(); foreach ($all_stylists as $stylist) { if ($stylist->getId() == $search_id) { $found_stylist = $stylist; } } return $found_stylist; }
static function find($search_id) { $found_stylist = null; $stylists = Stylist::getAll(); foreach ($stylists as $stylist) { $stylist_id = $stylist->getId(); if ($stylist_id == $search_id) { $found_stylist = $stylist; } //end of if } //end of foreach return $found_stylist; }
function testDeleteAll() { //Arrange $name = "Michael"; $id = null; $test_stylist = new Stylist($name, $id); $test_stylist->save(); $name2 = "John"; $id2 = null; $test_stylist2 = new Stylist($name2, $id2); $test_stylist2->save(); //Act Stylist::deleteAll(); //Assert $result = Stylist::getAll(); $this->assertEquals([], $result); }
function test_deleteAll() { $name = "Megan"; $name2 = "Felicia"; $test_stylist = new Stylist($name); $test_stylist->save(); $test_stylist2 = new Stylist($name2); $test_stylist2->save(); Stylist::deleteAll(); $result = Stylist::getAll(); $this->assertEquals([], $result); }
function testDelete() { //Arrange $id = null; $stylist_name = "Nico"; $test_stylist = new Stylist($id, $stylist_name); $test_stylist->save(); $stylist_name2 = "Tina"; $test_stylist2 = new Stylist($id, $stylist_name2); $test_stylist2->save(); //Act $test_stylist->delete(); //Assert $result = Stylist::getAll(); $this->assertEquals([$test_stylist2], $result); }
function testDelete() { //Arrange $name = "Bob"; $id = null; $test_stylist = new Stylist($name, $id); $test_stylist->save(); $name2 = "Harry"; $test_stylist2 = new Stylist($name2, $id); $test_stylist2->save(); //Act $test_stylist->delete(); //Assert $this->assertEquals([$test_stylist2], Stylist::getAll()); }
$client->save(); $stylist = Stylist::find($stylist_id); return $app['twig']->render('stylist.html.twig', array('stylist' => $stylist, 'client' => $stylist->getClient())); }); $app->post("/stylists", function () use($app) { $stylist = new Stylist($_POST['name']); $stylist->save(); return $app['twig']->render('index.html.twig', array('stylists' => Stylist::getAll())); }); $app->post("/delete_stylists", function () use($app) { //Clients::deleteAll(); Stylist::deleteAll(); return $app['twig']->render('index.html.twig', array('stylists' => Stylist::getAll())); }); $app->post("/delete_client", function () use($app) { $category_id = $_POST['stylist_id']; Client::delete($stylist_id); return $app['twig']->render('index.html.twig', array('stylists' => Stylist::getAll())); }); $app->get("/all_clients", function () use($app) { return $app['twig']->render('all_clients.html.twig', array('clients' => Client::getAll(), 'stylists' => Stylist::getAll())); }); $app->post("/client", function () use($app) { $name = $_POST['name']; $stylist_id = $_POST['stylist_id']; $client = new Client($name, $stylist_id); $client->save(); $stylist = Stylist::find($stylist_id); return $app['twig']->render('stylist.html.twig', array('stylist' => $stylist, 'clients' => Client::getAll())); }); return $app;
function test_stylist_delete() { //Arrange $name = "Vidal Sassoon"; $test_stylist = new Stylist($name); $test_stylist->save(); $name2 = "Monsieur Champagne"; $test_stylist2 = new Stylist($name2); $test_stylist2->save(); //Act $test_stylist->delete(); //Assert $this->assertEquals([$test_stylist2], Stylist::getAll()); }
$app->get("/clients/{id}", function ($id) use($app) { $client = Client::find($id); $stylists = Stylist::getAll(); return $app['twig']->render('client.html.twig', array('client' => $client, 'form_check' => false, 'stylists' => $stylists)); }); //Shows form on clients page to update information $app->get("/client_update_form", function () use($app) { $client = Client::find($_GET['client_id']); $stylists = Stylist::getAll(); return $app['twig']->render('client.html.twig', array('client' => $client, 'form_check' => true, 'stylists' => $stylists)); }); //Updates client's information and renders the clients page $app->patch("/update_client", function () use($app) { $name = $_POST['name']; $phone = $_POST['phone']; $stylist_id = $_POST['stylist_id']; $client_id = $_POST['client_id']; $stylists = Stylist::getAll(); $client = Client::find($client_id); $client->update($name, $phone, $stylist_id, $client_id); return $app['twig']->render('client.html.twig', array('client' => $client, 'form_check' => false, 'stylists' => $stylists)); }); //Deletes a single client and renders the page of the stylist they had been associated with $app->delete("/clients/{id}", function ($id) use($app) { $client = Client::find($id); $stylist_id = $client->getStylistId(); $stylist = Stylist::find($stylist_id); $client->delete(); return $app['twig']->render('stylist.html.twig', array('stylist' => $stylist, 'clients' => $stylist->getClients(), 'form_check' => false)); }); return $app;
function test_delete() { $name = "Jane Doe"; $test_stylist = new Stylist($name); $test_stylist->save(); $name2 = "James Don"; $test_stylist2 = new Stylist($name2); $test_stylist2->save(); $client_name = "Jimmy"; $client_stylist_id = $test_stylist->getId(); $test_client = new Client($client_name, $client_stylist_id); $test_client->save(); $test_stylist->delete(); $result = Stylist::getAll(); $this->assertEquals([$test_stylist2], $result); }
function test_deleteAll() { //Arrange $stylist1 = new Stylist("Iris", "5033428797", "Children", false); $stylist1->save(); $stylist2 = new Stylist("Bif", "5033421111", "Beard Trimming", true); $stylist2->save(); //Act Stylist::deleteAll(); $result = Stylist::getAll(); //Assert $this->assertEquals([], $result); }
Client::deleteAll(); return $app['twig']->render('index.html.twig'); }); //Find and return a client to edit //Comes from client.html.twig //Goes to client_edit.html.twig to allow for deleting or updating $app->get("/client/{id}/edit", function ($id) use($app) { $client = Client::find($id); return $app['twig']->render('client_edit.html.twig', array('clients' => $client)); }); //Update client name //Comes from client_edit with passed in client ID //Render client with the new updated client //post->/client $app->patch("/client/{id}", function ($id) use($app) { $client_name = $_POST['client_name']; $client = Client::find($id); $client->update($client_name); $clients = Client::getAll(); return $app['twig']->render('client.html.twig', array('clients' => $clients, 'stylists' => Stylist::getAll())); }); //Delete one client //Comes from client_edit with passed in client ID //Render client with missing client //post-/client $app->delete("/client/{id}", function ($id) use($app) { $client = Client::find($id); $client->deleteOne(); return $app['twig']->render('index.html.twig', array('clients' => Client::getAll())); }); return $app;
return $app['twig']->render('stylist_edit.html.twig', array('stylist' => $stylist)); }); //EDIT CLIENT PAGE $app->get("/client/{id}/edit", function ($id) use($app) { $client = Client::find($id); return $app['twig']->render('client_edit.html.twig', array('client' => $client)); }); //DELETE CLIENT $app->delete("/client/{id}/delete", function ($id) use($app) { $client = Client::find($id); $client->delete(); $stylist_id = $client->getStylistId(); $stylist = Stylist::find($stylist_id); return $app['twig']->render('stylist.html.twig', array('clients' => $stylist->getAllClients(), 'stylist' => $stylist)); }); //UPDATE CLIENT $app->patch("/client/{id}", function ($id) use($app) { $new_client_name = $_POST['name']; $client = Client::find($id); $client->updateName($new_client_name); $stylist = Stylist::find($client->getStylistId()); return $app['twig']->render('stylist.html.twig', array('stylists' => Stylist::getAll(), 'stylist' => $stylist, 'clients' => $stylist->getAllClients())); }); //UPDATE Stylist $app->patch("/stylist/{id}", function ($id) use($app) { $new_stylist_name = $_POST['name']; $stylist = Stylist::find($id); $stylist->updateName($new_stylist_name); return $app['twig']->render('stylist.html.twig', array('stylist' => $stylist, 'clients' => $stylist->getAllClients())); }); return $app;
function test_delete() { //arrange $stylist_name = "Nora"; $id = null; $test_stylist = new Stylist($stylist_name, $id); $test_stylist->save(); $stylist_name2 = "Andrea"; $test_stylist2 = new Stylist($stylist_name2, $id); $test_stylist2->save(); //act $test_stylist->delete(); //assert $this->assertEquals([$test_stylist2], Stylist::getAll()); }
function testDelete() { //Arrange= $stylist_name = "Arwen"; $test_stylist = new Stylist($stylist_name, $id = null); $test_stylist->save(); $stylist_name2 = "Legolas"; $test_stylist2 = new Stylist($stylist_name2, $id = null); $test_stylist2->save(); //Act $test_stylist->delete(); //Assert $this->assertEquals([$test_stylist2], Stylist::getAll()); }
$app->post("/stylists/{id}", function ($id) use($app) { Client::deleteAll(); $stylist = Stylist::find($id); return $app['twig']->render('stylist.html.twig', array('stylist' => $stylist, 'clients' => $stylist->getClients())); }); $app->patch("/stylists/{id}", function ($id) use($app) { $name = $_POST['name']; $phone = $_POST['phone']; $stylist = Stylist::find($id); $stylist->update($name, $phone); return $app['twig']->render('stylist.html.twig', array('stylist' => $stylist, 'clients' => $stylist->getClients())); }); $app->delete("/stylists/{id}", function ($id) use($app) { $stylist = Stylist::find($id); $stylist->delete(); return $app['twig']->render('stylist_deleted.html.twig', array('stylists' => Stylist::getAll())); }); $app->patch("/clients/{id}", function ($id) use($app) { $name = $_POST['name']; $phone = $_POST['phone']; $client = Client::find($id); $stylist = Stylist::find($id); $client->update($name, $phone); return $app['twig']->render('client_edit.html.twig', array('client' => $client, 'stylist' => $stylist)); }); $app->delete("/clients/{id}", function ($id) use($app) { $client = Client::find($id); $client->delete(); return $app['twig']->render('client_deleted.html.twig', array('stylists' => Stylist::getAll())); }); return $app;
function test_delete() { //Arrange $stylist_name = "Big Bird"; $id = null; $test_stylist = new Stylist($stylist_name); $test_stylist->save(); $stylist_name2 = "Araya Stark"; $test_stylist2 = new Stylist($stylist_name2); $test_stylist2->save(); //Act $test_stylist->delete(); //Assert $this->assertEquals([$test_stylist2], Stylist::getAll()); }
function test_deleteStylist() { $stylist_name = "Mike Heroku"; $id = null; $test_stylist = new Stylist($stylist_name, $id); $test_stylist->save(); $stylist_name2 = "Kyle Sites"; $test_stylist2 = new Stylist($stylist_name2, $id); $test_stylist2->save(); $test_stylist->deleteStylist(); $this->assertEquals([$test_stylist2], Stylist::getAll()); }
function test_delete() { $name = "Sally"; $phone = "555-555-5555"; $id = null; $test_stylist = new Stylist($name, $phone, $id); $test_stylist->save(); $name2 = "Judy"; $test_stylist2 = new Stylist($name2, $phone, $id); $test_stylist2->save(); $test_stylist->delete(); $this->assertEquals([$test_stylist2], Stylist::getAll()); }
function test_delete() { //Arrange $name = "Brenda"; $test_stylist = new Stylist($name); $test_stylist->save(); $name2 = "Eduardo"; $test_stylist2 = new Stylist($name); $test_stylist2->save(); //Act $test_stylist->delete_stylist(); //Assert $this->assertEquals([$test_stylist2], Stylist::getAll()); }
function testDelete() { //Arrange $stylist_name = "Allison"; $id = null; $test_stylist = new Stylist($stylist_name, $id); $test_stylist->save(); $stylist_name2 = "Fey"; $test_stylist2 = new Stylist($stylist_name2, $id); $test_stylist2->save(); //Act $test_stylist->deleteOne(); //Assert $this->assertEquals([$test_stylist2], Stylist::getAll()); }
function test_delete() { //Arrange $stylist_name = "Donna"; $stylist_name2 = "Ronda"; $test_stylist = new Stylist($stylist_name); $test_stylist->save(); $test_stylist2 = new Stylist($stylist_name2); $test_stylist2->save(); //Act $test_stylist->delete(); $result = Stylist::getAll(); //Assert $this->assertEquals([$test_stylist2], Stylist::getAll()); }
function testDelete() { //Arrange $id = null; $name = "Kourtney"; $test_stylist = new Stylist($id, $name); $test_stylist->save(); $name2 = "Xavier"; $test_stylist2 = new Stylist($id, $name2); $test_stylist2->save(); //Act $test_stylist->delete(); //Assert $result = Stylist::getAll(); $this->assertEquals([$test_stylist2], $result); }
$app->get("/stylists/{id}/edit", function ($id) use($app) { $stylist = Stylist::find($id); return $app['twig']->render('stylist_edit.html.twig', array('stylist' => $stylist)); }); //allows the user to use the update method $app->patch("/stylists/{id}", function ($id) use($app) { $stylist_name = $_POST['stylist_name']; $stylist = Stylist::find($id); $stylist->update($stylist_name); return $app['twig']->render('stylist.html.twig', array('stylist' => $stylist, 'clients' => $stylist->getClients())); }); //allows the user to delete a stylist $app->delete("/stylists/{id}", function ($id) use($app) { $stylist = Stylist::find($id); $stylist->delete(); return $app['twig']->render('index.html.twig', array('stylists' => Stylist::getAll())); }); //allows the user to find a client's id $app->get("/clients/{id}", function ($id) use($app) { $client = Client::find($id); return $app['twig']->render('client.html.twig', array('client' => $client)); }); $app->get("/clients/{id}/edit", function ($id) use($app) { $client = Client::find($id); return $app['twig']->render('client.html.twig', array('client' => $client)); }); //Allows the user to update the client $app->patch("/clients/{id}", function ($id) use($app) { $client_name = $_POST['client_name']; $client = Client::find($id); $stylist = Stylist::find($id);
//Navigate to stylist page $app->get('/stylists/{id}', function ($id) use($app) { $stylist = Stylist::find($id); return $app['twig']->render('stylists.html.twig', array('stylist' => $stylist, 'clients' => $stylist->getClients(), 'client_check' => false)); }); //Update stylist $app->patch('/stylists/{id}/update', function ($id) use($app) { $stylist = Stylist::find($id); //Change stylist name $stylist->updateStylist($_POST['new_name']); return $app['twig']->render('stylists.html.twig', array('stylist' => $stylist, 'clients' => $stylist->getClients(), 'client_check' => false, 'client_update' => false)); }); $app->delete('/stylists/{id}/delete', function ($id) use($app) { $stylist = Stylist::find($id); $stylist->deleteStylist(); return $app['twig']->render('index.html.twig', array('stylists' => Stylist::getAll(), 'stylist_check' => false)); }); $app->get('/stylist/{id}/form-client', function ($id) use($app) { $stylist = Stylist::find($id); return $app['twig']->render('stylists.html.twig', array('stylist' => $stylist, 'clients' => $stylist->getClients(), 'client_check' => true, 'client_update' => true)); }); $app->post('/stylist/{id}/add_client', function ($id) use($app) { $stylist = Stylist::find($id); $name = $_POST['name']; $stylist_id = $_POST['stylist_id']; $description = $_POST['description']; $new_client = new Client($name, $stylist_id, $id = null, $description); $new_client->save(); return $app['twig']->render('stylists.html.twig', array('stylist' => $stylist, 'clients' => $stylist->getClients(), 'client_check' => true, 'client_update' => false)); }); $app->get('/{id}/edit-client', function ($id) use($app) {
function test_delete() { //Arrange $name = "Tony"; $id = null; $test_Stylist = new Stylist($name, $id); $test_Stylist->save(); $name2 = "Ted"; $id = null; $test_Stylist2 = new Stylist($name, $id); $test_Stylist2->save(); //Act $test_Stylist->deleteStylist(); //Assert $this->assertEquals([$test_Stylist2], Stylist::getAll()); }
function testDelete() { $name = "Bob"; $test_stylist = new Stylist($name); $test_stylist->save(); $name2 = "Kevin"; $test_stylist2 = new Stylist($name2); $test_stylist2->save(); $test_stylist->delete(); $this->assertEquals([$test_stylist2], Stylist::getAll()); }