static function find($search_id) { $found_client = null; $clients = client::getAll(); foreach (clients as $client) { $id = $client->getId(); if ($id == $search_id) { $found_client = $client; } } return $found_client; }
function test_save() { //Arrange $stylist_name = "Donna"; $id = null; $test_stylist = new Stylist($stylist_name, $id); $test_stylist->save(); $client_name = "Robin"; $stylist_id = $test_stylist->getId(); $test_client = new Client($client_name, $stylist_id); $test_client->save(); //Act $result = client::getAll(); //Assert $this->assertEquals($test_client, $result[0]); }
function test_getAll() { $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(); $result = client::getAll(); $this->assertEquals([$test_client, $test_client2], $result); $result = Client::getAll(); $this->assertEquals([$test_client, $test_client2], $result); }
function test_deleteClient() { //Arrange $name = "Tessa"; $id = null; $test_stylist = new stylist($name, $id); $test_stylist->save(); $test_stylist_id = $test_stylist->getId(); $name = "Mai"; $description = "Scary"; $visits = 3; $name2 = "Doory"; $description2 = "Not worth it."; $visits2 = 4; $test_client = new client($name, $test_stylist_id, $id, $visits, $description); $test_client2 = new client($name2, $test_stylist_id, $id, $visits2, $description2); $test_client->save(); $test_client2->save(); //Act $test_client->deleteClient(); //Assert $this->assertEquals([$test_client2], client::getAll()); }
<?php include 'template/blankStart.php'; include_once '../model/profiles/client.php'; $clients = client::getAll(); ?> <div class="row"> <div class="col-lg-12"> <div class="panel panel-primary"> <div class="panel-heading"> <h3 class="panel-title"> </h3> </div> <div class="panel-body"> <?php $index = 1; foreach ($clients as $client) { echo "<a href=\"client_info.php?client={$client['name']}\"> {$index}.{$client['name']}</a><br>"; $index++; } ?> </div> </div> </div> </div> <?php include 'template/blankEnd.php';