makeTestData(); } public function testCalcUpgradePrice() { $subscription = Subscription::factory()->create([ 'company_id' => $this->company->id, 'user_id' => $this->user->id, 'price' => 10, ]); $invoice = Invoice::factory()->create([ 'line_items' => $this->buildLineItems(), 'company_id' => $this->company->id, 'user_id' => $this->user->id, 'client_id' => $this->client->id, 'tax_rate1' => 0, 'tax_name1' => '', 'tax_rate2' => 0, 'tax_name2' => '', 'tax_rate3' => 0, 'tax_name3' => '', 'discount' => 0, 'subscription_id' => $subscription->id, 'date' => now() ]); $invoice = $invoice->calc()->getInvoice(); $this->assertEquals(10, $invoice->amount); $invoice->service()->markSent()->save(); $this->assertEquals(10, $invoice->amount); $this->assertEquals(10, $invoice->balance); } }