function testDeleteAll()
 {
     //Arrange
     $id = null;
     $name = "Nico";
     $stylist_id = 1;
     $test_client = new Client($id, $client_name, $stylist_id);
     $test_client->save();
     $name2 = "Al";
     $stylist_id2 = 2;
     $test_client2 = new Client($id, $client_name2, $stylist_id2);
     $test_client2->save();
     //Act
     Client::deleteAll();
     //Assert
     $result = Client::getAll();
     $this->assertEquals([], $result);
 }
Example #2
0
 function test_deleteAll()
 {
     //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 = "Harry";
     $test_client2 = new Client($client_name2, $id, $stylist_id);
     $test_client2->save();
     //Act
     Client::deleteAll();
     //Assert
     $result = Client::getAll();
     $this->assertEquals([], $result);
 }
Example #3
0
 function test_client_deleteAll()
 {
     //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 = "Mai Thai";
     $category_id = $test_cuisine->getId();
     $test_client2 = new Client($name2, $category_id);
     $test_client2->save();
     //Act
     Client::deleteAll();
     //Assert
     $result = Client::getAll();
     $this->assertEquals([], $result);
 }
Example #4
0
 function testDeleteAll()
 {
     //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
     Client::deleteAll();
     //Assert
     $result = Client::getAll();
     $this->assertEquals([], $result);
 }
Example #5
0
 function testDeleteAll()
 {
     //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
     Client::deleteAll();
     //Assert
     $result = Client::getAll();
     $this->assertEquals([], $result);
 }
 function test_deleteAll()
 {
     //Arrange
     $name = "Barbra Stylist";
     $id = null;
     $test_stylist = new Stylist($name, $id);
     $test_stylist->save();
     $name = "George";
     $id = null;
     $stylist_id = $test_stylist->getId();
     $test_Client = new Client($name, $stylist_id, $id, $visits, $description);
     $test_Client->save();
     $name2 = "Max";
     $id2 = null;
     $stylist_id2 = $test_stylist->getId();
     $visits2 = 3;
     $test_Client2 = new Client($name2, $stylist_id2, $id2, $visits2, $description);
     $test_Client2->save();
     //Act
     Client::deleteAll();
     //Assert
     $result = Client::getAll();
     $this->assertEquals([], $result);
 }
 function test_deleteAll()
 {
     //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
     Client::deleteAll();
     $result = Client::getAll();
     //Assert
     $this->assertEquals([], $result);
 }
Example #8
0
 function test_deleteAll()
 {
     //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
     Client::deleteAll();
     //Assert
     $result = Client::getAll();
     $this->assertEquals([], $result);
 }
Example #9
0
 function testDeleteAll()
 {
     $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();
     Client::deleteAll();
     $result = Client::getAll();
     $this->assertEquals([], $result);
 }
Example #10
0
 function test_deleteAll()
 {
     $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_name, $client_stylist_id);
     $test_client2->save();
     Client::deleteAll();
     $result = Client::getAll();
     $this->assertEquals([], $result);
 }
Example #11
0
 function test_deleteAll()
 {
     //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
     Client::deleteAll();
     $result = Client::getAll();
     //Assert
     $this->assertEquals([], $result);
 }
Example #12
0
 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);
 }
Example #13
0
 function test_deleteAll()
 {
     $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();
     Client::deleteAll();
     $result = Client::getAll();
     $this->assertEquals([], $result);
 }
