Task Status Order tests
This commit is contained in:
parent
fd4ffe4195
commit
24ed1922fc
|
|
@ -274,14 +274,12 @@ class TaskController extends BaseController
|
|||
}
|
||||
|
||||
$old_task_status_order = $task->status_order;
|
||||
// $old_task = json_decode(json_encode($task));
|
||||
|
||||
$task = $this->task_repo->save($request->all(), $task);
|
||||
|
||||
$task = $this->task_repo->triggeredActions($request, $task);
|
||||
|
||||
if ($task->status_order != $old_task_status_order) {
|
||||
// if ($task->status_order != $old_task->status_order) {
|
||||
if (is_null($task->status_order) || $task->status_order != $old_task_status_order) {
|
||||
$this->task_repo->sortStatuses($task);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -329,7 +329,7 @@ class TaskRepository extends BaseRepository
|
|||
$task = $this->stop($task);
|
||||
}
|
||||
|
||||
return $task;
|
||||
return $task->fresh();
|
||||
}
|
||||
|
||||
private function init(Task $task): self
|
||||
|
|
|
|||
|
|
@ -11,13 +11,14 @@
|
|||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use Tests\TestCase;
|
||||
use App\Models\Task;
|
||||
use App\Models\TaskStatus;
|
||||
use Tests\MockAccountData;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
use Illuminate\Support\Facades\Session;
|
||||
use Tests\MockAccountData;
|
||||
use Tests\TestCase;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -44,6 +45,28 @@ class TaskStatusApiTest extends TestCase
|
|||
Model::reguard();
|
||||
}
|
||||
|
||||
public function testTaskStatusProperty()
|
||||
{
|
||||
$t = Task::factory()->create([
|
||||
'company_id' => $this->company->id,
|
||||
'user_id' => $this->user->id,
|
||||
]);
|
||||
|
||||
$this->assertNull($t->status_order);
|
||||
|
||||
$update = [
|
||||
'description' => 'newdescription'
|
||||
];
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->put('/api/v1/tasks/'.$t->hashed_id, $update);
|
||||
|
||||
$response->assertStatus(200);
|
||||
|
||||
}
|
||||
|
||||
public function testSorting()
|
||||
{
|
||||
TaskStatus::query()->where('company_id', $this->company->id)->cursor()->each(function ($ts){
|
||||
|
|
|
|||
Loading…
Reference in New Issue