本文整理汇总了PHP中Task::deleteAll方法的典型用法代码示例。如果您正苦于以下问题:PHP Task::deleteAll方法的具体用法?PHP Task::deleteAll怎么用?PHP Task::deleteAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Task
的用法示例。
在下文中一共展示了Task::deleteAll方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_deleteAll
function test_deleteAll()
{
$description = "Wash the dog";
$description2 = "Water the lawn";
$test_Task = new Task($description);
$test_Task->save();
$test_Task2 = new Task($description2);
$test_Task2->save();
Task::deleteAll();
$result = Task::getAll();
$this->assertEquals([], $result);
}
示例2: test_deleteAll
function test_deleteAll()
{
//Arrange
$description = "Wash the dog";
$due_date = '2015-01-01';
$id = 1;
$test_task = new Task($description, $id, $due_date);
$test_task->save();
$description2 = "Water the lawn";
$id2 = 2;
$due_date = '2015-01-02';
$test_task2 = new Task($description2, $id, $due_date);
$test_task2->save();
//Act
Task::deleteAll();
//Asser
$result = Task::getAll();
$this->assertEquals([], $result);
}
示例3: test_deleteAll
function test_deleteAll()
{
// Arrange
$name = "Home stuff";
$id = null;
$test_category = new Category($name, $id);
$description = "Wash the dog";
$category_id = $test_category->getId();
$test_task = new Task($description, $id, $category_id);
$test_task->save();
$description2 = "Water the lawn";
$test_task2 = new Task($description2, $id, $category_id);
$test_task2->save();
// Act
Task::deleteAll();
// Assert
$result = Task::getAll();
$this->assertEquals([], $result);
}
示例4: test_deleteAll
function test_deleteAll()
{
//Arrange
$id = 1;
$description = "Wash the dog";
$date_due = "1990-12-11";
$time_due = "09:00:00";
$test_task = new Task($id, $description, $date_due, $time_due);
$test_task->save();
$id2 = 2;
$description2 = "Water the lawn";
$date_due2 = "1990-11-11";
$time_due2 = "09:01:00";
$test_task2 = new Task($id2, $description2, $date_due2, $time_due2);
$test_task2->save();
//act
Task::deleteAll();
//assert
$result = Task::getAll();
$this->assertEquals([], $result);
}
示例5: test_deleteAll
function test_deleteAll()
{
$name = "Home stuff";
$id = null;
$test_category = new Category($name, $id);
$test_category->save();
$description = "Wash the dog";
$date_due = "9/25/1990";
$time_due = "9:00am";
$category_id = $test_category->getId();
$test_task = new Task($id, $description, $date_due, $time_due, $category_id);
$test_task->save();
$description2 = "Water the Lawn";
$date_due2 = "3/28/2000";
$time_due2 = "10:00am";
$test_task2 = new Task($id, $description2, $date_due2, $time_due2, $category_id);
$test_task2->save();
Task::deleteAll();
$result = Task::getAll();
$this->assertEquals([], $result);
}
示例6: PDO
$password = 'root';
$DB = new PDO($server, $username, $password);
$app->register(new Silex\Provider\TwigServiceProvider(), array('twig.path' => __DIR__ . '/../views'));
$app->get("/", function () use($app) {
return $app['twig']->render('index.html.twig');
});
$app->get("/tasks", function () use($app) {
return $app['twig']->render('tasks.html.twig', array('tasks' => Task::getAll()));
});
$app->get("/categories", function () use($app) {
return $app['twig']->render('categories.html.twig', array('categories' => Category::getAll()));
});
$app->post("/tasks", function () use($app) {
$task = new task($_POST['description']);
$task->save();
return $app['twig']->render('tasks.html.twig', array('tasks' => Task::getAll()));
});
$app->post("/delete_tasks", function () use($app) {
Task::deleteAll();
return $app['twig']->render('index.html.twig');
});
$app->post("/categories", function () use($app) {
$category = new Category($_POST['name']);
$category->save();
return $app['twig']->render('categories.html.twig', array('categories' => Category::getAll()));
});
$app->post("/delete_categories", function () use($app) {
Category::deleteAll();
return $app['twig']->render('index.html.twig');
});
return $app;
示例7: tearDown
protected function tearDown()
{
Category::deleteAll();
Task::deleteAll();
}
示例8: testDeleteAll
function testDeleteAll()
{
//arrange
$description = "Wash the dog";
$id = 1;
$test_task = new Task($description, $id);
$test_task->save();
$description2 = "Water the lawn";
$id2 = 2;
$test_task2 = new Task($description2, $id);
$test_task2->save();
//act
Task::deleteAll();
//assert
$result = Task::getAll();
$this->assertEquals([], $result);
}
示例9: testBasicSearchTasks
/**
* @depends testUnprivilegedUserViewUpdateDeleteTasks
*/
public function testBasicSearchTasks()
{
$super = User::getByUsername('super');
Yii::app()->user->userModel = $super;
Task::deleteAll();
$anotherUser = User::getByUsername('steven');
$authenticationData = $this->login();
$headers = array('Accept: application/json', 'ZURMO_SESSION_ID: ' . $authenticationData['sessionId'], 'ZURMO_TOKEN: ' . $authenticationData['token'], 'ZURMO_API_REQUEST_TYPE: REST');
$firstAccount = AccountTestHelper::createAccountByNameTypeAndIndustryForOwner('First Account', 'Customer', 'Automotive', $super);
$secondAccount = AccountTestHelper::createAccountByNameTypeAndIndustryForOwner('Second Account', 'Customer', 'Automotive', $super);
TaskTestHelper::createTaskWithOwnerAndRelatedAccount('First Task', $super, $firstAccount);
TaskTestHelper::createTaskWithOwnerAndRelatedAccount('Second Task', $super, $firstAccount);
TaskTestHelper::createTaskWithOwnerAndRelatedAccount('Third Task', $super, $secondAccount);
TaskTestHelper::createTaskWithOwnerAndRelatedAccount('Forth Task', $anotherUser, $secondAccount);
TaskTestHelper::createTaskWithOwnerAndRelatedAccount('Fifth Task', $super, $firstAccount);
$searchParams = array('pagination' => array('page' => 1, 'pageSize' => 3), 'search' => array('name' => ''), 'sort' => 'name');
$searchParamsQuery = http_build_query($searchParams);
$response = $this->createApiCallWithRelativeUrl('list/filter/' . $searchParamsQuery, 'GET', $headers);
$response = json_decode($response, true);
$this->assertEquals(ApiResponse::STATUS_SUCCESS, $response['status']);
$this->assertEquals(3, count($response['data']['items']));
$this->assertEquals(5, $response['data']['totalCount']);
$this->assertEquals(1, $response['data']['currentPage']);
$this->assertEquals('Fifth Task', $response['data']['items'][0]['name']);
$this->assertEquals('First Task', $response['data']['items'][1]['name']);
$this->assertEquals('Forth Task', $response['data']['items'][2]['name']);
// Second page
$searchParams['pagination']['page'] = 2;
$searchParamsQuery = http_build_query($searchParams);
$response = $this->createApiCallWithRelativeUrl('list/filter/' . $searchParamsQuery, 'GET', $headers);
$response = json_decode($response, true);
$this->assertEquals(ApiResponse::STATUS_SUCCESS, $response['status']);
$this->assertEquals(2, count($response['data']['items']));
$this->assertEquals(5, $response['data']['totalCount']);
$this->assertEquals(2, $response['data']['currentPage']);
$this->assertEquals('Second Task', $response['data']['items'][0]['name']);
$this->assertEquals('Third Task', $response['data']['items'][1]['name']);
// Search by name
$searchParams['pagination']['page'] = 1;
$searchParams['search']['name'] = 'First Task';
$searchParamsQuery = http_build_query($searchParams);
$response = $this->createApiCallWithRelativeUrl('list/filter/' . $searchParamsQuery, 'GET', $headers);
$response = json_decode($response, true);
$this->assertEquals(ApiResponse::STATUS_SUCCESS, $response['status']);
$this->assertEquals(1, count($response['data']['items']));
$this->assertEquals(1, $response['data']['totalCount']);
$this->assertEquals(1, $response['data']['currentPage']);
$this->assertEquals('First Task', $response['data']['items'][0]['name']);
// No results
$searchParams['pagination']['page'] = 1;
$searchParams['search']['name'] = 'First Task 2';
$searchParamsQuery = http_build_query($searchParams);
$response = $this->createApiCallWithRelativeUrl('list/filter/' . $searchParamsQuery, 'GET', $headers);
$response = json_decode($response, true);
$this->assertEquals(ApiResponse::STATUS_SUCCESS, $response['status']);
$this->assertEquals(0, $response['data']['totalCount']);
$this->assertFalse(isset($response['data']['items']));
// Search by name desc.
$searchParams = array('pagination' => array('page' => 1, 'pageSize' => 3), 'search' => array('name' => ''), 'sort' => 'name.desc');
$searchParamsQuery = http_build_query($searchParams);
$response = $this->createApiCallWithRelativeUrl('list/filter/' . $searchParamsQuery, 'GET', $headers);
$response = json_decode($response, true);
$this->assertEquals(ApiResponse::STATUS_SUCCESS, $response['status']);
$this->assertEquals(3, count($response['data']['items']));
$this->assertEquals(5, $response['data']['totalCount']);
$this->assertEquals(1, $response['data']['currentPage']);
$this->assertEquals('Third Task', $response['data']['items'][0]['name']);
$this->assertEquals('Second Task', $response['data']['items'][1]['name']);
$this->assertEquals('Forth Task', $response['data']['items'][2]['name']);
// Second page
$searchParams['pagination']['page'] = 2;
$searchParamsQuery = http_build_query($searchParams);
$response = $this->createApiCallWithRelativeUrl('list/filter/' . $searchParamsQuery, 'GET', $headers);
$response = json_decode($response, true);
$this->assertEquals(ApiResponse::STATUS_SUCCESS, $response['status']);
$this->assertEquals(2, count($response['data']['items']));
$this->assertEquals(5, $response['data']['totalCount']);
$this->assertEquals(2, $response['data']['currentPage']);
$this->assertEquals('First Task', $response['data']['items'][0]['name']);
$this->assertEquals('Fifth Task', $response['data']['items'][1]['name']);
// Search by owner, order by name desc
$searchParams = array('pagination' => array('page' => 1, 'pageSize' => 3), 'search' => array('owner' => array('id' => $super->id)), 'sort' => 'name.desc');
$searchParamsQuery = http_build_query($searchParams);
$response = $this->createApiCallWithRelativeUrl('list/filter/' . $searchParamsQuery, 'GET', $headers);
$response = json_decode($response, true);
$this->assertEquals(ApiResponse::STATUS_SUCCESS, $response['status']);
$this->assertEquals(4, $response['data']['totalCount']);
$this->assertEquals(3, count($response['data']['items']));
$this->assertEquals(1, $response['data']['currentPage']);
$this->assertEquals('Third Task', $response['data']['items'][0]['name']);
$this->assertEquals('Second Task', $response['data']['items'][1]['name']);
$this->assertEquals('First Task', $response['data']['items'][2]['name']);
// Second page
$searchParams['pagination']['page'] = 2;
$searchParamsQuery = http_build_query($searchParams);
$response = $this->createApiCallWithRelativeUrl('list/filter/' . $searchParamsQuery, 'GET', $headers);
$response = json_decode($response, true);
//.........这里部分代码省略.........
示例10: testDeleteAll
function testDeleteAll()
{
//Arrange
$description = "Wash the dog";
$id = 1;
$due_date = null;
$completed = 0;
$test_task = new Task($description, $id, $completed, $due_date);
$test_task->save();
$description2 = "Water the lawn";
$id2 = 2;
$due_date2 = null;
$completed2 = 0;
$test_task2 = new Task($description2, $id2, $completed2, $due_date2);
$test_task2->save();
//Act
Task::deleteAll();
//Assert
$result = Task::getAll();
$this->assertEquals([], $result);
}
示例11: test_deleteAll
function test_deleteAll()
{
//Arrange
$due_date = "2015-10-12";
$description = "Wash the dog";
$test_task = new Task($description, $due_date, 1);
$test_task->save();
//$id2 = 2;
$description2 = "Water the lawn";
$test_task2 = new Task($description2, $due_date, 2);
$test_task2->save();
//Act
Task::deleteAll();
//Assert
$result = Task::getAll();
$this->assertEquals([], $result);
}
示例12: tearDown
protected function tearDown()
{
Task::deleteAll();
}
示例13: test_deleteAll
function test_deleteAll()
{
//Arrange
$task_name = "Wash the dog";
$due_date = "2015-08-25";
$id = 1;
$test_Task = new Task($task_name, $id, $due_date);
$test_Task->save();
$task_name2 = "Water the lawn";
$due_date2 = "2015-08-22";
$id2 = 2;
$test_Task2 = new Task($task_name2, $id2, $due_date2);
$test_Task2->save();
//Act
Task::deleteAll();
//Assert
$result = Task::getAll();
$this->assertEquals([], $result);
}