added more db asserts
This commit is contained in:
parent
d8ea08643a
commit
a3077d445d
@ -26,7 +26,11 @@ class DateFormat
|
||||
continue;
|
||||
}
|
||||
|
||||
$new_date = Date::parse($date)->format('Y-m-d') . ' ' . Date::now()->format('H:i:s');
|
||||
if (Date::parse($date)->format('H:i:s') == '00:00:00') {
|
||||
$new_date = Date::parse($date)->format('Y-m-d') . ' ' . Date::now()->format('H:i:s');
|
||||
} else {
|
||||
$new_date = Date::parse($date)->toDateTimeString();
|
||||
}
|
||||
|
||||
$request->request->set($field, $new_date);
|
||||
}
|
||||
|
@ -20,8 +20,8 @@ $factory->define(Bill::class, function (Faker $faker) use ($company) {
|
||||
session(['company_id' => $company->id]);
|
||||
setting()->setExtraColumns(['company_id' => $company->id]);
|
||||
|
||||
$billed_at = $faker->dateTimeBetween(now()->startOfYear(), now()->endOfYear())->format('Y-m-d');
|
||||
$due_at = Date::parse($billed_at)->addDays(10)->format('Y-m-d');
|
||||
$billed_at = $faker->dateTimeBetween(now()->startOfYear(), now()->endOfYear())->format('Y-m-d H:i:s');
|
||||
$due_at = Date::parse($billed_at)->addDays(10)->format('Y-m-d H:i:s');
|
||||
|
||||
$contacts = Contact::vendor()->enabled()->get();
|
||||
|
||||
|
@ -21,8 +21,8 @@ $factory->define(Invoice::class, function (Faker $faker) use ($company) {
|
||||
session(['company_id' => $company->id]);
|
||||
setting()->setExtraColumns(['company_id' => $company->id]);
|
||||
|
||||
$invoiced_at = $faker->dateTimeBetween(now()->startOfYear(), now()->endOfYear())->format('Y-m-d');
|
||||
$due_at = Date::parse($invoiced_at)->addDays(setting('invoice.payment_terms'))->format('Y-m-d');
|
||||
$invoiced_at = $faker->dateTimeBetween(now()->startOfYear(), now()->endOfYear())->format('Y-m-d H:i:s');
|
||||
$due_at = Date::parse($invoiced_at)->addDays(setting('invoice.payment_terms'))->format('Y-m-d H:i:s');
|
||||
|
||||
$contacts = Contact::customer()->enabled()->get();
|
||||
|
||||
|
@ -17,10 +17,10 @@ $factory->define(Transaction::class, function (Faker $faker) use ($company) {
|
||||
'company_id' => $company->id,
|
||||
'type' => $type,
|
||||
'account_id' => setting('default.account'),
|
||||
'paid_at' => $faker->dateTimeBetween(now()->startOfYear(), now()->endOfYear())->format('Y-m-d'),
|
||||
'paid_at' => $faker->dateTimeBetween(now()->startOfYear(), now()->endOfYear())->format('Y-m-d H:i:s'),
|
||||
'amount' => $faker->randomFloat(2, 1, 1000),
|
||||
'currency_code' => setting('default.currency'),
|
||||
'currency_rate' => '1',
|
||||
'currency_rate' => '1.0',
|
||||
'description' => $faker->text(5),
|
||||
'category_id' => $company->categories()->type($type)->get()->random(1)->pluck('id')->first(),
|
||||
'reference' => $faker->text(5),
|
||||
|
@ -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()
|
||||
|
@ -25,34 +25,40 @@ class CustomersTest extends FeatureTestCase
|
||||
->assertSeeText(trans('general.title.new', ['type' => trans_choice('general.customers', 1)]));
|
||||
}
|
||||
|
||||
public function testItShouldCreateOnlyCustomerWithoutUser()
|
||||
public function testItShouldCreateCustomer()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
|
||||
$this->loginAs()
|
||||
->post(route('customers.store'), $this->getRequest())
|
||||
->post(route('customers.store'), $request)
|
||||
->assertStatus(200);
|
||||
|
||||
$this->assertFlashLevel('success');
|
||||
|
||||
$this->assertDatabaseHas('contacts', $request);
|
||||
}
|
||||
|
||||
public function testItShouldCreateCustomerWithUser()
|
||||
{
|
||||
$customer = $this->getRequestWithUser();
|
||||
$request = $this->getRequestWithUser();
|
||||
|
||||
$this->loginAs()
|
||||
->post(route('customers.store'), $customer)
|
||||
->post(route('customers.store'), $request)
|
||||
->assertStatus(200);
|
||||
|
||||
$this->assertFlashLevel('success');
|
||||
|
||||
$user = User::where('email', $customer['email'])->first();
|
||||
$user = User::where('email', $request['email'])->first();
|
||||
|
||||
$this->assertNotNull($user);
|
||||
$this->assertEquals($customer['email'], $user->email);
|
||||
$this->assertEquals($request['email'], $user->email);
|
||||
}
|
||||
|
||||
public function testItShouldSeeCustomerDetailPage()
|
||||
{
|
||||
$customer = $this->dispatch(new CreateContact($this->getRequest()));
|
||||
$request = $this->getRequest();
|
||||
|
||||
$customer = $this->dispatch(new CreateContact($request));
|
||||
|
||||
$this->loginAs()
|
||||
->get(route('customers.show', $customer->id))
|
||||
@ -62,7 +68,9 @@ class CustomersTest extends FeatureTestCase
|
||||
|
||||
public function testItShouldSeeCustomerUpdatePage()
|
||||
{
|
||||
$customer = $this->dispatch(new CreateContact($this->getRequest()));
|
||||
$request = $this->getRequest();
|
||||
|
||||
$customer = $this->dispatch(new CreateContact($request));
|
||||
|
||||
$this->loginAs()
|
||||
->get(route('customers.edit', $customer->id))
|
||||
@ -84,11 +92,15 @@ class CustomersTest extends FeatureTestCase
|
||||
->assertSee($request['email']);
|
||||
|
||||
$this->assertFlashLevel('success');
|
||||
|
||||
$this->assertDatabaseHas('contacts', $request);
|
||||
}
|
||||
|
||||
public function testItShouldDeleteCustomer()
|
||||
{
|
||||
$customer = $this->dispatch(new CreateContact($this->getRequest()));
|
||||
$request = $this->getRequest();
|
||||
|
||||
$customer = $this->dispatch(new CreateContact($request));
|
||||
|
||||
$this->loginAs()
|
||||
->delete(route('customers.destroy', $customer->id))
|
||||
@ -96,6 +108,8 @@ class CustomersTest extends FeatureTestCase
|
||||
|
||||
$this->assertFlashLevel('success');
|
||||
|
||||
$this->assertSoftDeleted('contacts', $request);
|
||||
|
||||
}
|
||||
|
||||
public function testItShouldNotDeleteCustomerIfHasRelations()
|
||||
|
@ -26,25 +26,39 @@ class InvoicesTest extends FeatureTestCase
|
||||
|
||||
public function testItShouldCreateInvoice()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
|
||||
$this->loginAs()
|
||||
->post(route('invoices.store'), $this->getRequest())
|
||||
->post(route('invoices.store'), $request)
|
||||
->assertStatus(200);
|
||||
|
||||
$this->assertFlashLevel('success');
|
||||
|
||||
$this->assertDatabaseHas('invoices', [
|
||||
'invoice_number' => $request['invoice_number'],
|
||||
]);
|
||||
}
|
||||
|
||||
public function testItShouldCreateInvoiceWithRecurring()
|
||||
{
|
||||
$request = $this->getRequest(true);
|
||||
|
||||
$this->loginAs()
|
||||
->post(route('invoices.store'), $this->getRequest(true))
|
||||
->post(route('invoices.store'), $request)
|
||||
->assertStatus(200);
|
||||
|
||||
$this->assertFlashLevel('success');
|
||||
|
||||
$this->assertDatabaseHas('invoices', [
|
||||
'invoice_number' => $request['invoice_number'],
|
||||
]);
|
||||
}
|
||||
|
||||
public function testItShouldSeeInvoiceUpdatePage()
|
||||
{
|
||||
$invoice = $this->dispatch(new CreateInvoice($this->getRequest()));
|
||||
$request = $this->getRequest();
|
||||
|
||||
$invoice = $this->dispatch(new CreateInvoice($request));
|
||||
|
||||
$this->loginAs()
|
||||
->get(route('invoices.edit', $invoice->id))
|
||||
@ -66,17 +80,28 @@ class InvoicesTest extends FeatureTestCase
|
||||
->assertSee($request['contact_email']);
|
||||
|
||||
$this->assertFlashLevel('success');
|
||||
|
||||
$this->assertDatabaseHas('invoices', [
|
||||
'invoice_number' => $request['invoice_number'],
|
||||
'contact_email' => $request['contact_email'],
|
||||
]);
|
||||
}
|
||||
|
||||
public function testItShouldDeleteInvoice()
|
||||
{
|
||||
$invoice = $this->dispatch(new CreateInvoice($this->getRequest()));
|
||||
$request = $this->getRequest();
|
||||
|
||||
$invoice = $this->dispatch(new CreateInvoice($request));
|
||||
|
||||
$this->loginAs()
|
||||
->delete(route('invoices.destroy', $invoice->id))
|
||||
->assertStatus(200);
|
||||
|
||||
$this->assertFlashLevel('success');
|
||||
|
||||
$this->assertSoftDeleted('invoices', [
|
||||
'invoice_number' => $request['invoice_number'],
|
||||
]);
|
||||
}
|
||||
|
||||
public function getRequest($recurring = false)
|
||||
|
@ -26,16 +26,22 @@ class RevenuesTest extends FeatureTestCase
|
||||
|
||||
public function testItShouldCreateRevenue()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
|
||||
$this->loginAs()
|
||||
->post(route('revenues.store'), $this->getRequest())
|
||||
->post(route('revenues.store'), $request)
|
||||
->assertStatus(200);
|
||||
|
||||
$this->assertFlashLevel('success');
|
||||
|
||||
$this->assertDatabaseHas('transactions', $request);
|
||||
}
|
||||
|
||||
public function testItShouldSeeRevenueUpdatePage()
|
||||
{
|
||||
$revenue = $this->dispatch(new CreateTransaction($this->getRequest()));
|
||||
$request = $this->getRequest();
|
||||
|
||||
$revenue = $this->dispatch(new CreateTransaction($request));
|
||||
|
||||
$this->loginAs()
|
||||
->get(route('revenues.edit', $revenue->id))
|
||||
@ -57,17 +63,23 @@ class RevenuesTest extends FeatureTestCase
|
||||
->assertSee($request['amount']);
|
||||
|
||||
$this->assertFlashLevel('success');
|
||||
|
||||
$this->assertDatabaseHas('transactions', $request);
|
||||
}
|
||||
|
||||
public function testItShouldDeleteRevenue()
|
||||
{
|
||||
$revenue = $this->dispatch(new CreateTransaction($this->getRequest()));
|
||||
$request = $this->getRequest();
|
||||
|
||||
$revenue = $this->dispatch(new CreateTransaction($request));
|
||||
|
||||
$this->loginAs()
|
||||
->delete(route('revenues.destroy', $revenue->id))
|
||||
->assertStatus(200);
|
||||
|
||||
$this->assertFlashLevel('success');
|
||||
|
||||
$this->assertSoftDeleted('transactions', $request);
|
||||
}
|
||||
|
||||
public function getRequest()
|
||||
|
@ -26,16 +26,22 @@ class CategoriesTest extends FeatureTestCase
|
||||
|
||||
public function testItShouldCreateCategory()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
|
||||
$this->loginAs()
|
||||
->post(route('categories.store'), $this->getRequest())
|
||||
->post(route('categories.store'), $request)
|
||||
->assertStatus(200);
|
||||
|
||||
$this->assertFlashLevel('success');
|
||||
|
||||
$this->assertDatabaseHas('categories', $request);
|
||||
}
|
||||
|
||||
public function testItShouldSeeCategoryUpdatePage()
|
||||
{
|
||||
$category = $this->dispatch(new CreateCategory($this->getRequest()));
|
||||
$request = $this->getRequest();
|
||||
|
||||
$category = $this->dispatch(new CreateCategory($request));
|
||||
|
||||
$this->loginAs()
|
||||
->get(route('categories.edit', $category->id))
|
||||
@ -57,17 +63,23 @@ class CategoriesTest extends FeatureTestCase
|
||||
->assertSee($request['name']);
|
||||
|
||||
$this->assertFlashLevel('success');
|
||||
|
||||
$this->assertDatabaseHas('categories', $request);
|
||||
}
|
||||
|
||||
public function testItShouldDeleteCategory()
|
||||
{
|
||||
$category = $this->dispatch(new CreateCategory($this->getRequest()));
|
||||
$request = $this->getRequest();
|
||||
|
||||
$category = $this->dispatch(new CreateCategory($request));
|
||||
|
||||
$this->loginAs()
|
||||
->delete(route('categories.destroy', $category->id))
|
||||
->assertStatus(200);
|
||||
|
||||
$this->assertFlashLevel('success');
|
||||
|
||||
$this->assertSoftDeleted('categories', $request);
|
||||
}
|
||||
|
||||
public function getRequest()
|
||||
|
@ -26,16 +26,22 @@ class CurrenciesTest extends FeatureTestCase
|
||||
|
||||
public function testItShouldCreateCurrency()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
|
||||
$this->loginAs()
|
||||
->post(route('currencies.store'), $this->getRequest())
|
||||
->post(route('currencies.store'), $request)
|
||||
->assertStatus(200);
|
||||
|
||||
$this->assertFlashLevel('success');
|
||||
|
||||
$this->assertDatabaseHas('currencies', $request);
|
||||
}
|
||||
|
||||
public function testItShouldSeeCurrencyUpdatePage()
|
||||
{
|
||||
$currency = $this->dispatch(new CreateCurrency($this->getRequest()));
|
||||
$request = $this->getRequest();
|
||||
|
||||
$currency = $this->dispatch(new CreateCurrency($request));
|
||||
|
||||
$this->loginAs()
|
||||
->get(route('currencies.edit', $currency->id))
|
||||
@ -57,17 +63,23 @@ class CurrenciesTest extends FeatureTestCase
|
||||
->assertSee($request['name']);
|
||||
|
||||
$this->assertFlashLevel('success');
|
||||
|
||||
$this->assertDatabaseHas('currencies', $request);
|
||||
}
|
||||
|
||||
public function testItShouldDeleteCurrency()
|
||||
{
|
||||
$currency = $this->dispatch(new CreateCurrency($this->getRequest()));
|
||||
$request = $this->getRequest();
|
||||
|
||||
$currency = $this->dispatch(new CreateCurrency($request));
|
||||
|
||||
$this->loginAs()
|
||||
->delete(route('currencies.destroy', $currency->id))
|
||||
->assertStatus(200);
|
||||
|
||||
$this->assertFlashLevel('success');
|
||||
|
||||
$this->assertSoftDeleted('currencies', $request);
|
||||
}
|
||||
|
||||
public function getRequest()
|
||||
|
@ -26,16 +26,22 @@ class TaxesTest extends FeatureTestCase
|
||||
|
||||
public function testItShouldCreateTax()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
|
||||
$this->loginAs()
|
||||
->post(route('taxes.store'), $this->getRequest())
|
||||
->post(route('taxes.store'), $request)
|
||||
->assertStatus(200);
|
||||
|
||||
$this->assertFlashLevel('success');
|
||||
|
||||
$this->assertDatabaseHas('taxes', $request);
|
||||
}
|
||||
|
||||
public function testItShouldSeeTaxUpdatePage()
|
||||
{
|
||||
$tax = $this->dispatch(new CreateTax($this->getRequest()));
|
||||
$request = $this->getRequest();
|
||||
|
||||
$tax = $this->dispatch(new CreateTax($request));
|
||||
|
||||
$this->loginAs()
|
||||
->get(route('taxes.edit', $tax->id))
|
||||
@ -57,17 +63,23 @@ class TaxesTest extends FeatureTestCase
|
||||
->assertSee($request['name']);
|
||||
|
||||
$this->assertFlashLevel('success');
|
||||
|
||||
$this->assertDatabaseHas('taxes', $request);
|
||||
}
|
||||
|
||||
public function testItShouldDeleteTax()
|
||||
{
|
||||
$tax = $this->dispatch(new CreateTax($this->getRequest()));
|
||||
$request = $this->getRequest();
|
||||
|
||||
$tax = $this->dispatch(new CreateTax($request));
|
||||
|
||||
$this->loginAs()
|
||||
->delete(route('taxes.destroy', $tax->id))
|
||||
->assertStatus(200);
|
||||
|
||||
$this->assertFlashLevel('success');
|
||||
|
||||
$this->assertDatabaseHas('taxes', $request);
|
||||
}
|
||||
|
||||
public function getRequest()
|
||||
|
@ -17,11 +17,15 @@ class CurrenciesTest extends FeatureTestCase
|
||||
|
||||
public function testItShouldCreateCurrency()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
|
||||
$this->loginAs()
|
||||
->post(route('wizard.currencies.store'), $this->getRequest())
|
||||
->post(route('wizard.currencies.store'), $request)
|
||||
->assertStatus(200);
|
||||
|
||||
$this->assertFlashLevel('success');
|
||||
|
||||
$this->assertDatabaseHas('currencies', $request);
|
||||
}
|
||||
|
||||
public function testItShouldUpdateCurrency()
|
||||
@ -37,17 +41,23 @@ class CurrenciesTest extends FeatureTestCase
|
||||
->assertStatus(200);
|
||||
|
||||
$this->assertFlashLevel('success');
|
||||
|
||||
$this->assertDatabaseHas('currencies', $request);
|
||||
}
|
||||
|
||||
public function testItShouldDeleteCurrency()
|
||||
{
|
||||
$currency = $this->dispatch(new CreateCurrency($this->getRequest()));
|
||||
$request = $this->getRequest();
|
||||
|
||||
$currency = $this->dispatch(new CreateCurrency($request));
|
||||
|
||||
$this->loginAs()
|
||||
->delete(route('wizard.currencies.destroy', $currency->id))
|
||||
->assertStatus(200);
|
||||
|
||||
$this->assertFlashLevel('success');
|
||||
|
||||
$this->assertSoftDeleted('currencies', $request);
|
||||
}
|
||||
|
||||
public function getRequest()
|
||||
|
@ -17,11 +17,15 @@ class TaxesTest extends FeatureTestCase
|
||||
|
||||
public function testItShouldCreateTax()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
|
||||
$this->loginAs()
|
||||
->post(route('wizard.taxes.store'), $this->getRequest())
|
||||
->post(route('wizard.taxes.store'), $request)
|
||||
->assertStatus(200);
|
||||
|
||||
$this->assertFlashLevel('success');
|
||||
|
||||
$this->assertDatabaseHas('taxes', $request);
|
||||
}
|
||||
|
||||
public function testItShouldUpdateTax()
|
||||
@ -37,17 +41,23 @@ class TaxesTest extends FeatureTestCase
|
||||
->assertStatus(200);
|
||||
|
||||
$this->assertFlashLevel('success');
|
||||
|
||||
$this->assertDatabaseHas('taxes', $request);
|
||||
}
|
||||
|
||||
public function testItShouldDeleteTax()
|
||||
{
|
||||
$tax = $this->dispatch(new CreateTax($this->getRequest()));
|
||||
$request = $this->getRequest();
|
||||
|
||||
$tax = $this->dispatch(new CreateTax($request));
|
||||
|
||||
$this->loginAs()
|
||||
->delete(route('wizard.taxes.destroy', $tax->id))
|
||||
->assertStatus(200);
|
||||
|
||||
$this->assertFlashLevel('success');
|
||||
|
||||
$this->assertDatabaseHas('taxes', $request);
|
||||
}
|
||||
|
||||
public function getRequest()
|
||||
|
Loading…
x
Reference in New Issue
Block a user