added more db asserts
This commit is contained in:
@@ -26,25 +26,39 @@ class BillsTest extends FeatureTestCase
|
||||
|
||||
public function testItShouldCreateBill()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
|
||||
$this->loginAs()
|
||||
->post(route('bills.store'), $this->getRequest())
|
||||
->post(route('bills.store'), $request)
|
||||
->assertStatus(200);
|
||||
|
||||
$this->assertFlashLevel('success');
|
||||
|
||||
$this->assertDatabaseHas('bills', [
|
||||
'bill_number' => $request['bill_number'],
|
||||
]);
|
||||
}
|
||||
|
||||
public function testItShouldCreateBillWithRecurring()
|
||||
{
|
||||
$request = $this->getRequest(true);
|
||||
|
||||
$this->loginAs()
|
||||
->post(route('bills.store'), $this->getRequest(true))
|
||||
->post(route('bills.store'), $request)
|
||||
->assertStatus(200);
|
||||
|
||||
$this->assertFlashLevel('success');
|
||||
|
||||
$this->assertDatabaseHas('bills', [
|
||||
'bill_number' => $request['bill_number'],
|
||||
]);
|
||||
}
|
||||
|
||||
public function testItShouldSeeBillUpdatePage()
|
||||
{
|
||||
$bill = $this->dispatch(new CreateBill($this->getRequest()));
|
||||
$request = $this->getRequest();
|
||||
|
||||
$bill = $this->dispatch(new CreateBill($request));
|
||||
|
||||
$this->loginAs()
|
||||
->get(route('bills.edit', $bill->id))
|
||||
@@ -66,17 +80,28 @@ class BillsTest extends FeatureTestCase
|
||||
->assertSee($request['contact_email']);
|
||||
|
||||
$this->assertFlashLevel('success');
|
||||
|
||||
$this->assertDatabaseHas('bills', [
|
||||
'bill_number' => $request['bill_number'],
|
||||
'contact_email' => $request['contact_email'],
|
||||
]);
|
||||
}
|
||||
|
||||
public function testItShouldDeleteBill()
|
||||
{
|
||||
$bill = $this->dispatch(new CreateBill($this->getRequest()));
|
||||
$request = $this->getRequest();
|
||||
|
||||
$bill = $this->dispatch(new CreateBill($request));
|
||||
|
||||
$this->loginAs()
|
||||
->delete(route('bills.destroy', $bill->id))
|
||||
->assertStatus(200);
|
||||
|
||||
$this->assertFlashLevel('success');
|
||||
|
||||
$this->assertSoftDeleted('bills', [
|
||||
'bill_number' => $request['bill_number'],
|
||||
]);
|
||||
}
|
||||
|
||||
public function getRequest($recurring = false)
|
||||
|
||||
@@ -26,16 +26,22 @@ class PaymentsTest extends FeatureTestCase
|
||||
|
||||
public function testItShouldCreatePayment()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
|
||||
$this->loginAs()
|
||||
->post(route('payments.store'), $this->getRequest())
|
||||
->post(route('payments.store'), $request)
|
||||
->assertStatus(200);
|
||||
|
||||
$this->assertFlashLevel('success');
|
||||
|
||||
$this->assertDatabaseHas('transactions', $request);
|
||||
}
|
||||
|
||||
public function testItShouldSeePaymentUpdatePage()
|
||||
{
|
||||
$payment = $this->dispatch(new CreateTransaction($this->getRequest()));
|
||||
$request = $this->getRequest();
|
||||
|
||||
$payment = $this->dispatch(new CreateTransaction($request));
|
||||
|
||||
$this->loginAs()
|
||||
->get(route('payments.edit', $payment->id))
|
||||
@@ -57,17 +63,23 @@ class PaymentsTest extends FeatureTestCase
|
||||
->assertSee($request['amount']);
|
||||
|
||||
$this->assertFlashLevel('success');
|
||||
|
||||
$this->assertDatabaseHas('transactions', $request);
|
||||
}
|
||||
|
||||
public function testItShouldDeletePayment()
|
||||
{
|
||||
$payment = $this->dispatch(new CreateTransaction($this->getRequest()));
|
||||
$request = $this->getRequest();
|
||||
|
||||
$payment = $this->dispatch(new CreateTransaction($request));
|
||||
|
||||
$this->loginAs()
|
||||
->delete(route('payments.destroy', $payment->id))
|
||||
->assertStatus(200);
|
||||
|
||||
$this->assertFlashLevel('success');
|
||||
|
||||
$this->assertSoftDeleted('transactions', $request);
|
||||
}
|
||||
|
||||
public function getRequest()
|
||||
|
||||
@@ -26,16 +26,22 @@ class VendorsTest extends FeatureTestCase
|
||||
|
||||
public function testItShouldCreateVendor()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
|
||||
$this->loginAs()
|
||||
->post(route('vendors.store'), $this->getRequest())
|
||||
->post(route('vendors.store'), $request)
|
||||
->assertStatus(200);
|
||||
|
||||
$this->assertFlashLevel('success');
|
||||
|
||||
$this->assertDatabaseHas('contacts', $request);
|
||||
}
|
||||
|
||||
public function testItShouldSeeVendorDetailPage()
|
||||
{
|
||||
$vendor = $this->dispatch(new CreateContact($this->getRequest()));
|
||||
$request = $this->getRequest();
|
||||
|
||||
$vendor = $this->dispatch(new CreateContact($request));
|
||||
|
||||
$this->loginAs()
|
||||
->get(route('vendors.show', $vendor->id))
|
||||
@@ -45,12 +51,16 @@ class VendorsTest extends FeatureTestCase
|
||||
|
||||
public function testItShouldSeeVendorUpdatePage()
|
||||
{
|
||||
$vendor = $this->dispatch(new CreateContact($this->getRequest()));
|
||||
$request = $this->getRequest();
|
||||
|
||||
$vendor = $this->dispatch(new CreateContact($request));
|
||||
|
||||
$this->loginAs()
|
||||
->get(route('vendors.edit', $vendor->id))
|
||||
->assertStatus(200)
|
||||
->assertSee($vendor->email);
|
||||
|
||||
$this->assertDatabaseHas('contacts', $request);
|
||||
}
|
||||
|
||||
public function testItShouldUpdateVendor()
|
||||
@@ -67,17 +77,23 @@ class VendorsTest extends FeatureTestCase
|
||||
->assertSee($request['email']);
|
||||
|
||||
$this->assertFlashLevel('success');
|
||||
|
||||
$this->assertDatabaseHas('contacts', $request);
|
||||
}
|
||||
|
||||
public function testItShouldDeleteVendor()
|
||||
{
|
||||
$vendor = $this->dispatch(new CreateContact($this->getRequest()));
|
||||
$request = $this->getRequest();
|
||||
|
||||
$vendor = $this->dispatch(new CreateContact($request));
|
||||
|
||||
$this->loginAs()
|
||||
->delete(route('vendors.destroy', $vendor->id))
|
||||
->assertStatus(200);
|
||||
|
||||
$this->assertFlashLevel('success');
|
||||
|
||||
$this->assertSoftDeleted('contacts', $request);
|
||||
}
|
||||
|
||||
public function getRequest()
|
||||
|
||||
Reference in New Issue
Block a user