コード例 #1
0
ファイル: HabitTest.php プロジェクト: ashlinaronin/lifecoach
 function testFind()
 {
     $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();
     $result = Habit::find($test_habit->getId());
     $this->assertEquals($test_habit, $result);
 }
コード例 #2
0
ファイル: HabitTest.php プロジェクト: r-hills/live_test
 function testGet2DaysCompleted()
 {
     $name = "Meditate";
     $motivation = "Clarity";
     $interval_days = 5;
     $completed = False;
     $test_habit = new Habit($name, $motivation, $interval_days, $completed);
     $test_habit->save();
     $test_habit_id = $test_habit->getId();
     $test_habit->countHabitLength($test_habit_id);
     $test_habit->completeOnDayId($test_habit_id);
     $result = $test_habit->getDaysCompleted($test_habit_id) + $test_habit->getDaysCompleted($test_habit_id);
     $this->assertEquals(2, $result);
 }