1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-08 20:22:42 +01:00

Fixes for tests

This commit is contained in:
David Bomba 2024-09-04 08:13:53 +10:00
parent 12efe721d1
commit e491231090
3 changed files with 15 additions and 8 deletions

View File

@ -72,6 +72,9 @@ class TaskStatusRepository extends BaseRepository
} elseif($ts->status_order >= $task_status->status_order) {
$ts->status_order++;
$ts->save();
} else {
$ts->status_order = 99999;
$ts->save();
}
});

View File

@ -148,7 +148,6 @@ class AutoBillInvoice extends AbstractService
]);
nlog("Payment hash created => {$payment_hash->id}");
$this->invoice->saveQuietly();
$payment = false;
try {
@ -163,7 +162,6 @@ class AutoBillInvoice extends AbstractService
}
$this->invoice = $this->invoice->fresh();
$this->invoice->auto_bill_tries += 1;
if ($this->invoice->auto_bill_tries == 3) {

View File

@ -46,11 +46,15 @@ class TaskStatusApiTest extends TestCase
public function testSorting()
{
TaskStatus::factory()->count(5)->create([
'company_id' => $this->company->id,
'user_id' => $this->user->id
]);
TaskStatus::query()->where('company_id', $this->company->id)->cursor()->each(function ($ts){
$ts->forceDelete();
});
TaskStatus::factory()->count(10)->create([
'company_id' => $this->company->id,
'user_id' => $this->user->id,
'status_order' => 99999,
]);
$t = TaskStatus::where('company_id', '=', $this->company->id)->orderBy('id', 'desc');
@ -59,7 +63,6 @@ class TaskStatusApiTest extends TestCase
$id = $task_status->id;
$data = [
'status_order' => 1,
];
@ -69,7 +72,10 @@ class TaskStatusApiTest extends TestCase
'X-API-TOKEN' => $this->token,
])->put('/api/v1/task_statuses/'.$task_status->hashed_id, $data);
$t = TaskStatus::where('company_id', '=', $this->company->id)->orderBy('status_order', 'asc')->first();
$xx = TaskStatus::where('company_id', $this->company->id)->pluck('status_order');
$t = TaskStatus::where('company_id', $this->company->id)->orderBy('status_order', 'asc')->first();
$this->assertEquals($id, $t->id);