/** @test */ function it_has_multiple_invoices() { $customer = new Customer(['name' => 'Test Customer']); $customer->save(); $invoice_1 = new Invoice(['title' => 'Invoice #1']); $invoice_2 = new Invoice(['title' => 'Invoice #2']); $invoice_3 = new Invoice(['title' => 'Invoice #3']); $customer->addInvoice($invoice_1); $customer->addInvoice($invoice_2); $customer->addInvoice($invoice_3); $this->assertCount(3, $customer->invoices); }
/** @test */ function it_has_a_customer() { $customer = new Customer(['name' => 'Test Customer']); $customer->save(); $invoice = new Invoice(['title' => 'Test Invoice']); $customer->addInvoice($invoice); $this->assertEquals($customer->id, $invoice->customer_id); }