1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-05 18:52:44 +01:00

Fixes for recurring invoices test

This commit is contained in:
David Bomba 2019-05-03 17:35:49 +10:00
parent 5bc41b4d79
commit 9f9f3439b4
4 changed files with 11 additions and 9 deletions

View File

@ -11,7 +11,7 @@ class RecurringInvoiceFactory
public static function create(int $company_id, int $user_id) :RecurringInvoice
{
$invoice = new RecurringInvoice();
$invoice->status_id = RecurringInvoice::STATUS_PENDING;
$invoice->status_id = RecurringInvoice::STATUS_DRAFT;
$invoice->discount = 0;
$invoice->is_amount_discount = true;
$invoice->po_number = '';

View File

@ -100,7 +100,7 @@ class RecurringInvoiceController extends BaseController
public function store(StoreRecurringInvoiceRequest $request)
{
$recurring_invoice = $this->RecurringInvoice_repo->save($request, RecurringInvoiceFactory::create(auth()->user()->company()->id, auth()->user()->id));
$recurring_invoice = $this->recurring_invoice_repo->save($request, RecurringInvoiceFactory::create(auth()->user()->company()->id, auth()->user()->id));
return $this->itemResponse($recurring_invoice);
@ -147,7 +147,7 @@ class RecurringInvoiceController extends BaseController
public function update(UpdateRecurringInvoiceRequest $request, RecurringInvoice $recurring_invoice)
{
$recurring_invoice = $this->RecurringInvoice_repo->save(request(), $recurring_invoice);
$recurring_invoice = $this->recurring_invoice_repo->save(request(), $recurring_invoice);
return $this->itemResponse($recurring_invoice);
@ -187,7 +187,7 @@ class RecurringInvoiceController extends BaseController
$recurring_invoices->each(function ($recurring_invoice, $key) use($action){
if(auth()->user()->can('edit', $recurring_invoice))
$this->RecurringInvoice_repo->{$action}($recurring_invoice);
$this->recurring_invoice_repo->{$action}($recurring_invoice);
});

View File

@ -19,10 +19,12 @@ class RecurringInvoice extends BaseModel
/**
* Invoice Statuses
*/
const STATUS_PENDING = 1;
const STATUS_ACTIVE = 2;
const STATUS_COMPLETED = 3;
const STATUS_CANCELLED = 4;
const STATUS_DRAFT = 2;
const STATUS_ACTIVE = 3;
const STATUS_PENDING = -1;
const STATUS_COMPLETED = -2;
const STATUS_CANCELLED = -3;
/**
* Recurring intervals

View File

@ -177,7 +177,7 @@ class RecurringInvoiceTest extends TestCase
$response->assertStatus(200);
$RecurringInvoice_update = [
'status_id' => RecurringInvoice::STATUS_PAID
'status_id' => RecurringInvoice::STATUS_DRAFT
];
$this->assertNotNull($RecurringInvoice);