function testGetActiveHabitCount2() { $name = "Meditate"; $motivation = "Clarity"; $interval_days = 5; $completed = False; $test_habit = new Habit($name, $motivation, $interval_days, $completed); $test_habit->save(); $name2 = "Go running"; $motivation2 = "Fitness"; $interval_days2 = 35; $id2 = 5; $completed2 = False; $test_habit2 = new Habit($name2, $motivation2, $interval_days2, $completed2, $id2); $test_habit2->save(); $result = Habit::getActiveHabitCount(); $this->assertEquals(2, $result); }
function testDelete() { $name = "Meditate"; $motivation = "Clarity"; $interval_days = 3; $id = 4; $completed = False; $test_habit = new Habit($name, $motivation, $interval_days, $completed, $id); $test_habit->save(); $name2 = "Go running"; $motivation2 = "Fitness"; $interval_days2 = 35; $id2 = 5; $completed2 = False; $test_habit2 = new Habit($name2, $motivation2, $interval_days2, $completed2, $id2); $test_habit2->save(); $test_habit->delete(); $this->assertEquals([$test_habit2], Habit::getAll()); }
** Each does the action from the previous page. ** The Twig templates will be responsive to display only the aspects ** of an in-progress habit which have already been defined. */ $coach_new_habit->get('/name', function () use($app) { return $app['twig']->render('coach/new_habit/1new_habit_name.html.twig'); }); /* 2. Create a new project with name from last form and dummy values for other properties. ** We don't have an id yet, so can't use it in URL. ** Then, display project as is so far. */ $coach_new_habit->post('/motivation', function () use($app) { $name = $_POST['name']; $motivation = null; $interval_days = 0; $completed = false; $habit = new Habit($name, $motivation, $interval_days, $completed); $habit->save(); return $app['twig']->render('coach/new_habit/2new_habit_motivation.html.twig', array('habits' => Habit::getAll(), 'habit' => $habit)); }); /* 3. Add motivation from last form to habit. ** Show habit as is so far. ** Prompt user to brain dump pre-reqs. */ $coach_new_habit->post('/{id}/prereqs', function ($id) use($app) { $habit = Habit::find($id); if (!empty($_POST['motivation'])) { $habit->updateMotivation($_POST['motivation']); } else { // some kind of error here } return $app['twig']->render('coach/new_habit/3prereqs.html.twig', array('habit' => $habit)); }); /* 4. Add a new step if we have $_POST for it at the appropriate position.