/** * Store a newly created resource in storage. * * @return Response */ public function postCreate() { // Declare the rules for the form validation $rules = array('name' => 'required|min:3', 'description' => 'required|min:3', 'email' => 'required|min:3', 'callback' => 'required|min:3', 'website' => 'required|min:3'); // Validate the inputs $validator = Validator::make(Input::all(), $rules); // Check if the form validates with success if ($validator->passes()) { // Create a new blog post $user = Auth::user(); // Update the blog post data $this->client->name = Input::get('name'); $this->client->id = $this->keygen(); $this->client->secret = $this->keygen(); //$this->client->user_id = $user->id; // Was the blog post created? if ($this->client->save()) { //Create Endpoint Object $endpoint = new ClientEndpoint(array('redirect_uri' => Input::get('callback'))); $metadata = array(new ClientMetadata(array('key' => 'slug', 'value' => Str::slug(Input::get('name')))), new ClientMetadata(array('key' => 'description', 'value' => Str::slug(Input::get('description')))), new ClientMetadata(array('key' => 'email', 'value' => Str::slug(Input::get('email')))), new ClientMetadata(array('key' => 'website', 'value' => Str::slug(Input::get('website'))))); if (!$this->client->endpoint()->save($endpoint)) { //delete client $id = $this->client->id; $this->client->delete(); // Was the blog post deleted? $client = Client::find($id); if (empty($client)) { // Redirect to the blog post create page return Redirect::to('admin/clients/create')->with('error', Lang::get('admin/clients/messages.create.endpoint_error')); } } if (!$this->client->metadata()->saveMany($metadata)) { //delete client $id = $this->client->id; $this->client->delete(); // Was the blog post deleted? $client = Client::find($id); if (empty($client)) { // Redirect to the blog post create page return Redirect::to('admin/clients/create')->with('error', Lang::get('admin/clients/messages.create.metadata_error')); } } // Redirect to the new blog post page return Redirect::to('admin/clients/' . $this->client->id . '/edit')->with('success', Lang::get('admin/clients/messages.create.success')); } // Redirect to the blog post create page return Redirect::to('admin/clients/create')->with('error', Lang::get('admin/clients/messages.create.error')); } // Form validation failed return Redirect::to('admin/clients/create')->withInput()->withErrors($validator); }
public function delete($options = []) { $data = Client::delete(static::endpoint() . '/' . $this->id(), $options); if (count($data) > 0) { $data = json_decode($data, true); } return $data; }
function supprimer($ref) { $client = new Client(); $client->charger_ref($ref); $client->delete(); ActionsModules::instance()->appel_module("supcli", $client); redirige("client.php"); }
public function testExceedMaxJobSize() { $this->subject->put(0, 0, 100, str_repeat('0', 65536 - 1)); $result = $this->subject->reserve(5); $this->subject->delete($result['id']); $this->assertEquals(65536 - 1, strlen($result['body'])); $this->subject->put(0, 0, 100, str_repeat('0', 65536)); $result = $this->subject->reserve(1); $this->assertFalse($result); }
public static function delete($subscription_id, $subscription_adjustment_id, $client = null) { if ($client == null) { $client = new Client(); } $response = $client->delete(sprintf(self::$SUBSCRIPTION_ADJUSTMENT_PATH, $subscription_id) . $subscription_adjustment_id); if ($response[0] == 200) { return new self($response[1], $client); } else { return $response[2]; } }
public function cancelInvitation($pid, $email) { $result = $this->client->get("/gdc/projects/{$pid}/invitations"); foreach ($result['invitations'] as $r) { if (strtolower($r['invitation']['content']['email']) != strtolower($email)) { continue; } if ($r['invitation']['content']['status'] == 'CANCELED') { continue; } $this->client->delete($r['invitation']['links']['self']); } }
function test_delete() { $stylist_id = 2; $client_name = "Shawnee"; $id = null; $test_client = new Client($id, $client_name, $stylist_id); $test_client->save(); $client_name2 = "Katie"; $test_client2 = new Client($id, $client_name, $stylist_id); $test_client2->save(); $test_client->delete(); $this->assertEquals([$test_client2], Client::getAll()); }
function testDelete() { //Arrange $name = "jill"; $test_stylist = new Stylist($name); $test_stylist->save(); $name = "joe"; $phone = "123-456-7890"; $style_choice = "shave"; $stylist_id = $test_stylist->getId(); $test_client = new Client($name, $phone, $style_choice, $stylist_id); $test_client->save(); $name2 = "kramer"; $phone2 = "123-456-7890"; $style_choice2 = "bowl cut"; $test_client2 = new Client($name2, $phone2, $style_choice2, $stylist_id); $test_client2->save(); //Act $test_client->delete(); //Assert $this->assertEquals([$test_client2], Client::getAll()); }
function testDelete() { //Arrange $name = "Jackie"; $test_stylist = new Stylist($name); $test_stylist->save(); $name = "Sandra Jane"; $phone = "542-334-0984"; $style_choice = "The Rachel"; $stylist_id = $test_stylist->getId(); $test_client = new Client($name, $phone, $style_choice, $stylist_id); $test_client->save(); $name2 = "Jordy Duran"; $phone2 = "239-094-0281"; $style_choice2 = "Bowl Cut"; $test_client2 = new Client($name2, $phone2, $style_choice2, $stylist_id); $test_client2->save(); //Act $test_client->delete(); //Assert $this->assertEquals([$test_client2], Client::getAll()); }
function test_client_delete() { //Arrange $style = "Thai"; $test_cuisine = new Client($style); $test_cuisine->save(); $name = "Pok Pok"; $category_id = $test_cuisine->getId(); $test_client = new Client($name, $category_id); $test_client->save(); $name2 = "Dicks"; $category_id2 = $test_cuisine->getId(); $test_client2 = new Client($name2, $category_id); $test_client2->save(); //Act $test_client->delete(); //Assert $this->assertEquals([$test_client2], Client::getAll()); }
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()); }
public function deleteUser($uid) { $this->client->delete("/gdc/account/profile/{$uid}"); }
} break; case $ACTION_clientSave: if (isset($_POST["client"])) { $_SESSION["client"] = $_POST["client"]; } $tempClient = new Client($_POST["client"], $_POST["client_name_field"], $_POST["client_address_field"]); $tempClient->save(); break; case $ACTION_clientCreate: $tempClient = new Client($_POST["client_name_field"], $_POST["client_address_field"]); $tempClient->create(); break; case $ACTION_clientDelete: $tempClient = new Client($_GET["client"]); $tempClient->delete(); $_SESSION["client"] = -1; break; case $ACTION_changeRole: // besoin des faire des verif savoir si l'utilisateur a bien le droit de change de ce role if (isset($_GET["role"])) { $_SESSION["systemData"]->setUserRole($_GET["role"]); } break; case $ACTION_showResult: $listeResultat = null; if (isset($_POST["search_type_select"])) { if ($_POST["search_type_select"] == 0) { $listeResultat[0] = 0; $active = false; if (isset($_POST["checkbox_filter_state_ongoing"]) && $_POST["checkbox_filter_state_ongoing"] == "check") {
function testDelete() { $name = "Bob"; $phone = "555-555-5555"; $stylist_id = 1; $test_client = new Client($name, $phone, $stylist_id); $test_client->save(); $name2 = "Kevin"; $phone2 = "444-444-4444"; $test_client2 = new Client($name2, $phone2, $stylist_id); $test_client2->save(); $test_client->delete(); $this->assertEquals([$test_client2], Client::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_delete() { //arrange $stylist_name = "Lisa"; $id = null; $test_stylist = new Stylist($stylist_name, $id); $test_stylist->save(); $client_name = "Alfred"; $stylist_id = $test_stylist->getId(); $test_client = new Client($client_name, $id, $stylist_id); $test_client->save(); $client_name2 = "Ludacris"; $stylist_id = $test_stylist->getId(); $test_client2 = new Client($client_name2, $id, $stylist_id); $test_client2->save(); $test_client->delete(); //assert $this->assertEquals([$test_client2], Client::getAll()); }
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); }
/** * Call any path, DELETE method. * * @param string $path the path * @param array $parameters DELETE parameters * @param array $requestOptions reconfigure the request * * @return array */ protected function delete($path, array $parameters = array(), array $requestOptions = array()) { return $this->client->delete($path, $parameters, $requestOptions); }
function testDelete() { //Arrange $id = null; $client_name = "Nico"; $stylist_id = 1; $test_client = new Client($id, $client_name, $stylist_id); $test_client->save(); $client_name2 = "Al"; $stylist_id2 = 2; $test_client2 = new Client($id, $client_name2, $stylist_id2); $test_client2->save(); //Act $test_client->delete(); //Assert $result = Client::getAll(); $this->assertEquals([$test_client2], $result); }
<?php require_once "auth.php"; //error_reporting(E_ALL); if (!est_autorise("acces_clients")) { exit; } if (!empty($action)) { switch ($action) { case 'delete': $tempcli = new Client(); if ($tempcli->charger_ref($ref)) { $tempcli->delete(); ActionsModules::instance()->appel_module("supcli", $tempcli); } break; case 'addCustomer': $clientToAdd = new Client(); $clientToAdd->raison = strip_tags($raison); $clientToAdd->nom = strip_tags($nom); $clientToAdd->entreprise = strip_tags($entreprise); $clientToAdd->prenom = strip_tags($prenom); $clientToAdd->telfixe = strip_tags($telfixe); $clientToAdd->telport = strip_tags($telport); if (filter_var($email, FILTER_VALIDATE_EMAIL) && $email) { $clientToAdd->email = strip_tags($email); } $clientToAdd->adresse1 = strip_tags($adresse1); $clientToAdd->adresse2 = strip_tags($adresse2); $clientToAdd->adresse3 = strip_tags($adresse3); $clientToAdd->cpostal = strip_tags($cpostal);
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 test_delete() { //Arrange $stylist = new Stylist("Diane", "5035528959", "MPB", false); $stylist->save(); $client1 = new Client("Steven", "5412232442", $stylist->getId()); $client1->save(); $client2 = new Client("Matthew", "5097869876", $stylist->getId()); $client2->save(); //Act $client2->delete(); $result = Client::getAll(); //Assert $this->assertEquals([$client1], $result); }
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()); }
public function delete($uri) { $this->client->delete($uri); }
<?php // TODO: Uncomment include "access.php"; include_once "../includes/SystemConfiguration.class.php"; global $systemConfiguration; global $logger; $id = 0; $errors = array(); $logger->LogInfo("Attempting to delete client ..."); if (isset($_GET['id']) && is_numeric($_GET['id'])) { $id = intval($_GET['id']); if (!Client::delete($id)) { $logger->LogError("Error deleting client."); foreach (Client::$staticErrors as $error) { $logger->LogError($error); $errors[] = $error; } } else { header("Location: clients_list.php"); } } else { $errors[] = "Invalid request: Client id was not set"; $logger->LogError("Client id is not set."); } include "header.php"; ?> </td> </tr>
public function unschedule($id) { $client = new Client($this->user, $this->token); $client->delete('schedules/' . $id); }
function testDelete() { //Arrange $id = null; $name = "Martha Stewart"; $phone = "(888) 888-8888"; $next_visit = "2015-09-06"; $stylist_id = 1; $test_client = new Client($id, $name, $phone, $next_visit, $stylist_id); $test_client->save(); $name2 = "Jennifer Lopez"; $phone2 = "(609) 999-9999"; $next_visit2 = "2015-10-12"; $stylist_id2 = 2; $test_client2 = new Client($id, $name2, $phone2, $next_visit2, $stylist_id2); $test_client2->save(); //Act $test_client->delete(); //Assert $result = Client::getAll(); $this->assertEquals([$test_client2], $result); }
<?php include_once "include/common.php"; include_once 'include/AccessRights/SuperadminAdminOnly.php'; $clientID = isset($_REQUEST["id"]) ? $_REQUEST["id"] : 0; $client = new Client(); $filter = array("client_id" => array($clientID, Equal)); $clientDetails = $client->getClients(array("client_id" => "ASC"), $filter); if (count($clientDetails) < 1) { header("Location: ClientDetails.php"); } $clientDetails = $clientDetails[0]; if (isset($_REQUEST["DeleteBtn"])) { if ($client->delete($clientID)) { header("Location: ClientDetails.php"); } else { echo "Can't proceed deleting " . $clientDetails->getFname() . " " . $clientDetails->getLname(); } } ?> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"> <title>Kusina Sa Plaza</title> <link href="Styles/tables.css" rel="stylesheet" /> <link href="Styles/tables-min.css" rel="stylesheet" /> <link href="Styles/buttons-core-min.css" rel="stylesheet" />
public function testResponseBody() { $client = new Client($this->testUrl); $client->get(); $this->assertEquals('OK', $client->getStatusMessage()); $client = new Client($this->testUrl); $client->post(); $this->assertEquals('OK', $client->getStatusMessage()); $client = new Client($this->testUrl); $client->put(); $this->assertEquals('OK', $client->getStatusMessage()); $client = new Client($this->testUrl); $client->patch(); $this->assertEquals('OK', $client->getStatusMessage()); $client = new Client($this->testUrl); $client->delete(); $this->assertEquals('OK', $client->getStatusMessage()); // TODO Why it gives OK? $client = new Client($this->testUrl); $client->head(); //$this->assertEquals('', $client->getStatusMessage()); $client = new Client($this->testUrl); $client->options(); $this->assertEquals('OK', $client->getStatusMessage()); }
function test_delete() { $name = "Sally"; $phone = "555-555-5555"; $id = null; $test_stylist = new Stylist($name, $phone, $id); $test_stylist->save(); $name = "Maggie"; $phone = "123-321-1234"; $stylist_id = $test_stylist->getId(); $test_client = new Client($name, $phone, $id, $stylist_id); $test_client->save(); $name2 = "Steve"; $phone2 = "999-777-6666"; $stylist_id2 = $test_stylist->getId(); $test_client2 = new Client($name2, $phone2, $id, $stylist_id2); $test_client2->save(); $test_client->delete(); $this->assertEquals([$test_client2], Client::getAll()); }