makeTestData(); } /** * @test * @covers App\Jobs\Company\UpdateCompanyLedgerWithPayment */ public function testPaymentIsPresentInLedger() { $invoice = MarkInvoicePaid::dispatchNow($this->invoice); $ledger = CompanyLedger::whereClientId($invoice->client_id) ->whereCompanyId($invoice->company_id) ->orderBy('id', 'DESC') ->first(); $payment = $ledger->adjustment * -1; $this->assertEquals($invoice->amount, $payment); } /** * @test * @covers App\Jobs\Company\UpdateCompanyLedgerWithInvoice */ public function testInvoiceIsPresentInLedger() { //$this->invoice->save(); $ledger = CompanyLedger::whereCompanyLedgerableId($this->invoice->id) ->whereCompanyLedgerableType(Invoice::class) ->whereCompanyId($this->invoice->company_id) ->get(); $this->assertEquals(1, count($ledger)); } }