mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Add status_id filters
This commit is contained in:
parent
c67e6c9259
commit
45bcbe85cb
@ -114,6 +114,23 @@ class InvoiceFilters extends QueryFilters
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Builder
|
||||||
|
* @throws RuntimeException
|
||||||
|
*/
|
||||||
|
public function status_id(string $status = ''): Builder
|
||||||
|
{
|
||||||
|
|
||||||
|
if (strlen($status) == 0) {
|
||||||
|
return $this->builder;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->builder->whereIn('status_id', explode(",", $status));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Builder
|
* @return Builder
|
||||||
* @throws RuntimeException
|
* @throws RuntimeException
|
||||||
|
@ -33,6 +33,8 @@ class InvoiceTest extends TestCase
|
|||||||
use DatabaseTransactions;
|
use DatabaseTransactions;
|
||||||
use MockAccountData;
|
use MockAccountData;
|
||||||
|
|
||||||
|
public $faker;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp() :void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
@ -47,6 +49,24 @@ class InvoiceTest extends TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function testInvoiceGetPaidReversedInvoice()
|
||||||
|
{
|
||||||
|
$this->invoice->service()->handleReversal()->save();
|
||||||
|
|
||||||
|
$this->assertEquals(6, $this->invoice->fresh()->status_id);
|
||||||
|
|
||||||
|
$response = $this->withHeaders([
|
||||||
|
'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
|
'X-API-TOKEN' => $this->token,
|
||||||
|
])->get('/api/v1/invoices?status_id=6', )
|
||||||
|
->assertStatus(200);
|
||||||
|
|
||||||
|
$arr = $response->json();
|
||||||
|
|
||||||
|
$this->assertCount(1, $arr['data']);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public function testInvoiceGetPaidInvoices()
|
public function testInvoiceGetPaidInvoices()
|
||||||
{
|
{
|
||||||
$response = $this->withHeaders([
|
$response = $this->withHeaders([
|
||||||
|
Loading…
x
Reference in New Issue
Block a user