mirror of
https://github.com/InvoiceShelf/InvoiceShelf.git
synced 2026-04-19 11:14:06 +00:00
Setup pint & run code style fix
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use Illuminate\Support\Facades\Queue;
|
||||
use InvoiceShelf\Jobs\CreateBackupJob;
|
||||
use InvoiceShelf\Models\FileDisk;
|
||||
use InvoiceShelf\Models\User;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use Illuminate\Support\Facades\Queue;
|
||||
use Laravel\Sanctum\Sanctum;
|
||||
|
||||
use function Pest\Laravel\getJson;
|
||||
use function Pest\Laravel\postJson;
|
||||
|
||||
@@ -43,15 +44,15 @@ test('create backup', function () {
|
||||
'file_disk_id' => $disk->id,
|
||||
];
|
||||
|
||||
$response = postJson("/api/v1/backups", $data);
|
||||
$response = postJson('/api/v1/backups', $data);
|
||||
|
||||
Queue::assertPushed(CreateBackupJob::class);
|
||||
|
||||
$response = getJson("/api/v1/backups?disk={$disk->driver}&&file_disk_id={$disk->id}");
|
||||
|
||||
$response->assertStatus(200)->assertJson([
|
||||
"disks" => [
|
||||
"local",
|
||||
'disks' => [
|
||||
'local',
|
||||
],
|
||||
]);
|
||||
});
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use InvoiceShelf\Http\Controllers\V1\Admin\Settings\CompanyController;
|
||||
use InvoiceShelf\Http\Requests\CompanyRequest;
|
||||
use InvoiceShelf\Http\Requests\ProfileRequest;
|
||||
@@ -7,8 +8,8 @@ use InvoiceShelf\Models\Invoice;
|
||||
use InvoiceShelf\Models\InvoiceItem;
|
||||
use InvoiceShelf\Models\Tax;
|
||||
use InvoiceShelf\Models\User;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use Laravel\Sanctum\Sanctum;
|
||||
|
||||
use function Pest\Laravel\getJson;
|
||||
use function Pest\Laravel\postJson;
|
||||
use function Pest\Laravel\putJson;
|
||||
@@ -32,7 +33,6 @@ test('get profile', function () {
|
||||
->assertOk();
|
||||
});
|
||||
|
||||
|
||||
test('update profile using a form request', function () {
|
||||
$this->assertActionUsesFormRequest(
|
||||
CompanyController::class,
|
||||
@@ -77,8 +77,8 @@ test('update company', function () {
|
||||
'phone' => '1234567890',
|
||||
'zip' => '112233',
|
||||
'address' => [
|
||||
'country_id' => 2
|
||||
]
|
||||
'country_id' => 2,
|
||||
],
|
||||
];
|
||||
|
||||
putJson('api/v1/company', $company)
|
||||
@@ -125,7 +125,7 @@ test('update settings', function () {
|
||||
|
||||
test('update settings without currency setting', function () {
|
||||
$settings = [
|
||||
'notification_email' => 'noreply@crater.in',
|
||||
'notification_email' => 'noreply@invoiceshelf.com',
|
||||
];
|
||||
|
||||
$response = postJson('/api/v1/company/settings', ['settings' => $settings]);
|
||||
@@ -170,10 +170,9 @@ test('update currency settings after company has currency and transactions is no
|
||||
$response->assertOK()
|
||||
->assertJson([
|
||||
'success' => false,
|
||||
'message' => 'Cannot update company currency after transactions are created.'
|
||||
'message' => 'Cannot update company currency after transactions are created.',
|
||||
]);
|
||||
|
||||
|
||||
$this->assertDatabaseHas('company_settings', [
|
||||
'option' => 'currency',
|
||||
'value' => 1,
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use InvoiceShelf\Http\Controllers\V1\Admin\Company\CompaniesController;
|
||||
use InvoiceShelf\Http\Requests\CompaniesRequest;
|
||||
use InvoiceShelf\Models\Company;
|
||||
use InvoiceShelf\Models\User;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use Laravel\Sanctum\Sanctum;
|
||||
|
||||
use function Pest\Laravel\getJson;
|
||||
use function Pest\Laravel\postJson;
|
||||
|
||||
@@ -35,8 +36,8 @@ test('store company', function () {
|
||||
$company = Company::factory()->raw([
|
||||
'currency' => 12,
|
||||
'address' => [
|
||||
'country_id' => 12
|
||||
]
|
||||
'country_id' => 12,
|
||||
],
|
||||
]);
|
||||
|
||||
postJson('/api/v1/companies', $company)
|
||||
@@ -44,7 +45,7 @@ test('store company', function () {
|
||||
|
||||
$company = collect($company)
|
||||
->only([
|
||||
'name'
|
||||
'name',
|
||||
])
|
||||
->toArray();
|
||||
|
||||
@@ -52,7 +53,7 @@ test('store company', function () {
|
||||
});
|
||||
|
||||
test('delete company', function () {
|
||||
postJson('/api/v1/companies/delete', ["xyz"])
|
||||
postJson('/api/v1/companies/delete', ['xyz'])
|
||||
->assertStatus(422);
|
||||
});
|
||||
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
<?php
|
||||
|
||||
use InvoiceShelf\Models\User;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use InvoiceShelf\Models\User;
|
||||
use Laravel\Sanctum\Sanctum;
|
||||
|
||||
use function Pest\Laravel\getJson;
|
||||
|
||||
beforeEach(function () {
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
<?php
|
||||
|
||||
use InvoiceShelf\Models\User;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use InvoiceShelf\Models\User;
|
||||
use Laravel\Sanctum\Sanctum;
|
||||
|
||||
use function Pest\Laravel\getJson;
|
||||
|
||||
beforeEach(function () {
|
||||
@@ -20,6 +21,6 @@ beforeEach(function () {
|
||||
});
|
||||
|
||||
test('get all used currencies', function () {
|
||||
getJson("/api/v1/currencies/used")
|
||||
getJson('/api/v1/currencies/used')
|
||||
->assertOk();
|
||||
});
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use InvoiceShelf\Http\Controllers\V1\Admin\CustomField\CustomFieldsController;
|
||||
use InvoiceShelf\Http\Requests\CustomFieldRequest;
|
||||
use InvoiceShelf\Models\CustomField;
|
||||
use InvoiceShelf\Models\User;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use Laravel\Sanctum\Sanctum;
|
||||
|
||||
use function Pest\Laravel\deleteJson;
|
||||
use function Pest\Laravel\getJson;
|
||||
use function Pest\Laravel\postJson;
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use InvoiceShelf\Http\Controllers\V1\Admin\Customer\CustomersController;
|
||||
use InvoiceShelf\Http\Requests\CustomerRequest;
|
||||
use InvoiceShelf\Models\Customer;
|
||||
use InvoiceShelf\Models\Invoice;
|
||||
use InvoiceShelf\Models\User;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use Laravel\Sanctum\Sanctum;
|
||||
|
||||
use function Pest\Laravel\getJson;
|
||||
use function Pest\Laravel\postJson;
|
||||
use function Pest\Laravel\putJson;
|
||||
@@ -47,12 +48,12 @@ test('create customer', function () {
|
||||
$customer = Customer::factory()->raw([
|
||||
'shipping' => [
|
||||
'name' => 'newName',
|
||||
'address_street_1' => 'address'
|
||||
'address_street_1' => 'address',
|
||||
],
|
||||
'billing' => [
|
||||
'name' => 'newName',
|
||||
'address_street_1' => 'address'
|
||||
]
|
||||
'address_street_1' => 'address',
|
||||
],
|
||||
]);
|
||||
|
||||
postJson('api/v1/customers', $customer)
|
||||
@@ -60,7 +61,7 @@ test('create customer', function () {
|
||||
|
||||
$this->assertDatabaseHas('customers', [
|
||||
'name' => $customer['name'],
|
||||
'email' => $customer['email']
|
||||
'email' => $customer['email'],
|
||||
]);
|
||||
});
|
||||
|
||||
@@ -80,7 +81,7 @@ test('get customer', function () {
|
||||
$this->assertDatabaseHas('customers', [
|
||||
'id' => $customer->id,
|
||||
'name' => $customer['name'],
|
||||
'email' => $customer['email']
|
||||
'email' => $customer['email'],
|
||||
]);
|
||||
|
||||
$response->assertOk();
|
||||
@@ -92,22 +93,22 @@ test('update customer', function () {
|
||||
$customer1 = Customer::factory()->raw([
|
||||
'shipping' => [
|
||||
'name' => 'newName',
|
||||
'address_street_1' => 'address'
|
||||
'address_street_1' => 'address',
|
||||
],
|
||||
'billing' => [
|
||||
'name' => 'newName',
|
||||
'address_street_1' => 'address'
|
||||
]
|
||||
'address_street_1' => 'address',
|
||||
],
|
||||
]);
|
||||
|
||||
$response = putJson('api/v1/customers/'.$customer->id, $customer1);
|
||||
|
||||
$customer1 = collect($customer1)
|
||||
->only([
|
||||
'email'
|
||||
'email',
|
||||
])
|
||||
->merge([
|
||||
'creator_id' => Auth::id()
|
||||
'creator_id' => Auth::id(),
|
||||
])
|
||||
->toArray();
|
||||
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
<?php
|
||||
|
||||
use InvoiceShelf\Models\User;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use InvoiceShelf\Models\User;
|
||||
use Laravel\Sanctum\Sanctum;
|
||||
|
||||
use function Pest\Laravel\getJson;
|
||||
|
||||
beforeEach(function () {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use InvoiceShelf\Http\Controllers\V1\Admin\Estimate\EstimatesController;
|
||||
use InvoiceShelf\Http\Controllers\V1\Admin\Estimate\SendEstimateController;
|
||||
use InvoiceShelf\Http\Requests\DeleteEstimatesRequest;
|
||||
@@ -10,7 +11,6 @@ use InvoiceShelf\Models\Estimate;
|
||||
use InvoiceShelf\Models\EstimateItem;
|
||||
use InvoiceShelf\Models\Tax;
|
||||
use InvoiceShelf\Models\User;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use Laravel\Sanctum\Sanctum;
|
||||
|
||||
use function Pest\Laravel\getJson;
|
||||
@@ -85,7 +85,7 @@ test('update estimate', function () {
|
||||
$estimate2 = Estimate::factory()->raw([
|
||||
'items' => [
|
||||
EstimateItem::factory()->raw([
|
||||
'estimate_id' => $estimate->id
|
||||
'estimate_id' => $estimate->id,
|
||||
]),
|
||||
],
|
||||
'taxes' => [
|
||||
@@ -302,7 +302,7 @@ test('create estimate with tax per item', function () {
|
||||
]);
|
||||
|
||||
$this->assertDatabaseHas('taxes', [
|
||||
'tax_type_id' => $estimate['items'][0]['taxes'][0]['tax_type_id']
|
||||
'tax_type_id' => $estimate['items'][0]['taxes'][0]['tax_type_id'],
|
||||
]);
|
||||
});
|
||||
|
||||
@@ -358,12 +358,12 @@ test('create estimate with EUR currency', function () {
|
||||
|
||||
$this->assertDatabaseHas('taxes', [
|
||||
'tax_type_id' => $estimate['taxes'][0]['tax_type_id'],
|
||||
'amount' => $estimate['tax']
|
||||
'amount' => $estimate['tax'],
|
||||
]);
|
||||
|
||||
$this->assertDatabaseHas('estimate_items', [
|
||||
'item_id' => $estimate['items'][0]['item_id'],
|
||||
'name' => $estimate['items'][0]['name']
|
||||
'name' => $estimate['items'][0]['name'],
|
||||
]);
|
||||
});
|
||||
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use InvoiceShelf\Http\Controllers\V1\Admin\Expense\ExpenseCategoriesController;
|
||||
use InvoiceShelf\Http\Requests\ExpenseCategoryRequest;
|
||||
use InvoiceShelf\Models\ExpenseCategory;
|
||||
use InvoiceShelf\Models\User;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use Laravel\Sanctum\Sanctum;
|
||||
|
||||
use function Pest\Laravel\deleteJson;
|
||||
use function Pest\Laravel\getJson;
|
||||
use function Pest\Laravel\postJson;
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use InvoiceShelf\Http\Controllers\V1\Admin\Expense\ExpensesController;
|
||||
use InvoiceShelf\Http\Requests\ExpenseRequest;
|
||||
use InvoiceShelf\Models\Expense;
|
||||
use InvoiceShelf\Models\User;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use Laravel\Sanctum\Sanctum;
|
||||
|
||||
use function Pest\Laravel\getJson;
|
||||
use function Pest\Laravel\postJson;
|
||||
use function Pest\Laravel\putJson;
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use InvoiceShelf\Models\FileDisk;
|
||||
use InvoiceShelf\Models\User;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use Laravel\Sanctum\Sanctum;
|
||||
|
||||
use function Pest\Laravel\getJson;
|
||||
use function Pest\Laravel\postJson;
|
||||
use function Pest\Laravel\putJson;
|
||||
@@ -37,7 +38,6 @@ test('create file disk', function () {
|
||||
$this->assertDatabaseHas('file_disks', $disk);
|
||||
});
|
||||
|
||||
|
||||
test('update file disk', function () {
|
||||
$disk = FileDisk::factory()->create();
|
||||
|
||||
@@ -50,7 +50,6 @@ test('update file disk', function () {
|
||||
$this->assertDatabaseHas('file_disks', $disk2);
|
||||
});
|
||||
|
||||
|
||||
test('get disk', function () {
|
||||
$disk = FileDisk::factory()->create();
|
||||
|
||||
@@ -60,7 +59,7 @@ test('get disk', function () {
|
||||
});
|
||||
|
||||
test('get drivers', function () {
|
||||
$response = getJson("/api/v1/disk/drivers");
|
||||
$response = getJson('/api/v1/disk/drivers');
|
||||
|
||||
$response->assertStatus(200);
|
||||
});
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use InvoiceShelf\Http\Controllers\V1\Admin\Invoice\InvoicesController;
|
||||
use InvoiceShelf\Http\Requests\InvoicesRequest;
|
||||
use InvoiceShelf\Mail\SendInvoiceMail;
|
||||
@@ -7,7 +8,6 @@ use InvoiceShelf\Models\Invoice;
|
||||
use InvoiceShelf\Models\InvoiceItem;
|
||||
use InvoiceShelf\Models\Tax;
|
||||
use InvoiceShelf\Models\User;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use Laravel\Sanctum\Sanctum;
|
||||
|
||||
use function Pest\Laravel\getJson;
|
||||
@@ -57,7 +57,7 @@ test('create invoice', function () {
|
||||
|
||||
$this->assertDatabaseHas('invoice_items', [
|
||||
'item_id' => $invoice['items'][0]['item_id'],
|
||||
'name' => $invoice['items'][0]['name']
|
||||
'name' => $invoice['items'][0]['name'],
|
||||
]);
|
||||
});
|
||||
|
||||
@@ -84,7 +84,7 @@ test('create invoice as sent', function () {
|
||||
|
||||
$this->assertDatabaseHas('invoice_items', [
|
||||
'item_id' => $invoice['items'][0]['item_id'],
|
||||
'name' => $invoice['items'][0]['name']
|
||||
'name' => $invoice['items'][0]['name'],
|
||||
]);
|
||||
});
|
||||
|
||||
@@ -122,7 +122,7 @@ test('update invoice', function () {
|
||||
|
||||
$this->assertDatabaseHas('invoice_items', [
|
||||
'item_id' => $invoice2['items'][0]['item_id'],
|
||||
'name' => $invoice2['items'][0]['name']
|
||||
'name' => $invoice2['items'][0]['name'],
|
||||
]);
|
||||
});
|
||||
|
||||
@@ -260,7 +260,7 @@ test('create invoice with negative tax', function () {
|
||||
$invoice = Invoice::factory()
|
||||
->raw([
|
||||
'taxes' => [Tax::factory()->raw([
|
||||
'percent' => -9.99
|
||||
'percent' => -9.99,
|
||||
])],
|
||||
'items' => [InvoiceItem::factory()->raw()],
|
||||
]);
|
||||
@@ -283,23 +283,23 @@ test('create invoice with negative tax', function () {
|
||||
]);
|
||||
|
||||
$this->assertDatabaseHas('taxes', [
|
||||
'tax_type_id' => $invoice['taxes'][0]['tax_type_id']
|
||||
'tax_type_id' => $invoice['taxes'][0]['tax_type_id'],
|
||||
]);
|
||||
});
|
||||
|
||||
test('create invoice with tax per item', function () {
|
||||
$invoice = Invoice::factory()
|
||||
->raw([
|
||||
'tax_per_item' => 'YES',
|
||||
'items' => [
|
||||
InvoiceItem::factory()->raw([
|
||||
'taxes' => [Tax::factory()->raw()],
|
||||
]),
|
||||
InvoiceItem::factory()->raw([
|
||||
'taxes' => [Tax::factory()->raw()],
|
||||
]),
|
||||
],
|
||||
]);
|
||||
'tax_per_item' => 'YES',
|
||||
'items' => [
|
||||
InvoiceItem::factory()->raw([
|
||||
'taxes' => [Tax::factory()->raw()],
|
||||
]),
|
||||
InvoiceItem::factory()->raw([
|
||||
'taxes' => [Tax::factory()->raw()],
|
||||
]),
|
||||
],
|
||||
]);
|
||||
|
||||
$response = postJson('api/v1/invoices', $invoice);
|
||||
|
||||
@@ -319,7 +319,7 @@ test('create invoice with tax per item', function () {
|
||||
]);
|
||||
|
||||
$this->assertDatabaseHas('taxes', [
|
||||
'tax_type_id' => $invoice['items'][0]['taxes'][0]['tax_type_id']
|
||||
'tax_type_id' => $invoice['items'][0]['taxes'][0]['tax_type_id'],
|
||||
]);
|
||||
});
|
||||
|
||||
@@ -373,12 +373,12 @@ test('create invoice with EUR currency', function () {
|
||||
|
||||
$this->assertDatabaseHas('taxes', [
|
||||
'tax_type_id' => $invoice['taxes'][0]['tax_type_id'],
|
||||
'amount' => $invoice['tax']
|
||||
'amount' => $invoice['tax'],
|
||||
]);
|
||||
|
||||
$this->assertDatabaseHas('invoice_items', [
|
||||
'item_id' => $invoice['items'][0]['item_id'],
|
||||
'name' => $invoice['items'][0]['name']
|
||||
'name' => $invoice['items'][0]['name'],
|
||||
]);
|
||||
});
|
||||
|
||||
@@ -387,9 +387,9 @@ test('update invoice with EUR currency', function () {
|
||||
->hasItems(1)
|
||||
->hasTaxes(1)
|
||||
->create([
|
||||
'invoice_date' => '1988-07-18',
|
||||
'due_date' => '1988-08-18',
|
||||
]);
|
||||
'invoice_date' => '1988-07-18',
|
||||
'due_date' => '1988-08-18',
|
||||
]);
|
||||
|
||||
$invoice2 = Invoice::factory()
|
||||
->raw([
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use InvoiceShelf\Http\Controllers\V1\Admin\Item\ItemsController;
|
||||
use InvoiceShelf\Http\Requests\ItemsRequest;
|
||||
use InvoiceShelf\Models\Item;
|
||||
use InvoiceShelf\Models\Tax;
|
||||
use InvoiceShelf\Models\User;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use Laravel\Sanctum\Sanctum;
|
||||
|
||||
use function Pest\Laravel\getJson;
|
||||
use function Pest\Laravel\postJson;
|
||||
use function Pest\Laravel\putJson;
|
||||
@@ -118,7 +119,7 @@ test('delete multiple items', function () {
|
||||
'ids' => $items->pluck('id'),
|
||||
];
|
||||
|
||||
postJson("/api/v1/items/delete", $data)->assertOk();
|
||||
postJson('/api/v1/items/delete', $data)->assertOk();
|
||||
|
||||
foreach ($items as $item) {
|
||||
$this->assertModelMissing($item);
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
<?php
|
||||
|
||||
use InvoiceShelf\Models\User;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use InvoiceShelf\Models\User;
|
||||
use Laravel\Sanctum\Sanctum;
|
||||
|
||||
use function Pest\Laravel\getJson;
|
||||
|
||||
beforeEach(function () {
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
<?php
|
||||
|
||||
use InvoiceShelf\Models\User;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use InvoiceShelf\Models\User;
|
||||
use Laravel\Sanctum\Sanctum;
|
||||
|
||||
use function Pest\Laravel\{getJson};
|
||||
|
||||
beforeEach(function () {
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use InvoiceShelf\Models\Note;
|
||||
use InvoiceShelf\Models\User;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use Laravel\Sanctum\Sanctum;
|
||||
|
||||
use function Pest\Laravel\deleteJson;
|
||||
use function Pest\Laravel\getJson;
|
||||
use function Pest\Laravel\postJson;
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use InvoiceShelf\Http\Controllers\V1\Admin\Payment\PaymentMethodsController;
|
||||
use InvoiceShelf\Http\Requests\PaymentMethodRequest;
|
||||
use InvoiceShelf\Models\PaymentMethod;
|
||||
use InvoiceShelf\Models\User;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use Laravel\Sanctum\Sanctum;
|
||||
|
||||
use function Pest\Laravel\deleteJson;
|
||||
use function Pest\Laravel\getJson;
|
||||
use function Pest\Laravel\postJson;
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use InvoiceShelf\Http\Controllers\V1\Admin\Payment\PaymentsController;
|
||||
use InvoiceShelf\Http\Requests\PaymentRequest;
|
||||
use InvoiceShelf\Mail\SendPaymentMail;
|
||||
use InvoiceShelf\Models\Invoice;
|
||||
use InvoiceShelf\Models\Payment;
|
||||
use InvoiceShelf\Models\User;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use Laravel\Sanctum\Sanctum;
|
||||
|
||||
use function Pest\Laravel\getJson;
|
||||
@@ -44,14 +44,14 @@ test('get payment', function () {
|
||||
test('create payment', function () {
|
||||
$invoice = Invoice::factory()->create([
|
||||
'due_amount' => 100,
|
||||
'exchange_rate' => 1
|
||||
'exchange_rate' => 1,
|
||||
]);
|
||||
|
||||
$payment = Payment::factory()->raw([
|
||||
'invoice_id' => $invoice->id,
|
||||
'payment_number' => "PAY-000001",
|
||||
'payment_number' => 'PAY-000001',
|
||||
'amount' => $invoice->due_amount,
|
||||
'exchange_rate' => 1
|
||||
'exchange_rate' => 1,
|
||||
]);
|
||||
|
||||
$response = postJson('api/v1/payments', $payment);
|
||||
@@ -80,12 +80,12 @@ test('update payment', function () {
|
||||
$payment = Payment::factory()->create([
|
||||
'payment_date' => '1988-08-18',
|
||||
'invoice_id' => $invoice->id,
|
||||
'exchange_rate' => 1
|
||||
'exchange_rate' => 1,
|
||||
]);
|
||||
|
||||
$payment2 = Payment::factory()->raw([
|
||||
'invoice_id' => $invoice->id,
|
||||
'exchange_rate' => 1
|
||||
'exchange_rate' => 1,
|
||||
]);
|
||||
|
||||
putJson("api/v1/payments/{$payment->id}", $payment2)
|
||||
@@ -162,8 +162,8 @@ test('delete payment', function () {
|
||||
|
||||
test('create payment without invoice', function () {
|
||||
$payment = Payment::factory()->raw([
|
||||
'payment_number' => "PAY-000001",
|
||||
'exchange_rate' => 1
|
||||
'payment_number' => 'PAY-000001',
|
||||
'exchange_rate' => 1,
|
||||
]);
|
||||
|
||||
postJson('api/v1/payments', $payment)->assertOk();
|
||||
@@ -178,7 +178,7 @@ test('create payment without invoice', function () {
|
||||
|
||||
test('create payment with invoice', function () {
|
||||
$payment = Payment::factory()->raw([
|
||||
'payment_number' => "PAY-000001",
|
||||
'payment_number' => 'PAY-000001',
|
||||
]);
|
||||
|
||||
$invoice = Invoice::factory()->create();
|
||||
@@ -186,7 +186,7 @@ test('create payment with invoice', function () {
|
||||
$payment = Payment::factory()->raw([
|
||||
'invoice_id' => $invoice->id,
|
||||
'amount' => $invoice->due_amount,
|
||||
'exchange_rate' => 1
|
||||
'exchange_rate' => 1,
|
||||
]);
|
||||
|
||||
postJson('api/v1/payments', $payment)->assertOk();
|
||||
@@ -218,15 +218,15 @@ test('create payment with partially paid', function () {
|
||||
'customer_id' => $invoice->customer_id,
|
||||
'exchange_rate' => $invoice->exchange_rate,
|
||||
'amount' => 100,
|
||||
'currency_id' => $invoice->currency_id
|
||||
'currency_id' => $invoice->currency_id,
|
||||
]);
|
||||
|
||||
$response = postJson("api/v1/payments", $payment)->assertOk();
|
||||
$response = postJson('api/v1/payments', $payment)->assertOk();
|
||||
|
||||
$this->assertDatabaseHas('payments', [
|
||||
'payment_number' => $payment['payment_number'],
|
||||
'customer_id' => (string)$payment['customer_id'],
|
||||
'amount' => (string)$payment['amount'],
|
||||
'customer_id' => (string) $payment['customer_id'],
|
||||
'amount' => (string) $payment['amount'],
|
||||
]);
|
||||
|
||||
$this->assertDatabaseHas('invoices', [
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
<?php
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use InvoiceShelf\Http\Controllers\V1\Admin\RecurringInvoice\RecurringInvoiceController;
|
||||
use InvoiceShelf\Http\Requests\RecurringInvoiceRequest;
|
||||
use InvoiceShelf\Models\InvoiceItem;
|
||||
use InvoiceShelf\Models\RecurringInvoice;
|
||||
use InvoiceShelf\Models\User;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use Laravel\Sanctum\Sanctum;
|
||||
|
||||
use function Pest\Laravel\getJson;
|
||||
use function Pest\Laravel\postJson;
|
||||
use function Pest\Laravel\putJson;
|
||||
@@ -44,7 +45,7 @@ test('store user using a form request', function () {
|
||||
test('store recurring invoice', function () {
|
||||
$recurringInvoice = RecurringInvoice::factory()->raw();
|
||||
$recurringInvoice['items'] = [
|
||||
InvoiceItem::factory()->raw()
|
||||
InvoiceItem::factory()->raw(),
|
||||
];
|
||||
|
||||
postJson('api/v1/recurring-invoices', $recurringInvoice)
|
||||
@@ -77,12 +78,12 @@ test('update user using a form request', function () {
|
||||
test('update recurring invoice', function () {
|
||||
$recurringInvoice = RecurringInvoice::factory()->create();
|
||||
$recurringInvoice['items'] = [
|
||||
InvoiceItem::factory()->raw()
|
||||
InvoiceItem::factory()->raw(),
|
||||
];
|
||||
|
||||
$new_recurringInvoice = RecurringInvoice::factory()->raw();
|
||||
$new_recurringInvoice['items'] = [
|
||||
InvoiceItem::factory()->raw()
|
||||
InvoiceItem::factory()->raw(),
|
||||
];
|
||||
|
||||
putJson("api/v1/recurring-invoices/{$recurringInvoice->id}", $new_recurringInvoice)
|
||||
@@ -118,11 +119,11 @@ test('delete multiple recurring invoice', function () {
|
||||
test('calculate frequency for recurring invoice', function () {
|
||||
$data = [
|
||||
'frequency' => '* * 2 * *',
|
||||
'starts_at' => Carbon::now()->format('Y-m-d')
|
||||
'starts_at' => Carbon::now()->format('Y-m-d'),
|
||||
];
|
||||
|
||||
$queryString = http_build_query($data, '', '&');
|
||||
|
||||
getJson("api/v1/recurring-invoice-frequency?".$queryString)
|
||||
getJson('api/v1/recurring-invoice-frequency?'.$queryString)
|
||||
->assertOk();
|
||||
});
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
<?php
|
||||
|
||||
use InvoiceShelf\Models\User;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use InvoiceShelf\Models\User;
|
||||
use Laravel\Sanctum\Sanctum;
|
||||
|
||||
use function Pest\Laravel\postJson;
|
||||
|
||||
beforeEach(function () {
|
||||
@@ -21,15 +22,15 @@ beforeEach(function () {
|
||||
|
||||
test('create super admin role', function () {
|
||||
$data = [
|
||||
"email" => "loremipsum@gmail.com",
|
||||
"name" => "lorem",
|
||||
"password" => "lorem@123"
|
||||
'email' => 'loremipsum@gmail.com',
|
||||
'name' => 'lorem',
|
||||
'password' => 'lorem@123',
|
||||
];
|
||||
$data['companies'] = [
|
||||
[
|
||||
"role" => "super admin",
|
||||
"id" => 1
|
||||
]
|
||||
'role' => 'super admin',
|
||||
'id' => 1,
|
||||
],
|
||||
];
|
||||
|
||||
postJson('api/v1/users', $data)
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use InvoiceShelf\Http\Controllers\V1\Admin\Settings\TaxTypesController;
|
||||
use InvoiceShelf\Http\Requests\TaxTypeRequest;
|
||||
use InvoiceShelf\Models\TaxType;
|
||||
use InvoiceShelf\Models\User;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use Laravel\Sanctum\Sanctum;
|
||||
|
||||
use function Pest\Laravel\deleteJson;
|
||||
@@ -87,10 +87,9 @@ test('delete tax type', function () {
|
||||
$this->assertModelMissing($taxType);
|
||||
});
|
||||
|
||||
|
||||
test('create negative tax type', function () {
|
||||
$taxType = TaxType::factory()->raw([
|
||||
'percent' => -9.99
|
||||
'percent' => -9.99,
|
||||
]);
|
||||
|
||||
postJson('api/v1/tax-types', $taxType)
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use InvoiceShelf\Http\Controllers\V1\Admin\Item\UnitsController;
|
||||
use InvoiceShelf\Http\Requests\UnitRequest;
|
||||
use InvoiceShelf\Models\Unit;
|
||||
use InvoiceShelf\Models\User;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use Laravel\Sanctum\Sanctum;
|
||||
|
||||
use function Pest\Laravel\deleteJson;
|
||||
use function Pest\Laravel\getJson;
|
||||
use function Pest\Laravel\postJson;
|
||||
|
||||
@@ -4,6 +4,7 @@ use InvoiceShelf\Http\Controllers\V1\Admin\Users\UsersController;
|
||||
use InvoiceShelf\Http\Requests\UserRequest;
|
||||
use InvoiceShelf\Models\User;
|
||||
use Laravel\Sanctum\Sanctum;
|
||||
|
||||
use function Pest\Faker\fake;
|
||||
use function Pest\Laravel\getJson;
|
||||
use function Pest\Laravel\postJson;
|
||||
|
||||
@@ -2,10 +2,11 @@
|
||||
|
||||
namespace Tests\Feature\Customer;
|
||||
|
||||
use InvoiceShelf\Models\Customer;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use InvoiceShelf\Models\Customer;
|
||||
use Laravel\Sanctum\Sanctum;
|
||||
|
||||
use function Pest\Laravel\getJson;
|
||||
|
||||
beforeEach(function () {
|
||||
|
||||
@@ -2,11 +2,12 @@
|
||||
|
||||
namespace Tests\Feature\Customer;
|
||||
|
||||
use InvoiceShelf\Models\Customer;
|
||||
use InvoiceShelf\Models\Estimate;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use InvoiceShelf\Models\Customer;
|
||||
use InvoiceShelf\Models\Estimate;
|
||||
use Laravel\Sanctum\Sanctum;
|
||||
|
||||
use function Pest\Laravel\getJson;
|
||||
use function Pest\Laravel\postJson;
|
||||
|
||||
@@ -33,7 +34,7 @@ test('get customer estimate', function () {
|
||||
$customer = Auth::guard('customer')->user();
|
||||
|
||||
$estimate = Estimate::factory()->create([
|
||||
'customer_id' => $customer->id
|
||||
'customer_id' => $customer->id,
|
||||
]);
|
||||
|
||||
getJson("/api/v1/{$customer->company->slug}/customer/estimates/{$estimate->id}")
|
||||
@@ -46,11 +47,11 @@ test('customer estimate mark as accepted', function () {
|
||||
$estimate = Estimate::factory()->create([
|
||||
'estimate_date' => '1988-07-18',
|
||||
'expiry_date' => '1988-08-18',
|
||||
'customer_id' => $customer->id
|
||||
'customer_id' => $customer->id,
|
||||
]);
|
||||
|
||||
$status = [
|
||||
'status' => Estimate::STATUS_ACCEPTED
|
||||
'status' => Estimate::STATUS_ACCEPTED,
|
||||
];
|
||||
|
||||
$response = postJson("api/v1/{$customer->company->slug}/customer/estimate/{$estimate->id}/status", $status)
|
||||
@@ -65,11 +66,11 @@ test('customer estimate mark as rejected', function () {
|
||||
$estimate = Estimate::factory()->create([
|
||||
'estimate_date' => '1988-07-18',
|
||||
'expiry_date' => '1988-08-18',
|
||||
'customer_id' => $customer->id
|
||||
'customer_id' => $customer->id,
|
||||
]);
|
||||
|
||||
$status = [
|
||||
'status' => Estimate::STATUS_REJECTED
|
||||
'status' => Estimate::STATUS_REJECTED,
|
||||
];
|
||||
|
||||
$response = postJson("api/v1/{$customer->company->slug}/customer/estimate/{$estimate->id}/status", $status)
|
||||
|
||||
@@ -2,11 +2,12 @@
|
||||
|
||||
namespace Tests\Feature\Customer;
|
||||
|
||||
use InvoiceShelf\Models\Customer;
|
||||
use InvoiceShelf\Models\Expense;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use InvoiceShelf\Models\Customer;
|
||||
use InvoiceShelf\Models\Expense;
|
||||
use Laravel\Sanctum\Sanctum;
|
||||
|
||||
use function Pest\Laravel\getJson;
|
||||
|
||||
beforeEach(function () {
|
||||
@@ -33,7 +34,7 @@ test('get customer expense', function () {
|
||||
|
||||
$expense = Expense::factory()->create([
|
||||
'customer_id' => $customer->id,
|
||||
'company_id' => $customer->company->id
|
||||
'company_id' => $customer->company->id,
|
||||
]);
|
||||
|
||||
getJson("/api/v1/{$customer->company->slug}/customer/expenses/{$expense->id}")
|
||||
|
||||
@@ -2,11 +2,12 @@
|
||||
|
||||
namespace Tests\Feature\Customer;
|
||||
|
||||
use InvoiceShelf\Models\Customer;
|
||||
use InvoiceShelf\Models\Invoice;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use InvoiceShelf\Models\Customer;
|
||||
use InvoiceShelf\Models\Invoice;
|
||||
use Laravel\Sanctum\Sanctum;
|
||||
|
||||
use function Pest\Laravel\getJson;
|
||||
|
||||
beforeEach(function () {
|
||||
@@ -32,7 +33,7 @@ test('get customer invoice', function () {
|
||||
$customer = Auth::guard('customer')->user();
|
||||
|
||||
$invoice = Invoice::factory()->create([
|
||||
'customer_id' => $customer->id
|
||||
'customer_id' => $customer->id,
|
||||
]);
|
||||
|
||||
getJson("/api/v1/{$customer->company->slug}/customer/invoices/{$invoice->id}")->assertOk();
|
||||
|
||||
@@ -2,11 +2,12 @@
|
||||
|
||||
namespace Tests\Feature\Customer;
|
||||
|
||||
use InvoiceShelf\Models\Customer;
|
||||
use InvoiceShelf\Models\Payment;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use InvoiceShelf\Models\Customer;
|
||||
use InvoiceShelf\Models\Payment;
|
||||
use Laravel\Sanctum\Sanctum;
|
||||
|
||||
use function Pest\Laravel\getJson;
|
||||
|
||||
beforeEach(function () {
|
||||
@@ -32,7 +33,7 @@ test('get customer payment', function () {
|
||||
$customer = Auth::guard('customer')->user();
|
||||
|
||||
$payment = Payment::factory()->create([
|
||||
'customer_id' => $customer->id
|
||||
'customer_id' => $customer->id,
|
||||
]);
|
||||
|
||||
getJson("/api/v1/{$customer->company->slug}/customer/payments/{$payment->id}")->assertOk();
|
||||
|
||||
@@ -2,12 +2,13 @@
|
||||
|
||||
namespace Tests\Feature\Customer;
|
||||
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use InvoiceShelf\Http\Controllers\V1\Customer\General\ProfileController;
|
||||
use InvoiceShelf\Http\Requests\Customer\CustomerProfileRequest;
|
||||
use InvoiceShelf\Models\Customer;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Laravel\Sanctum\Sanctum;
|
||||
|
||||
use function Pest\Laravel\getJson;
|
||||
use function Pest\Laravel\postJson;
|
||||
|
||||
@@ -38,19 +39,19 @@ test('update customer profile', function () {
|
||||
$newCustomer = Customer::factory()->raw([
|
||||
'shipping' => [
|
||||
'name' => 'newName',
|
||||
'address_street_1' => 'address'
|
||||
'address_street_1' => 'address',
|
||||
],
|
||||
'billing' => [
|
||||
'name' => 'newName',
|
||||
'address_street_1' => 'address'
|
||||
]
|
||||
'address_street_1' => 'address',
|
||||
],
|
||||
]);
|
||||
|
||||
postJson("api/v1/{$customer->company->slug}/customer/profile", $newCustomer)->assertOk();
|
||||
|
||||
$this->assertDatabaseHas('customers', [
|
||||
'name' => $customer['name'],
|
||||
'email' => $customer['email']
|
||||
'email' => $customer['email'],
|
||||
]);
|
||||
});
|
||||
|
||||
|
||||
@@ -9,8 +9,8 @@ use JMac\Testing\Traits\AdditionalAssertions;
|
||||
|
||||
abstract class TestCase extends BaseTestCase
|
||||
{
|
||||
use CreatesApplication;
|
||||
use AdditionalAssertions;
|
||||
use CreatesApplication;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
use InvoiceShelf\Models\Address;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use InvoiceShelf\Models\Address;
|
||||
|
||||
beforeEach(function () {
|
||||
Artisan::call('db:seed', ['--class' => 'DatabaseSeeder', '--force' => true]);
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use InvoiceShelf\Models\Company;
|
||||
use InvoiceShelf\Models\CompanySetting;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
|
||||
use function Pest\Faker\fake;
|
||||
|
||||
beforeEach(function () {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
use InvoiceShelf\Models\Company;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use InvoiceShelf\Models\Company;
|
||||
|
||||
beforeEach(function () {
|
||||
Artisan::call('db:seed', ['--class' => 'DatabaseSeeder', '--force' => true]);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use InvoiceShelf\Models\Address;
|
||||
use InvoiceShelf\Models\Country;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
|
||||
beforeEach(function () {
|
||||
Artisan::call('db:seed', ['--class' => 'DatabaseSeeder', '--force' => true]);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
use InvoiceShelf\Models\CustomField;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use InvoiceShelf\Models\CustomField;
|
||||
|
||||
beforeEach(function () {
|
||||
Artisan::call('db:seed', ['--class' => 'DatabaseSeeder', '--force' => true]);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
use InvoiceShelf\Models\CustomFieldValue;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use InvoiceShelf\Models\CustomFieldValue;
|
||||
|
||||
beforeEach(function () {
|
||||
Artisan::call('db:seed', ['--class' => 'DatabaseSeeder', '--force' => true]);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use InvoiceShelf\Models\Address;
|
||||
use InvoiceShelf\Models\Customer;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
|
||||
beforeEach(function () {
|
||||
Artisan::call('db:seed', ['--class' => 'DatabaseSeeder', '--force' => true]);
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use InvoiceShelf\Models\Estimate;
|
||||
use InvoiceShelf\Models\EstimateItem;
|
||||
use InvoiceShelf\Models\Item;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
|
||||
beforeEach(function () {
|
||||
Artisan::call('db:seed', ['--class' => 'DatabaseSeeder', '--force' => true]);
|
||||
@@ -25,7 +25,6 @@ test('estimate item belongs to item', function () {
|
||||
$this->assertTrue($estimateItem->item()->exists());
|
||||
});
|
||||
|
||||
|
||||
test('estimate item has many taxes', function () {
|
||||
$estimateItem = EstimateItem::factory()->hasTaxes(5)->create([
|
||||
'estimate_id' => Estimate::factory(),
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use InvoiceShelf\Http\Requests\EstimatesRequest;
|
||||
use InvoiceShelf\Models\Estimate;
|
||||
use InvoiceShelf\Models\EstimateItem;
|
||||
use InvoiceShelf\Models\Tax;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
|
||||
beforeEach(function () {
|
||||
Artisan::call('db:seed', ['--class' => 'DatabaseSeeder', '--force' => true]);
|
||||
@@ -95,7 +95,7 @@ test('update estimate', function () {
|
||||
|
||||
$request->replace($newEstimate);
|
||||
|
||||
$estimate_number = explode("-", $newEstimate['estimate_number']);
|
||||
$estimate_number = explode('-', $newEstimate['estimate_number']);
|
||||
|
||||
$number_attributes['estimate_number'] = $estimate_number[0].'-'.sprintf('%06d', intval($estimate_number[1]));
|
||||
|
||||
@@ -137,7 +137,7 @@ test('create items', function () {
|
||||
|
||||
$request = new Request();
|
||||
|
||||
$request->replace(['items' => $items ]);
|
||||
$request->replace(['items' => $items]);
|
||||
|
||||
Estimate::createItems($estimate, $request, $estimate->exchange_rate);
|
||||
|
||||
@@ -170,7 +170,7 @@ test('create taxes', function () {
|
||||
|
||||
$request = new Request();
|
||||
|
||||
$request->replace(['taxes' => $taxes ]);
|
||||
$request->replace(['taxes' => $taxes]);
|
||||
|
||||
Estimate::createTaxes($estimate, $request, $estimate->exchange_rate);
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
use InvoiceShelf\Models\ExpenseCategory;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use InvoiceShelf\Models\ExpenseCategory;
|
||||
|
||||
beforeEach(function () {
|
||||
Artisan::call('db:seed', ['--class' => 'DatabaseSeeder', '--force' => true]);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
use InvoiceShelf\Models\Expense;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use InvoiceShelf\Models\Expense;
|
||||
|
||||
beforeEach(function () {
|
||||
Artisan::call('db:seed', ['--class' => 'DatabaseSeeder', '--force' => true]);
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use InvoiceShelf\Models\Invoice;
|
||||
use InvoiceShelf\Models\InvoiceItem;
|
||||
use InvoiceShelf\Models\Item;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
|
||||
beforeEach(function () {
|
||||
Artisan::call('db:seed', ['--class' => 'DatabaseSeeder', '--force' => true]);
|
||||
@@ -25,7 +25,6 @@ test('invoice item belongs to item', function () {
|
||||
$this->assertTrue($invoiceItem->item()->exists());
|
||||
});
|
||||
|
||||
|
||||
test('invoice item has many taxes', function () {
|
||||
$invoiceItem = InvoiceItem::factory()->hasTaxes(5)->create([
|
||||
'invoice_id' => Invoice::factory(),
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use InvoiceShelf\Http\Requests\InvoicesRequest;
|
||||
use InvoiceShelf\Models\Invoice;
|
||||
use InvoiceShelf\Models\InvoiceItem;
|
||||
use InvoiceShelf\Models\Tax;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
|
||||
beforeEach(function () {
|
||||
Artisan::call('db:seed', ['--class' => 'DatabaseSeeder', '--force' => true]);
|
||||
@@ -50,7 +50,6 @@ test('get previous status', function () {
|
||||
$this->assertEquals('DRAFT', $status);
|
||||
});
|
||||
|
||||
|
||||
test('create invoice', function () {
|
||||
$invoice = Invoice::factory()->raw();
|
||||
|
||||
@@ -66,7 +65,7 @@ test('create invoice', function () {
|
||||
|
||||
$request->replace($invoice);
|
||||
|
||||
$invoice_number = explode("-", $invoice['invoice_number']);
|
||||
$invoice_number = explode('-', $invoice['invoice_number']);
|
||||
$number_attributes['invoice_number'] = $invoice_number[0].'-'.sprintf('%06d', intval($invoice_number[1]));
|
||||
|
||||
$response = Invoice::createInvoice($request);
|
||||
@@ -116,7 +115,7 @@ test('update invoice', function () {
|
||||
|
||||
$request->replace($newInvoice);
|
||||
|
||||
$invoice_number = explode("-", $newInvoice['invoice_number']);
|
||||
$invoice_number = explode('-', $newInvoice['invoice_number']);
|
||||
|
||||
$number_attributes['invoice_number'] = $invoice_number[0].'-'.sprintf('%06d', intval($invoice_number[1]));
|
||||
|
||||
@@ -157,7 +156,7 @@ test('create items', function () {
|
||||
|
||||
$request = new InvoicesRequest();
|
||||
|
||||
$request->replace(['items' => $items ]);
|
||||
$request->replace(['items' => $items]);
|
||||
|
||||
Invoice::createItems($invoice, $request->items);
|
||||
|
||||
@@ -184,7 +183,7 @@ test('create taxes', function () {
|
||||
|
||||
$request = new Request();
|
||||
|
||||
$request->replace(['taxes' => $taxes ]);
|
||||
$request->replace(['taxes' => $taxes]);
|
||||
|
||||
Invoice::createTaxes($invoice, $request->taxes);
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use InvoiceShelf\Models\Estimate;
|
||||
use InvoiceShelf\Models\EstimateItem;
|
||||
use InvoiceShelf\Models\Invoice;
|
||||
use InvoiceShelf\Models\InvoiceItem;
|
||||
use InvoiceShelf\Models\Item;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
|
||||
beforeEach(function () {
|
||||
Artisan::call('db:seed', ['--class' => 'DatabaseSeeder', '--force' => true]);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
use InvoiceShelf\Models\PaymentMethod;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use InvoiceShelf\Models\PaymentMethod;
|
||||
|
||||
beforeEach(function () {
|
||||
Artisan::call('db:seed', ['--class' => 'DatabaseSeeder', '--force' => true]);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
use InvoiceShelf\Models\Payment;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use InvoiceShelf\Models\Payment;
|
||||
|
||||
beforeEach(function () {
|
||||
Artisan::call('db:seed', ['--class' => 'DatabaseSeeder', '--force' => true]);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
use InvoiceShelf\Models\RecurringInvoice;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use InvoiceShelf\Models\RecurringInvoice;
|
||||
|
||||
beforeEach(function () {
|
||||
Artisan::call('db:seed', ['--class' => 'DatabaseSeeder', '--force' => true]);
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
<?php
|
||||
|
||||
use InvoiceShelf\Models\Setting;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use InvoiceShelf\Models\Setting;
|
||||
|
||||
use function Pest\Faker\fake;
|
||||
|
||||
beforeEach(function () {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use InvoiceShelf\Models\Estimate;
|
||||
use InvoiceShelf\Models\EstimateItem;
|
||||
use InvoiceShelf\Models\Invoice;
|
||||
use InvoiceShelf\Models\InvoiceItem;
|
||||
use InvoiceShelf\Models\Tax;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
|
||||
beforeEach(function () {
|
||||
Artisan::call('db:seed', ['--class' => 'DatabaseSeeder', '--force' => true]);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
use InvoiceShelf\Models\TaxType;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use InvoiceShelf\Models\TaxType;
|
||||
|
||||
beforeEach(function () {
|
||||
Artisan::call('db:seed', ['--class' => 'DatabaseSeeder', '--force' => true]);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use InvoiceShelf\Models\Unit;
|
||||
use InvoiceShelf\Models\User;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use Laravel\Sanctum\Sanctum;
|
||||
|
||||
beforeEach(function () {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
use InvoiceShelf\Models\User;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use InvoiceShelf\Models\User;
|
||||
|
||||
beforeEach(function () {
|
||||
Artisan::call('db:seed', ['--class' => 'DatabaseSeeder', '--force' => true]);
|
||||
|
||||
Reference in New Issue
Block a user