function testDeleteAll() { $category_name = "music"; $new_category = new Category($category_name); $new_category->save(); $category_name2 = "arts"; $new_category2 = new Category($category_name); $new_category2->save(); Category::deleteAll(); $result = Category::GetAll(); $this->assertEquals([], $result); }
function test_deleteAll() { $name = "Wash the dog"; $name2 = "Home stuff"; $test_Category = new Category($name); $test_Category->save(); $test_Category2 = new Category($name2); $test_Category2->save(); Category::deleteAll(); $result = Category::getAll(); $this->assertEquals([], $result); }
$password = '******'; $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;
protected function tearDown() { Task::deleteAll(); Category::deleteAll(); }
function testDeleteAll() { //Arrange $name = "Wash the dog"; $id = 1; $test_category = new Category($name, $id); $test_category->save(); $name2 = "Water the lawn"; $id2 = 2; $test_category2 = new Category($name2, $id2); $test_category2->save(); //Act Category::deleteAll(); //Assert $result = Category::getAll(); $this->assertEquals([], $result); }
function test_deleteAll() { //arrange $name = "Business"; $id = null; $test_category = new Category($name, $id); $test_category->save(); $name2 = "Personal"; $test_category2 = new Category($name, $id); $test_category2->save(); //act Category::deleteAll(); //assert $result = Category::getAll(); $this->assertEquals([], $result); }
function test_deleteAll() { //Arrange $name = "Wash the dog"; $id1 = 1; $name2 = "Home stuff"; $test_Category = new Category($name, $id1); $test_Category->save(); $id2 = 2; $test_Category2 = new Category($name2, $id2); $test_Category2->save(); //Act Category::deleteAll(); $result = Category::getAll(); //Assert $this->assertEquals([], $result); }
protected function tearDown() { Contact::deleteAll(); Category::deleteAll(); }