mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Tests for recurring invoice variables
This commit is contained in:
parent
050079b76a
commit
fd3d9aa931
@ -11,6 +11,7 @@
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Factory\InvoiceItemFactory;
|
||||
use App\Factory\InvoiceToRecurringInvoiceFactory;
|
||||
use App\Factory\RecurringInvoiceToInvoiceFactory;
|
||||
use App\Models\Client;
|
||||
@ -51,6 +52,51 @@ class RecurringInvoiceTest extends TestCase
|
||||
$this->makeTestData();
|
||||
}
|
||||
|
||||
public function testPostRecurringInvoiceWithPlaceholderVariables()
|
||||
{
|
||||
$line_items = [];
|
||||
|
||||
$item = InvoiceItemFactory::create();
|
||||
$item->quantity = 1;
|
||||
$item->cost = 10;
|
||||
$item->task_id = $this->encodePrimaryKey($this->task->id);
|
||||
$item->expense_id = $this->encodePrimaryKey($this->expense->id);
|
||||
$item->description = "Hello this is the month of :MONTH";
|
||||
|
||||
$line_items[] = $item;
|
||||
|
||||
|
||||
$data = [
|
||||
'frequency_id' => 1,
|
||||
'status_id' => 1,
|
||||
'discount' => 0,
|
||||
'is_amount_discount' => 1,
|
||||
'po_number' => '3434343',
|
||||
'public_notes' => 'notes',
|
||||
'is_deleted' => 0,
|
||||
'custom_value1' => 0,
|
||||
'custom_value2' => 0,
|
||||
'custom_value3' => 0,
|
||||
'custom_value4' => 0,
|
||||
'status' => 1,
|
||||
'client_id' => $this->encodePrimaryKey($this->client->id),
|
||||
'line_items' => $line_items,
|
||||
'remaining_cycles' => -1,
|
||||
];
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->post('/api/v1/recurring_invoices/', $data)
|
||||
->assertStatus(200);
|
||||
|
||||
$arr = $response->json();
|
||||
$this->assertEquals(RecurringInvoice::STATUS_DRAFT, $arr['data']['status_id']);
|
||||
|
||||
$this->assertIsArray($arr['data']['line_items']);
|
||||
}
|
||||
|
||||
|
||||
public function testPostRecurringInvoice()
|
||||
{
|
||||
$data = [
|
||||
|
Loading…
x
Reference in New Issue
Block a user