From fb5b2882d3aed4d062c27d3416f2a830e749eaf0 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 12 May 2022 11:10:47 +1000 Subject: [PATCH] Fixes for tests --- .../Export/ProfitAndLossReportTest.php | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/tests/Feature/Export/ProfitAndLossReportTest.php b/tests/Feature/Export/ProfitAndLossReportTest.php index 7f8f2351b1..bab9925f9f 100644 --- a/tests/Feature/Export/ProfitAndLossReportTest.php +++ b/tests/Feature/Export/ProfitAndLossReportTest.php @@ -40,8 +40,14 @@ class ProfitAndLossReportTest extends TestCase $this->makeTestData(); $this->withoutExceptionHandling(); + + $this->buildData(); } + public $company; + + public $payload; + /** * * start_date - Y-m-d @@ -61,13 +67,14 @@ class ProfitAndLossReportTest extends TestCase include_tax - true tax_included || false - tax_excluded */ - public function testProfitLossInstance() + + private function buildData() { - $company = Company::factory()->create([ + $this->company = Company::factory()->create([ 'account_id' => $this->account->id, ]); - $payload = [ + $this->payload = [ 'start_date' => '2000-01-01', 'end_date' => '2030-01-11', 'date_range' => 'custom', @@ -75,7 +82,12 @@ class ProfitAndLossReportTest extends TestCase 'include_tax' => false ]; - $pl = new ProfitLoss($company, $payload); + } + + public function testProfitLossInstance() + { + + $pl = new ProfitLoss($this->company, $this->payload); $this->assertInstanceOf(ProfitLoss::class, $pl);