Updates for tests
This commit is contained in:
parent
cba7e7b2bd
commit
579bb07af3
|
|
@ -263,7 +263,6 @@ class StaticServiceProvider extends ServiceProvider
|
|||
|
||||
});
|
||||
|
||||
nlog("static service provider registered");
|
||||
}
|
||||
|
||||
public function boot()
|
||||
|
|
|
|||
|
|
@ -67,6 +67,7 @@ use App\DataMapper\ClientRegistrationFields;
|
|||
use App\Jobs\Company\CreateCompanyTaskStatuses;
|
||||
use App\Repositories\RecurringInvoiceRepository;
|
||||
use App\Factory\InvoiceToRecurringInvoiceFactory;
|
||||
use App\Repositories\CreditRepository;
|
||||
|
||||
/**
|
||||
* Class MockAccountData.
|
||||
|
|
@ -211,18 +212,14 @@ trait MockAccountData
|
|||
Artisan::call('db:seed', ['--force' => true]);
|
||||
}
|
||||
|
||||
|
||||
app()->singleton('currencies', function ($app) {
|
||||
|
||||
$resource = Currency::query()->orderBy('name')->get();
|
||||
|
||||
Cache::forever('currencies', $resource);
|
||||
|
||||
return $resource;
|
||||
|
||||
});
|
||||
|
||||
|
||||
$this->faker = \Faker\Factory::create();
|
||||
$fake_email = $this->faker->email();
|
||||
|
||||
|
|
@ -566,27 +563,30 @@ trait MockAccountData
|
|||
$this->credit->number = $this->getNextCreditNumber($this->client, $this->credit);
|
||||
|
||||
|
||||
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' => $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,
|
||||
]);
|
||||
// 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->setRelation('client', $this->client);
|
||||
// $this->credit->setRelation('company', $this->company);
|
||||
|
||||
$this->credit->save();
|
||||
// $this->credit->save();
|
||||
|
||||
$this->credit->service()->createInvitations()->markSent();
|
||||
$repo = new CreditRepository();
|
||||
$repo->save([], $this->credit);
|
||||
|
||||
// $this->credit->service()->createInvitations()->markSent();
|
||||
// $this->credit->save();
|
||||
|
||||
$this->purchase_order = PurchaseOrderFactory::create($this->company->id, $user_id);
|
||||
$this->purchase_order->vendor_id = $this->vendor->id;
|
||||
|
|
@ -650,19 +650,25 @@ trait MockAccountData
|
|||
$this->credit->ledger()->updateCreditBalance($this->credit->balance)->save();
|
||||
$this->credit->number = $this->getNextCreditNumber($this->client, $this->credit);
|
||||
|
||||
CreditInvitation::factory()->create([
|
||||
'user_id' => $user_id,
|
||||
'company_id' => $this->company->id,
|
||||
'client_contact_id' => $contact->id,
|
||||
'credit_id' => $this->credit->id,
|
||||
]);
|
||||
$this->credit->save();
|
||||
|
||||
CreditInvitation::factory()->create([
|
||||
'user_id' => $user_id,
|
||||
'company_id' => $this->company->id,
|
||||
'client_contact_id' => $contact2->id,
|
||||
'credit_id' => $this->credit->id,
|
||||
]);
|
||||
|
||||
$repo = new CreditRepository();
|
||||
$repo->save([], $this->credit);
|
||||
|
||||
// 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->bank_integration = BankIntegration::factory()->create([
|
||||
'user_id' => $user_id,
|
||||
|
|
@ -705,17 +711,17 @@ trait MockAccountData
|
|||
'company_id' => $this->company->id,
|
||||
]);
|
||||
|
||||
$invitations = CreditInvitation::whereCompanyId($this->credit->company_id)
|
||||
->whereCreditId($this->credit->id);
|
||||
// $invitations = CreditInvitation::whereCompanyId($this->credit->company_id)
|
||||
// ->whereCreditId($this->credit->id);
|
||||
|
||||
$this->credit->setRelation('invitations', $invitations);
|
||||
// $this->credit->setRelation('invitations', $invitations);
|
||||
|
||||
$this->credit->service()->markSent();
|
||||
// $this->credit->service()->markSent();
|
||||
|
||||
$this->credit->setRelation('client', $this->client);
|
||||
$this->credit->setRelation('company', $this->company);
|
||||
// $this->credit->setRelation('client', $this->client);
|
||||
// $this->credit->setRelation('company', $this->company);
|
||||
|
||||
$this->credit->save();
|
||||
// $this->credit->save();
|
||||
|
||||
$contacts = $this->invoice->client->contacts;
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ use Illuminate\Support\Facades\Artisan;
|
|||
*/
|
||||
class AutoBillInvoiceTest extends TestCase
|
||||
{
|
||||
// use DatabaseTransactions;
|
||||
use DatabaseTransactions;
|
||||
use MockAccountData;
|
||||
|
||||
protected function setUp(): void
|
||||
|
|
@ -30,12 +30,10 @@ class AutoBillInvoiceTest extends TestCase
|
|||
parent::setUp();
|
||||
|
||||
$this->makeTestData();
|
||||
|
||||
}
|
||||
|
||||
public function testAutoBillFunctionality()
|
||||
{
|
||||
$this->assertEquals('1', $this->client->settings->currency_id);
|
||||
$this->assertEquals($this->client->balance, 10);
|
||||
$this->assertEquals($this->client->paid_to_date, 0);
|
||||
$this->assertEquals($this->client->credit_balance, 10);
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ use Illuminate\Foundation\Testing\DatabaseTransactions;
|
|||
class ChartCurrencyTest extends TestCase
|
||||
{
|
||||
use MockAccountData;
|
||||
// use DatabaseTransactions;
|
||||
use DatabaseTransactions;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
|
|
@ -144,14 +144,12 @@ class ChartCurrencyTest extends TestCase
|
|||
$i1->service()->markPaid()->save();
|
||||
$i2->service()->markPaid()->save();
|
||||
|
||||
|
||||
$this->assertEquals(100, $i1->amount);
|
||||
$this->assertEquals(100, $i2->amount);
|
||||
|
||||
$cs = new ChartService($company, $this->user, true);
|
||||
$results = $cs->totals('1970-01-01', '2050-01-01');
|
||||
|
||||
nlog($results);
|
||||
$this->assertCount(2, $results['currencies']);
|
||||
|
||||
$this->assertEquals('USD', $results['currencies'][1]);
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ use Tests\TestCase;
|
|||
class CompanyDocumentsTest extends TestCase
|
||||
{
|
||||
use MockAccountData;
|
||||
// use DatabaseTransactions;
|
||||
use DatabaseTransactions;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ use Illuminate\Foundation\Testing\DatabaseTransactions;
|
|||
class EntityTest extends TestCase
|
||||
{
|
||||
use MockAccountData;
|
||||
// use DatabaseTransactions;
|
||||
use DatabaseTransactions;
|
||||
|
||||
public $invoice;
|
||||
|
||||
|
|
@ -89,17 +89,6 @@ class EntityTest extends TestCase
|
|||
|
||||
protected function tearDown(): void
|
||||
{
|
||||
|
||||
|
||||
// $this->company->company_users->each(function ($company_user) {
|
||||
// $company_user->user->forceDelete();
|
||||
// $company_user->forceDelete();
|
||||
// });
|
||||
|
||||
// // Clean up any resources or reset state if necessary
|
||||
// $this->account->delete();
|
||||
|
||||
|
||||
parent::tearDown();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -422,13 +422,16 @@ class GeneratesCounterTest extends TestCase
|
|||
|
||||
public function testInvoiceNumberValue()
|
||||
{
|
||||
$invoice_number = $this->getNextInvoiceNumber($this->client->fresh(), $this->invoice->fresh());
|
||||
|
||||
$this->assertEquals($invoice_number, '0002');
|
||||
$this->assertEquals('0002', $this->invoice->fresh()->number);
|
||||
|
||||
$invoice_number = $this->getNextInvoiceNumber($this->client->fresh(), $this->invoice->fresh());
|
||||
|
||||
$this->assertEquals($invoice_number, '0003');
|
||||
|
||||
$invoice_number = $this->getNextInvoiceNumber($this->client->fresh(), $this->invoice->fresh());
|
||||
|
||||
$this->assertEquals($invoice_number, '0004');
|
||||
}
|
||||
|
||||
public function testQuoteNumberValue()
|
||||
|
|
@ -605,11 +608,13 @@ class GeneratesCounterTest extends TestCase
|
|||
|
||||
$invoice_number = $this->getNextInvoiceNumber($cliz->fresh(), $this->invoice);
|
||||
|
||||
$this->assertEquals($invoice_number, '0002');
|
||||
$this->assertEquals('0002', $this->invoice->fresh()->number);
|
||||
|
||||
$this->assertEquals('0003', $invoice_number);
|
||||
|
||||
$invoice_number = $this->getNextInvoiceNumber($cliz->fresh(), $this->invoice);
|
||||
|
||||
$this->assertEquals($invoice_number, '0003');
|
||||
$this->assertEquals('0004', $invoice_number );
|
||||
}
|
||||
|
||||
public function testClientNumber()
|
||||
|
|
|
|||
Loading…
Reference in New Issue