diff --git a/app/Repositories/TaskRepository.php b/app/Repositories/TaskRepository.php index 2717f11dc9d5..3954c9515771 100644 --- a/app/Repositories/TaskRepository.php +++ b/app/Repositories/TaskRepository.php @@ -182,4 +182,14 @@ class TaskRepository extends BaseRepository }); } + + public function start(Task $task) + { + + } + + public function stop(Task $task) + { + + } } diff --git a/tests/Feature/TaskApiTest.php b/tests/Feature/TaskApiTest.php index e401ed05e4f4..a89eea1a3231 100644 --- a/tests/Feature/TaskApiTest.php +++ b/tests/Feature/TaskApiTest.php @@ -41,6 +41,39 @@ class TaskApiTest extends TestCase Model::reguard(); } + public function testStartTask() + { + $log = [ + [2,1], + [10,20] + ]; + + $last = end($log); + + $this->assertEquals(10, $last[0]); + $this->assertEquals(20, $last[1]); + + $new = [time(), 0]; + + array_push($log, $new); + + $this->assertEquals(3, count($log)); + + + //test task is started + $last = end($log); + $this->assertTrue($last[1] === 0); + + //stop task + $last = end($log); + $last[1] = time(); + + $this->assertTrue($last[1] !== 0) + + + } + + public function testTaskPost() { $data = [