Number tests for quotes and recurring invoices

This commit is contained in:
= 2021-03-20 11:21:50 +11:00
parent 7173ba2931
commit b74062b1ca
2 changed files with 39 additions and 1 deletions

View File

@ -86,7 +86,8 @@ class QuoteTest extends TestCase
$quote_update = [
'status_id' => Quote::STATUS_APPROVED,
// 'client_id' => $this->encodePrimaryKey($quote->client_id),
'client_id' => $this->encodePrimaryKey($this->quote->client_id),
'number' => 'Rando',
];
$this->assertNotNull($this->quote);
@ -98,6 +99,22 @@ class QuoteTest extends TestCase
$response->assertStatus(200);
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->put('/api/v1/quotes/'.$this->encodePrimaryKey($this->quote->id), $quote_update);
$response->assertStatus(200);
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->post('/api/v1/quotes/', $quote_update);
$response->assertStatus(302);
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,

View File

@ -117,6 +117,7 @@ class RecurringInvoiceTest extends TestCase
$RecurringInvoice_update = [
'status_id' => RecurringInvoice::STATUS_DRAFT,
'client_id' => $this->encodePrimaryKey($RecurringInvoice->client_id),
'number' => 'customnumber'
];
$this->assertNotNull($RecurringInvoice);
@ -127,6 +128,26 @@ class RecurringInvoiceTest extends TestCase
])->put('/api/v1/recurring_invoices/'.$this->encodePrimaryKey($RecurringInvoice->id), $RecurringInvoice_update)
->assertStatus(200);
$arr = $response->json();
$this->assertEquals('customnumber', $arr['data']['number']);
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->put('/api/v1/recurring_invoices/'.$this->encodePrimaryKey($RecurringInvoice->id), $RecurringInvoice_update)
->assertStatus(200);
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->post('/api/v1/recurring_invoices/', $RecurringInvoice_update)
->assertStatus(302);
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,