function test_find() { $stylist_name = "Maggie Tech"; $stylist_name2 = "Rex Silex"; $test_stylist = new Stylist($stylist_name); $test_stylist->save(); $test_stylist2 = new Stylist($stylist_name2); $test_stylist2->save(); $result = Stylist::find($test_stylist->getId()); $this->assertEquals($test_stylist, $result); }
function testFind() { $name = "Bob"; $test_stylist = new Stylist($name); $test_stylist->save(); $name2 = "Kevin"; $test_stylist2 = new Stylist($name2); $test_stylist2->save(); $result = Stylist::find($test_stylist->getId()); $this->assertEquals($test_stylist, $result); }
function test_find() { $name = "Sally"; $phone = "555-555-5555"; $test_stylist = new Stylist($name, $phone); $test_stylist->save(); $name2 = "Judy"; $test_stylist2 = new Stylist($name2, $phone); $test_stylist2->save(); $result = Stylist::find($test_stylist->getId()); $this->assertEquals($test_stylist, $result); }
function test_find() { $name = "Jane Doe"; $test_stylist = new Stylist($name); $test_stylist->save(); $name2 = "James Don"; $test_stylist2 = new Stylist($name2); $test_stylist2->save(); $search_stylist = $test_stylist->getId(); $result = Stylist::find($search_stylist); $this->assertEquals($test_stylist, $result); }
function test_stylist_find() { //Arrange $stylist1 = new Stylist("Thai"); $stylist1->save(); $stylist2 = new Stylist("Dogfood"); $stylist2->save(); //Act $id = $stylist1->getId(); $result = Stylist::find($id); //Assert $this->assertEquals($stylist1, $result); }
function test_stylist_find() { //Arrange $name = "Vidal Sassoon"; $test_stylist = new Stylist($name); $test_stylist->save(); $name2 = "Monsieur Champagne"; $test_stylist2 = new Stylist($name2); $test_stylist2->save(); //Act $id = $test_stylist->getId(); $result = Stylist::find($id); //Assert $this->assertEquals($test_stylist, $result); }
function test_find() { //Arrange $name = "Brenda"; $test_stylist = new Stylist($name); $test_stylist->save(); $name2 = "Eduardo"; $test_stylist2 = new Stylist($name); $test_stylist2->save(); //Act $result = Stylist::find($test_stylist->getId()); //Assert $this->assertEquals($test_stylist, $result); }
function test_find() { //arrange $stylist_name = "Agnes"; $test_stylist = new Stylist($stylist_name); $test_stylist->save(); $stylist_name2 = "Cathy"; $test_stylist2 = new Stylist($stylist_name2); $test_stylist2->save(); //act $result = Stylist::find($test_stylist2->getId()); //assert $this->assertEquals($test_stylist2, $result); }
function test_find() { $name = "Megan"; $name2 = "Felicia"; $test_stylist = new Stylist($name); $test_stylist->save(); $test_stylist2 = new Stylist($name2); $test_stylist2->save(); $result = Stylist::find($test_stylist->getId()); $this->assertEquals($test_stylist, $result); }
function testFind() { //Arrange $id = null; $stylist_name = "Gina"; $test_stylist = new Stylist($id, $stylist_name); $test_stylist->save(); $stylist_name2 = "Tony"; $test_stylist2 = new Stylist($id, $stylist_name2); $test_stylist2->save(); //Act $result = Stylist::find($test_stylist->getId()); //Assert $this->assertEquals($test_stylist, $result); }
function test_find() { //Arrange $name = "Jackie"; $name2 = "Casey"; $test_stylist = new Stylist($name); $test_stylist->save(); $test_stylist2 = new Stylist($name2); $test_stylist2->save(); //Act $result = Stylist::find($test_stylist->getId()); //Assert $this->assertEquals($test_stylist, $result); }
function test_find() { //Arrange $stylist_name = "Big Bird"; $test_stylist = new Stylist($stylist_name); $test_stylist->save(); $stylist_name2 = "Araya Stark"; $test_stylist2 = new Stylist($stylist_name2); $test_stylist2->save(); //Act $result = Stylist::find($test_stylist->getId()); //Assert $this->assertEquals($test_stylist, $result); }
function testFind() { //Arrange $stylist_name = "Arwen"; $stylist_name2 = "Legolas"; $test_stylist = new Stylist($stylist_name, $id = null); $test_stylist->save(); $test_stylist2 = new Stylist($stylist_name2, $id = null); $test_stylist2->save(); //Act $result = Stylist::find($test_stylist->getId()); //Assert $this->assertEquals($test_stylist, $result); }
function test_find() { //Arrange $stylist1 = new Stylist("Iris", "5033428797", "Children", false); $stylist1->save(); $stylist2 = new Stylist("Bif", "5033421111", "Beard Trimming", true); $stylist2->save(); //Act $result = Stylist::find($stylist2->getId()); //Assert $this->assertEquals($stylist2, $result); }
$stylist = Stylist::find($id); $stylist->deleteOne(); return $app['twig']->render('stylists.html.twig', array('stylists' => Stylist::getAll())); }); //Lists all clients and stylists associated with the clients //Comes from index.html.twig //goes to post->/client or post->/delete_clients or /client/{id}/edit $app->get("/client", function () use($app) { return $app['twig']->render('client.html.twig', array('clients' => Client::getAll(), 'stylists' => Stylist::getAll())); }); //Adding a new client instance //Comes from self, renders to self $app->post("/client", function () use($app) { $id = null; $stylist_id = intval($_POST['stylist_id']); $stylist_name = Stylist::find($stylist_id); $client = new Client($_POST['client_name'], $id, $stylist_id); $client->save(); return $app['twig']->render('client.html.twig', array('clients' => Client::getAll(), 'stylists' => Stylist::getAll())); }); //Deletes all clients //Comes from client.html.twig //Goes to index.html.twig $app->post("/delete_client", function () use($app) { 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->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;
$stylist = Stylist::find($id); $stylist->update($name); return $app['twig']->render('stylist_edit.html.twig', array('stylist' => $stylist, 'clients' => $stylist->getClients())); }); $app->patch("/clients/{id}/edit", function ($id) use($app) { $name = preg_quote($_POST['client_name'], "'"); $client = Client::find($id); // echo "Name: " . $name . " Id: " . $id . " "; // var_dump($client); $client->update($name); return $app['twig']->render('client_edit.html.twig', array('client' => Client::find($id))); }); $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())); }); $app->get("/stylists/{id}/edit", function ($id) use($app) { $stylist = Stylist::find($id); return $app['twig']->render('stylist_edit.html.twig', array('stylist' => $stylist)); }); $app->post("/delete_stylists", function () use($app) { Stylist::deleteAll(); return $app['twig']->render('delete_stylists.html.twig'); }); $app->post("/delete_clients", function () use($app) { // echo "ID is: " . $id . " "; Client::deleteAll(); return $app['twig']->render('delete_clients.html.twig'); }); return $app;
function test_find() { //Arrange $stylist_name = "Allison"; $stylist_name2 = "Fey"; $test_Stylist = new Stylist($stylist_name); $test_Stylist->save(); $test_Stylist2 = new Stylist($stylist_name2); $test_Stylist2->save(); //Act $result = Stylist::find($test_Stylist->getId()); //Assert $this->assertEquals($test_Stylist, $result); }
$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); $client->update($client_name); return $app['twig']->render('client.html.twig', array('client' => $client)); }); //Allows a user to delete a client //Getting error: Impossible to access attribute getStylistName //on null variable in stylist.html.twig at 8. $app->delete("/clients/{id}", function ($id) use($app) { $client = Client::find($id); $stylist = Stylist::find($client->getStylistId()); $client->delete(); $clients = Client::getAll(); return $app['twig']->render('stylist.html.twig', array('stylist' => $stylist, 'clients' => $clients)); }); return $app;
function test_find() { //Arrange $stylist_name = "Donna"; $stylist_name2 = "Ronda"; $test_stylist = new Stylist($stylist_name); $test_stylist->save(); $test_stylist2 = new Stylist($stylist_name); $test_stylist->save(); //Act $result = Stylist::find($test_stylist->getId()); //Assert $this->assertEquals($test_stylist, $result); }
function test_find() { //Arrange $name = "Tessa"; $name2 = "Alex"; $test_Stylist = new Stylist($name); $test_Stylist->save(); $test_Stylist2 = new Stylist($name2); $test_Stylist2->save(); //Act $result = Stylist::find($test_Stylist->getId()); //Assert $this->assertEquals($test_Stylist, $result); }
}); $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) { $stylist = Stylist::find($id); return $app['twig']->render('stylists.html.twig', array('stylist' => $stylist, 'clients' => $stylist->getClients(), 'client_check' => false, 'client_update' => true)); }); $app->patch('/edit_description', function () use($app) { $edit = $_POST['edit']; $stylist = Stylist::find($_POST['stylist_id']); $client = Client::find($_POST['client_id']); $client->editDescription($edit); return $app['twig']->render('stylists.html.twig', array('stylist' => $stylist, 'clients' => $stylist->getClients(), 'client_check' => false, 'client_update' => false)); }); $app->get('/edit_description', function () use($app) { return $app['twig']->render('stylists.html.twig', array('stylist' => $stylist, 'clients' => $stylist->getClients(), 'client_check' => false, 'client_update' => false)); }); $app->delete('/delete-client', function () use($app) { $stylist = Stylist::find($_POST['stylist_id']); $client = Client::find($_POST['client_id']); $client->deleteClient(); return $app['twig']->render('stylists.html.twig', array('stylist' => $stylist, 'clients' => $stylist->getClients(), 'client_check' => false, 'client_update' => false)); }); return $app;