Removed redundant functions from Invoice, optimised Invoice tables

This commit is contained in:
Deon George
2022-04-22 14:41:18 +10:00
parent a16277d9bb
commit e1a4db700f
22 changed files with 361 additions and 349 deletions

View File

@@ -2,10 +2,11 @@
namespace Tests\Feature;
use Carbon\Carbon;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Illuminate\Support\Arr;
use Tests\TestCase;
use App\Models\{Account,Group,Product,Service,Site};
use App\Models\{Account,Group,Invoice,Product,Service,Site};
class InvoiceTest extends TestCase
{
@@ -42,6 +43,7 @@ class InvoiceTest extends TestCase
$this->site_setup();
$this->account_setup();
// @todo This test description doesnt reflect what is tested - this needs to be reworked.
// Create two services for the same account
// First service was billed a month ago, so this invoice will have 1 service charge
$po = Product::factory()->notStrict()->create([
@@ -51,6 +53,8 @@ class InvoiceTest extends TestCase
'site_id'=>Arr::get($this->setup,'site.a')->site_id,
'account_id'=>Arr::get($this->setup,'account.a')->id,
'product_id'=>$po->id,
'recur_schedule'=>Invoice::BILL_MONTHLY,
'start_at'=>Carbon::now()->addMonth()->startofMonth(),
]);
$o->setRelation('product',$po);