1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-09 20:52:56 +01:00

Fixes for tests

This commit is contained in:
David Bomba 2023-01-03 11:36:13 +11:00
parent 03d8864652
commit 0f9b705074
3 changed files with 539 additions and 477 deletions

957
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -4912,6 +4912,16 @@ $LANG = array(
'notification_purchase_order_sent' => 'The following vendor :vendor was emailed Purchase Order :purchase_order for :amount.',
'subscription_blocked' => 'This product is a restricted item, please contact the vendor for further information.',
'subscription_blocked_title' => 'Product not available.',
'purchase_order_created' => 'Purchase Order Created',
'purchase_order_sent' => 'Purchase Order Sent',
'purchase_order_viewed' => 'Purchase Order Viewed',
'purchase_order_accepted' => 'Purchase Order Accepted',
'credit_payment_error' => 'The credit amount can not be greater than the payment amount',
'convert_payment_currency_help' => 'Set an exchange rate when entering a manual payment',
'convert_expense_currency_help' => 'Set an exchange rate when creating an expense',
'matomo_url' => 'Matomo URL',
'matomo_id' => 'Matomo Id',
'action_add_to_invoice' => 'Add To Invoice',
);
return $LANG;

View File

@ -32,6 +32,7 @@ use App\Models\ClientContact;
use App\Models\Company;
use App\Models\CompanyGateway;
use App\Models\CompanyToken;
use App\Models\Credit;
use App\Models\CreditInvitation;
use App\Models\Expense;
use App\Models\ExpenseCategory;
@ -105,6 +106,11 @@ trait MockAccountData
*/
public $recurring_quote;
/**
* @var
*/
public $credit;
/**
* @var
*/
@ -477,6 +483,49 @@ trait MockAccountData
$this->quote->save();
$this->credit = Credit::factory()->create([
'user_id' => $user_id,
'client_id' => $this->client->id,
'company_id' => $this->company->id,
]);
$this->credit->line_items = $this->buildLineItems();
$this->credit->uses_inclusive_taxes = false;
$this->credit->save();
$this->credit_calc = new InvoiceSum($this->credit);
$this->credit_calc->build();
$this->credit = $this->credit_calc->getCredit();
$this->credit->status_id = Quote::STATUS_SENT;
$this->credit->number = $this->getNextCreditNumber($this->client, $this->credit);
//$this->quote->service()->createInvitations()->markSent();
CreditInvitation::factory()->create([
'user_id' => $user_id,
'company_id' => $this->company->id,
'client_contact_id' => $contact->id,
'credit_id' => $this->credit->id,
]);
CreditInvitation::factory()->create([
'user_id' => $user_id,
'company_id' => $this->company->id,
'client_contact_id' => $contact2->id,
'credit_id' => $this->credit->id,
]);
$this->credit->setRelation('client', $this->client);
$this->credit->setRelation('company', $this->company);
$this->credit->save();
$this->purchase_order = PurchaseOrderFactory::create($this->company->id, $user_id);
$this->purchase_order->vendor_id = $this->vendor->id;