makeTestData(); } public function testInvoiceIsDeletable() { $this->assertTrue($this->invoiceDeletable($this->invoice)); $this->assertTrue($this->invoiceReversable($this->invoice)); $this->assertFalse($this->invoiceCancellable($this->invoice)); } public function testInvoiceIsReversable() { $this->invoice->service()->markPaid()->save(); $this->assertFalse($this->invoiceDeletable($this->invoice)); $this->assertTrue($this->invoiceReversable($this->invoice)); $this->assertFalse($this->invoiceCancellable($this->invoice)); } public function testInvoiceIsCancellable() { $payment = PaymentFactory::create($this->invoice->company_id, $this->invoice->user_id); $payment->amount = 40; $payment->client_id = $this->invoice->client_id; $payment->applied = 0; $payment->refunded = 0; $payment->date = now(); $payment->save(); $this->invoice->service()->applyPayment($payment, 5)->save(); $this->assertFalse($this->invoiceDeletable($this->invoice)); $this->assertTrue($this->invoiceReversable($this->invoice)); $this->assertTrue($this->invoiceCancellable($this->invoice)); } public function testInvoiceUnactionable() { $this->invoice->delete(); $this->assertFalse($this->invoiceDeletable($this->invoice)); $this->assertFalse($this->invoiceReversable($this->invoice)); $this->assertFalse($this->invoiceCancellable($this->invoice)); } }