makeTestData(); } public function testAutoBillFunctionality() { $this->company->use_credits_payment = 'always'; $this->company->save(); $this->assertEquals($this->client->balance, 10); $this->assertEquals($this->client->paid_to_date, 0); $this->assertEquals($this->client->credit_balance, 10); $this->invoice->service()->markSent()->autoBill()->save(); $this->assertNotNull($this->invoice->payments()); $this->assertEquals(10, $this->invoice->payments()->sum('payments.amount')); $this->assertEquals($this->client->balance, 0); $this->assertEquals($this->client->paid_to_date, 10); $this->assertEquals($this->client->credit_balance, 0); } public function testAutoBillSetOffFunctionality() { $this->company->use_credits_payment = 'off'; $this->company->save(); $this->assertEquals($this->client->balance, 10); $this->assertEquals($this->client->paid_to_date, 0); $this->assertEquals($this->client->credit_balance, 10); $this->invoice->service()->markSent()->autoBill()->save(); $this->assertNotNull($this->invoice->payments()); $this->assertEquals(0, $this->invoice->payments()->sum('payments.amount')); $this->assertEquals($this->client->balance, 10); $this->assertEquals($this->client->paid_to_date, 0); $this->assertEquals($this->client->credit_balance, 10); } }