1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-14 07:02:34 +01:00
invoiceninja/tests/Feature/TaskStatusSortOnUpdateTest.php

95 lines
2.5 KiB
PHP
Raw Normal View History

2021-02-24 03:12:23 +01:00
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
*
2022-06-08 06:25:44 +02:00
* @license https://www.elastic.co/licensing/elastic-license
2021-02-24 03:12:23 +01:00
*/
namespace Tests\Feature;
use App\Models\Project;
use App\Models\Task;
use App\Models\TaskStatus;
use App\Utils\Traits\MakesHash;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Illuminate\Routing\Middleware\ThrottleRequests;
use Tests\MockAccountData;
use Tests\TestCase;
/**
* @test
*/
class TaskStatusSortOnUpdateTest extends TestCase
{
use DatabaseTransactions;
use MockAccountData;
use MakesHash;
public function setUp() :void
{
parent::setUp();
$this->makeTestData();
$this->withoutMiddleware(
ThrottleRequests::class
);
}
2021-04-13 23:47:52 +02:00
// public function testTasksSort()
// {
2021-02-24 03:12:23 +01:00
2021-04-13 23:47:52 +02:00
// $project = Project::factory()->create([
// 'user_id' => $this->user->id,
// 'company_id' => $this->company->id,
// 'name' => 'Test Project',
// ]);
2021-02-24 03:12:23 +01:00
2021-04-13 23:47:52 +02:00
// for($x=0; $x<10; $x++)
// {
// $task = Task::factory()->create([
// 'user_id' => $this->user->id,
// 'company_id' => $this->company->id,
// 'project_id' => $project->id
// ]);
2021-02-24 03:12:23 +01:00
2021-04-13 23:47:52 +02:00
// $task->status_id = TaskStatus::where('company_id', $this->company->id)->first()->id;
// $task->save();
// }
2021-02-24 03:12:23 +01:00
2021-04-13 23:47:52 +02:00
// $this->assertTrue($task->project()->exists());
// $this->assertEquals($task->project->tasks->count(), 10);
2021-02-24 03:12:23 +01:00
2021-04-13 23:47:52 +02:00
// $task->status_order = 1;
2021-02-24 03:12:23 +01:00
2021-04-13 23:47:52 +02:00
// $response = $this->withHeaders([
// 'X-API-SECRET' => config('ninja.api_secret'),
// 'X-API-TOKEN' => $this->token,
// ])->put('/api/v1/tasks/'.$this->encodePrimaryKey($task->id), $task->toArray());
2021-02-24 03:12:23 +01:00
2021-04-13 23:47:52 +02:00
// $response->assertStatus(200);
2021-02-24 03:12:23 +01:00
2021-04-13 23:47:52 +02:00
// $this->assertEquals($task->fresh()->status_order, 1);
2021-02-24 03:12:23 +01:00
2021-04-13 23:47:52 +02:00
// $task->status_order = 10;
2021-02-24 03:12:23 +01:00
2021-04-13 23:47:52 +02:00
// $response = $this->withHeaders([
// 'X-API-SECRET' => config('ninja.api_secret'),
// 'X-API-TOKEN' => $this->token,
// ])->put('/api/v1/tasks/'.$this->encodePrimaryKey($task->id), $task->toArray());
2021-02-24 03:12:23 +01:00
2021-04-13 23:47:52 +02:00
// $response->assertStatus(200);
2021-02-24 03:12:23 +01:00
2021-04-13 23:47:52 +02:00
// nlog($task->fresh()->project->tasks->toArray());
2021-02-24 03:12:23 +01:00
2021-04-13 23:47:52 +02:00
// $this->assertEquals($task->fresh()->status_order, 9);
2021-02-24 03:12:23 +01:00
2021-04-13 23:47:52 +02:00
// }
2021-02-24 03:12:23 +01:00
}