Example #14
0
	public function actionDelete($id)
	{
		$orderModel = $this->loadModel($id);
		$cid = $orderModel->cid;//联系人ID
		if($orderModel->delete()){
			Yii::app()->user->setFlash('success','删除成功!');
			//删除房间信息
			$roomModel = new OrderRoom;
			$roomModel->deleteAll(array(
					'condition'=>"oid=$id",
					));
			//删除保险
			$insuranceModel = OrderInsurance::model()->find(array('condition'=>"oid=$id"));
			if($insuranceModel){
				$insuranceModel->delete();
			}
			//删除附加项(门票)
			$addsModel = new OrderAdditional;
			$addsModel->deleteAll(array('condition'=>"oid=$id"));
			//删除联系人
			$contacterModel = Contacter::model()->find(array('condition'=>"id=$cid and mid=0"));
			if($contacterModel){
				$contacterModel->delete();
			}
			//删除参团人信息
			$clientModel = new Client;
			$clientModel->deleteAll(array('condition'=>"oid=$id"));
		}else{
			Yii::app()->user->setFlash('error','删除失败!');
		}
		$this->redirect(array('list'));
		exit;
		
		/* // if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser
		if(!isset($_GET['ajax']))
			$this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('list')); */
	}
 function test_deleteAll()
 {
     //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);
     $client_name2 = "Ludacris";
     $stylist_id = $test_stylist->getId();
     $test_client2 = new Client($client_name2, $id, $stylist_id);
     //act
     Client::deleteAll();
     //assert
     $result = Client::getAll();
     $this->assertEquals([], $result);
 }
Example #16
0
 function test_deleteAll()
 {
     //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();
     //Act
     Client::deleteAll();
     //Assert
     $this->assertEquals([], Client::getAll());
 }
Example #17
0
 function test_deleteAll()
 {
     //Arrange
     $name = "elaine";
     $test_stylist = new Stylist($name);
     $test_stylist->save();
     $name = "joe";
     $phone = "123-456-7890";
     $style_choice = "cut";
     $stylist_id = $test_stylist->getId();
     $test_client = new Client($name, $phone, $style_choice, $stylist_id);
     $test_client->save();
     $name2 = "jerry";
     $phone2 = "123-456-7890";
     $style_choice2 = "trim";
     $test_client2 = new Client($name2, $phone2, $style_choice2, $stylist_id);
     $test_client2->save();
     //Act
     Client::deleteAll();
     //Assert
     $result = Client::getAll();
     $this->assertEquals([], $result);
 }
Example #18
0
    $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;
Example #19
0
 function test_deleteAll()
 {
     //Arrange
     $stylist_name = "Ed Scissorhands";
     $id = null;
     $test_stylist = new Stylist($stylist_name, $id);
     $test_stylist->save();
     $client_name = "Bed Head";
     $stylist_id = $test_stylist->getId();
     $test_client = new Client($client_name, $id, $stylist_id);
     $test_client->save();
     //Act
     $result = Client::deleteAll();
     $result = Client::getAll();
     //Assert
     $this->assertEquals([], $result);
 }
Example #20
0
 function test_deleteAll()
 {
     //Arrange
     $name = "Becky";
     $id = null;
     $test_stylist = new Stylist($name, $id);
     $test_stylist->save();
     $client = "Mark";
     $phone = "123-456-7890";
     $stylist_id = $test_stylist->getId();
     $test_client = new Client($client, $phone, $stylist_id, $id);
     $test_client->save();
     $client2 = "Sammy";
     $phone2 = "234-555-5555";
     $stylist_id2 = $test_stylist->getId();
     $test_client2 = new Client($client, $phone, $stylist_id, $id);
     $test_client2->save();
     //Act
     Client::deleteAll();
     //Assert
     $result = Client::getAll();
     $this->assertEquals([], $result);
 }
 protected function tearDown()
 {
     Stylist::deleteAll();
     Client::deleteAll();
 }
Example #22
0
 function test_deleteAll()
 {
     //Arrange
     $stylist_name = "Big Bird";
     $id = null;
     $test_stylist = new Stylist($stylist_name, $id);
     $test_stylist->save();
     $client_name = "Harry Potter";
     $stylist_id = $test_stylist->getId();
     $test_client = new Client($client_name, $stylist_id);
     $test_client->save();
     //Act
     $result = Client::deleteAll();
     $result = Client::getAll();
     //Assert
     $this->assertEquals([], $result);
 }