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 testSave() { $stylist_name = "Kevin"; $test_stylist = new Stylist($stylist_name); $test_stylist->save(); $name = "Stuart"; $phone = "555-555-5555"; $stylist_id = $test_stylist->getId(); $test_client = new Client($name, $phone, $stylist_id); $test_client->save(); $result = Client::getAll(); $this->assertEquals($test_client, $result[0]); }
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_find() { //Arrange $name = "Tessa"; $id = null; $visits = 4; $description = "The best!"; $test_stylist = new Stylist($name, $id); $test_stylist->save(); $name = "jack"; $name2 = "Bob"; $stylist_id = $test_stylist->getId(); $test_client = new Client($name, $stylist_id, $id, $visits, $description); $test_client->save(); $test_client2 = new Client($name, $stylist_id, $id, $visits, $description); $test_client2->save(); //Act $result = Client::find($test_client->getId()); //Assert $this->assertEquals($test_client, $result); }
function testFind() { //Arrange $stylist_name = "Gandalf the Gray"; $test_stylist = new Stylist($stylist_name, $id = null); $test_stylist->save(); $client_name = "Samwise"; $stylist_id = $test_stylist->getId(); $test_client = new Client($client_name, $id = null, $stylist_id); $test_client->save(); $client_name2 = "Arwen"; $test_client2 = new Client($client_name2, $id = null, $stylist_id); $test_client2->save(); //Act $result = Client::find($test_client->getId()); //Assert $this->assertEquals($test_client, $result); }
function test_deleteAll() { $name = "Megan"; $id = null; $test_stylist = new Stylist($name, $id); $test_stylist->save(); $client_name = "Shawnee"; $stylist_id = $test_stylist->getId(); $test_client = new Client($id, $client_name, $stylist_id); $test_client->save(); $client_name2 = "Katie"; $stylist_id = $test_stylist->getId(); $test_client2 = new Client($id, $client_name, $stylist_id); $test_client2->save(); Client::deleteAll(); $result = Client::getAll(); $this->assertEquals([], $result); }
function testDeleteStylistClient() { //Arrange $stylist_name = "Bilbo Baggins"; $test_stylist = new Stylist($stylist_name, $id = null); $test_stylist->save(); $client_name = "The Necromancer"; $stylist_id = $test_stylist->getId(); $test_client = new Client($client_name, $id = null, $stylist_id); $test_client->save(); //Act $test_stylist->delete(); //Assert $this->assertEquals([], Client::getAll()); }
$password = '******'; $DB = new PDO($server, $username, $password); $app->register(new Silex\Provider\TwigServiceProvider(), array('twig.path' => __DIR__ . '/../views')); use Symfony\Component\HttpFoundation\Request; Request::enableHttpMethodParameterOverride(); ////// //////// Landing Page ////// //////Route to landing page. Uses twig to render array of stylists. $app->get("/", function () use($app) { return $app['twig']->render('index.html.twig', array('stylists' => Stylist::getAll())); }); //////adds stylists to the list of stylists. renders them on a list on the same landing page. $app->post("/stylists", function () use($app) { $stylist_name = new Stylist($_POST['stylist_name']); $stylist_name->save(); return $app['twig']->render('index.html.twig', array('stylist_names' => Stylist::getAll())); }); //////clears the whole list of stylists on the landing page. $app->post("/delete_stylists", function () use($app) { Stylist::deleteAll(); return $app['twig']->render('index.html.twig', array('stylist_names' => Stylist::getAll())); }); // //When the user submits a client name: // $app->post("/clients", function() use ($app){ // $client = $_POST['client']; // $stylist_id = $_POST['stylist_id']; // // //Creates a new Client object with the above mentioned client, and stylist_id. Sets the client id to null because it is assigned by the database // $client = new Client($_POST['client'], $id = null, $stylist_id); // //Saves new client to database and assigns a client id - see Client.php
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 $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 test_stylist_getClient() { //Arrange $name = "Vidal Sassoon"; $test_stylist = new Stylist($name); $test_stylist->save(); $name2 = "Sweeney Todd"; $test_stylist2 = new Stylist($name2); $test_stylist2->save(); $name3 = "Mr. T"; $stylist_id = $test_stylist->getId(); $test_client = new Client($name3, $stylist_id, null); $test_client->save(); $name4 = "Mrs. T"; $stylist_id2 = $test_stylist2->getId(); $test_client2 = new Client($name4, $stylist_id2, null); $test_client2->save(); //Act $result = $test_stylist->getClient(); //Assert $this->assertEquals($test_client, $result[0]); }
function testGetClients() { //Arrange $id = null; $name = "Nova"; $test_stylist = new Stylist($id, $name); $test_stylist->save(); $test_stylist_id = $test_stylist->getId(); $client_name = "Martha Stewart"; $phone = "(888) 888-8888"; $next_visit = "2015-09-06"; $test_client = new Client($id, $client_name, $phone, $next_visit, $test_stylist_id); $test_client->save(); $name2 = "Jennifer Lopez"; $phone2 = "(609) 999-9999"; $next_visit2 = "2015-10-12"; $test_client2 = new Client($id, $client_name2, $phone2, $next_visit2, $test_stylist_id); $test_client2->save(); //Act $result = $test_stylist->getClients(); //Assert $this->assertEquals([$test_client, $test_client2], $result); }
function testDeleteStylistClients() { //Arrange $name = "Erin"; $id = null; $test_stylist = new Stylist($name, $id); $test_stylist->save(); $name = "George"; $id = null; $test_client = new Client($name, $stylist_id); $test_client->save(); //Act $test_stylist->delete(); //Assert $this->assertEquals([], Client::getAll()); }
function test_updateName() { $stylist_name = "Donna"; $test_stylist = new Stylist($stylist_name); $test_stylist->save(); $new_stylist_name = "Danny"; //Act $test_stylist->updateName($new_stylist_name); //Assert $this->assertEquals($test_stylist->getStylistName(), "Danny"); }
function test_delete() { $name = "Jane Doe"; $test_stylist = new Stylist($name); $test_stylist->save(); $client_name = "Jimmy"; $client_stylist_id = $test_stylist->getId(); $test_client = new Client($client_name, $client_stylist_id); $test_client->save(); $client_name2 = "Coco"; $test_client2 = new Client($client_name2, $client_stylist_id); $test_client2->save(); $test_client->delete(); $result = Client::getAll(); $this->assertEquals([$test_client2], $result); }
function testDeleteClientTasks() { //Arrange $stylist_name = "Allison"; $id = null; $test_stylist = new Stylist($stylist_name, $id); $test_stylist->save(); $client_name = "Paco"; $stylist_id = $test_stylist->getId(); $test_client = new Client($client_name, $id, $stylist_id); $test_client->save(); //Act $test_stylist->deleteOne(); //Assert $this->assertEquals([], Client::getAll()); }
function test_getClients() { $stylist_name = "Hank Airpair"; $id = null; $test_stylist = new Stylist($stylist_name, $id); $test_stylist->save(); $client_name = "Wesley Pong"; $stylist_id = $test_stylist->getId(); $email = "*****@*****.**"; $test_client = new Client($client_name, $id, $email, $stylist_id); $test_client->save(); $client_name2 = "Wendy Git"; $email = "*****@*****.**"; $test_client2 = new Client($client_name2, $id, $email, $stylist_id); $test_client2->save(); $result = $test_stylist->getClients(); $this->assertEquals([$test_client, $test_client2], $result); }
function test_delete() { //Arrange $name = "Erin"; $id = null; $test_stylist = new Stylist($name, $id); $test_stylist->save(); $name = "George"; $stylist_id = $test_stylist->getId(); $test_client = new Client($name, $stylist_id, $id); $test_client->save(); $name2 = "Judy"; $test_client2 = new Client($name2, $stylist_id, $id); $test_client2->save(); //Act $test_client2->delete(); //Assert $this->assertEquals([$test_client], Client::getAll()); }
function test_client_delete() { //Arrange $name = "Vidal Sassoon"; $test_stylist = new Stylist($name); $test_stylist->save(); $name2 = "Sweeney Todd"; $test_stylist2 = new Stylist($name2); $test_stylist2->save(); $name3 = "Mr. T"; $stylist_id = $test_stylist->getId(); $test_client = new Client($name3, $stylist_id, null); $test_client->save(); $name4 = "Mrs. T"; $stylist_id2 = $test_stylist2->getId(); $test_client2 = new Client($name4, $stylist_id2, null); $test_client2->save(); //Act $test_client->delete(); //Assert $this->assertEquals([$test_client2], Client::getAll()); }
function testGetClients() { //Arrange $name = "Jackie"; $id = null; $test_stylist = new Stylist($name, $id); $test_stylist->save(); $test_stylist_id = $test_stylist->getId(); $name = "Sandra Jane"; $phone = "542-334-0984"; $style_choice = "The Rachel"; $test_client = new Client($name, $phone, $style_choice, $test_stylist_id); $test_client->save(); $name2 = "Jordy Duran"; $phone2 = "239-094-0281"; $style_choice2 = "Bowl Cut"; $test_client2 = new Client($name2, $phone2, $style_choice2, $test_stylist_id); $test_client2->save(); //Act $result = $test_stylist->getClients(); //Assert $this->assertEquals([$test_client, $test_client2], $result); }
function test_getClients() { //Arrange $name = "Sasha"; $id = null; $test_stylist = new Stylist($name, $id); $test_stylist->save(); $name2 = "Sandra"; $test_stylist2 = new Stylist($name2, $id); $test_stylist2->save(); $c_name = "Garry Gergich"; $phone = "503-472-8959"; $stylist_id = $test_stylist->getId(); $test_client = new Client($c_name, $phone, $id, $stylist_id); $test_client->save(); $c_name2 = "Jerry Gergich"; $phone2 = "503-864-4444"; $stylist_id2 = $test_stylist2->getId(); $test_client2 = new Client($c_name2, $phone2, $id, $stylist_id2); $test_client2->save(); $c_name3 = "Brock Samson"; $phone3 = "555-555-5555"; $stylist_id3 = $test_stylist->getId(); $test_client3 = new Client($c_name3, $phone3, $id, $stylist_id3); $test_client3->save(); //Act $result = $test_stylist->getClients(); //Assert $this->assertEquals([$test_client3, $test_client], $result); }
// $client->save(); // return $app['twig']->render('clients.html.twig', array('clients' => Client::getAll())); // }); //Allows the user to add clients to a stylist's client list $app->post("/clients", function () use($app) { $client_name = $_POST['client_name']; $stylist_id = $_POST['stylist_id']; $client = new Client($client_name, $id = null, $stylist_id); $client->save(); $stylist = Stylist::find($stylist_id); return $app['twig']->render('stylist.html.twig', array('stylist' => $stylist, 'clients' => $stylist->getClients())); }); //Allows the user to add stylists to the list on the front page $app->post("/stylists", function () use($app) { $stylist = new Stylist($_POST['stylist_name']); $stylist->save(); return $app['twig']->render('index.html.twig', array('stylists' => Stylist::getAll())); }); //Allows the user to delete the list of stylists on the front page //Error: Variable 'stylists' does not exist in 'stylists.html.twig' at line 11 $app->post("/delete_stylists", function () use($app) { Stylist::deleteAll(); return $app['twig']->render('stylists.html.twig'); }); //route which allows the user to edit one stylist $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) {
function testGetClients() { //Arrange $name = "jerry"; $id = null; $test_stylist = new Stylist($name, $id); $test_stylist->save(); $test_stylist_id = $test_stylist->getId(); $name = "kramer"; $phone = "123-321-1234"; $style_choice = "bowl cut"; $test_client = new Client($name, $phone, $style_choice, $test_stylist_id); $test_client->save(); $name2 = "ben"; $phone2 = "123-456-1234"; $style_choice2 = "trim"; $test_client2 = new Client($name2, $phone2, $style_choice2, $test_stylist_id); $test_client2->save(); //Act $result = $test_stylist->getClients(); //Assert $this->assertEquals([$test_client, $test_client2], $result); }
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 testGetClients() { //Arrange $name = "Bob"; $id = null; $test_stylist = new Stylist($name, $id); $test_stylist->save(); $test_stylist_id = $test_stylist->getId(); $client_name = "Betty"; $test_client = new Client($client_name, $test_stylist_id, $id); $test_client->save(); $client_name2 = "Gertrude"; $test_client2 = new Client($client_name2, $test_stylist_id, $id); $test_client2->save(); //Act $result = $test_stylist->getClients(); //Assert $this->assertEquals([$test_client, $test_client2], $result); }
function test_delete() { //Arrange $stylist_name = "bob"; $id = null; $test_stylist = new Stylist($stylist_name, $id); $test_stylist->save(); $client_name = "joe"; $stylist_id = $test_stylist->getId(); $test_client = new Client($client_name, $id, $stylist_id); $test_client->save(); $client_name2 = "jerry"; $test_client2 = new Client($client_name2, $id, $stylist_id); $test_client2->save(); //Act $test_client->delete(); //Assert $this->assertEquals([$test_client2], Client::getAll()); }
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 test_find() { //Arrange $name = "Stylist1"; $id = null; $test_stylist = new Stylist($name, $id); $test_stylist->save(); $name = "Client1"; $stylist_id = $test_stylist->getId(); $test_client = new Client($name, $id, $stylist_id); $test_client->save(); $name = "Client2"; $test_client2 = new Client($name, $id, $stylist_id); $test_client2->save(); //Act $result = Client::find($test_client->getId()); //Assert $this->assertEquals($test_client, $result); }
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() { //Arrange $name = "vicki"; $id = null; $test_stylist = new Stylist($name, $id); $test_stylist->save(); $name2 = "barb"; $test_stylist2 = new Stylist($name2, $id); $test_stylist2->save(); //Act $test_stylist->delete(); //Assert $this->assertEquals([$test_stylist2], Stylist::getAll()); }