applied jobs to tests
This commit is contained in:
@@ -35,7 +35,7 @@ class BillsTest extends FeatureTestCase
|
||||
public function testItShouldCreateBillWithRecurring()
|
||||
{
|
||||
$this->loginAs()
|
||||
->post(route('bills.store'), $this->getBillRequest(1))
|
||||
->post(route('bills.store'), $this->getBillRequest(true))
|
||||
->assertStatus(200);
|
||||
|
||||
$this->assertFlashLevel('success');
|
||||
@@ -43,7 +43,7 @@ class BillsTest extends FeatureTestCase
|
||||
|
||||
public function testItShouldSeeBillUpdatePage()
|
||||
{
|
||||
$bill = dispatch_now(new CreateBill($this->getBillRequest()));
|
||||
$bill = $this->dispatch(new CreateBill($this->getBillRequest()));
|
||||
|
||||
$this->loginAs()
|
||||
->get(route('bills.edit', ['bill' => $bill->id]))
|
||||
@@ -54,35 +54,35 @@ class BillsTest extends FeatureTestCase
|
||||
|
||||
public function testItShouldUpdateBill()
|
||||
{
|
||||
$bill = dispatch_now(new CreateBill($this->getBillRequest()));
|
||||
$request = $this->getBillRequest();
|
||||
|
||||
$bill = $this->dispatch(new CreateBill($request));
|
||||
|
||||
$request['contact_name'] = $this->faker->name;
|
||||
|
||||
$this->loginAs()
|
||||
->patch(route('bills.update', $bill->id), $request)
|
||||
->assertStatus(302);
|
||||
->assertStatus(200);
|
||||
|
||||
$this->assertFlashLevel('success');
|
||||
}
|
||||
|
||||
public function testItShouldDeleteBill()
|
||||
{
|
||||
$bill = dispatch_now(new CreateBill($this->getBillRequest()));
|
||||
$bill = $this->dispatch(new CreateBill($this->getBillRequest()));
|
||||
|
||||
$this->loginAs()
|
||||
->delete(route('bills.destroy', $bill->id))
|
||||
->assertStatus(302)
|
||||
->assertRedirect(route('bills.index'));
|
||||
->assertStatus(200);
|
||||
|
||||
$this->assertFlashLevel('success');
|
||||
|
||||
}
|
||||
|
||||
private function getBillRequest($recurring = 0)
|
||||
private function getBillRequest($recurring = false)
|
||||
{
|
||||
$amount = $this->faker->randomFloat(2, 2);
|
||||
|
||||
$items = [['name' => $this->faker->text(5), 'item_id' => null, 'quantity' => '1', 'price' => $amount, 'currency' => 'USD', 'tax_id' => null]];
|
||||
$items = [['name' => $this->faker->text(5), 'item_id' => null, 'quantity' => '1', 'price' => $amount, 'currency' => 'USD', 'tax_id' => null]];
|
||||
|
||||
$data = [
|
||||
'company_id' => $this->company->id,
|
||||
@@ -95,7 +95,7 @@ class BillsTest extends FeatureTestCase
|
||||
'items' => $items,
|
||||
'discount' => '0',
|
||||
'notes' => $this->faker->text(5),
|
||||
'category_id' => $this->company->categories()->type('expense')->first()->id,
|
||||
'category_id' => $this->company->categories()->type('expense')->pluck('id')->first(),
|
||||
'recurring_frequency' => 'no',
|
||||
'contact_id' => '0',
|
||||
'contact_name' => $this->faker->name,
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Tests\Feature\Expenses;
|
||||
|
||||
use App\Models\Banking\Transaction;
|
||||
use App\Jobs\Banking\CreateTransaction;
|
||||
use Illuminate\Http\UploadedFile;
|
||||
use Tests\Feature\FeatureTestCase;
|
||||
|
||||
@@ -37,7 +37,7 @@ class PaymentsTest extends FeatureTestCase
|
||||
{
|
||||
$request = $this->getPaymentRequest();
|
||||
|
||||
$payment = Transaction::create($request);
|
||||
$payment = $this->dispatch(new CreateTransaction($request));
|
||||
|
||||
$request['name'] = $this->faker->text(15);
|
||||
|
||||
@@ -50,7 +50,7 @@ class PaymentsTest extends FeatureTestCase
|
||||
|
||||
public function testItShouldDeletePayment()
|
||||
{
|
||||
$payment = Transaction::create($this->getPaymentRequest());
|
||||
$payment = $this->dispatch(new CreateTransaction($this->getPaymentRequest()));
|
||||
|
||||
$this->loginAs()
|
||||
->delete(route('payments.destroy', $payment->id))
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Tests\Feature\Expenses;
|
||||
|
||||
use App\Models\Common\Contact;
|
||||
use App\Jobs\Common\CreateContact;
|
||||
use Tests\Feature\FeatureTestCase;
|
||||
|
||||
class VendorsTest extends FeatureTestCase
|
||||
@@ -34,7 +34,7 @@ class VendorsTest extends FeatureTestCase
|
||||
|
||||
public function testItShouldSeeVendorDetailPage()
|
||||
{
|
||||
$vendor = Contact::create($this->getVendorRequest());
|
||||
$vendor = $this->dispatch(new CreateContact($this->getVendorRequest()));
|
||||
|
||||
$this->loginAs()
|
||||
->get(route('vendors.show', ['vendor' => $vendor->id]))
|
||||
@@ -44,7 +44,7 @@ class VendorsTest extends FeatureTestCase
|
||||
|
||||
public function testItShouldSeeVendorUpdatePage()
|
||||
{
|
||||
$vendor = Contact::create($this->getVendorRequest());
|
||||
$vendor = $this->dispatch(new CreateContact($this->getVendorRequest()));
|
||||
|
||||
$this->loginAs()
|
||||
->get(route('vendors.edit', ['vendor' => $vendor->id]))
|
||||
@@ -57,7 +57,7 @@ class VendorsTest extends FeatureTestCase
|
||||
{
|
||||
$request = $this->getVendorRequest();
|
||||
|
||||
$vendor = Contact::create($request);
|
||||
$vendor = $this->dispatch(new CreateContact($request));
|
||||
|
||||
$request['name'] = $this->faker->name;
|
||||
|
||||
@@ -70,7 +70,7 @@ class VendorsTest extends FeatureTestCase
|
||||
|
||||
public function testItShouldDeleteVendor()
|
||||
{
|
||||
$vendor = Contact::create($this->getVendorRequest());
|
||||
$vendor = $this->dispatch(new CreateContact($this->getVendorRequest()));
|
||||
|
||||
$this->loginAs()
|
||||
->delete(route('vendors.destroy', $vendor->id))
|
||||
|
||||
Reference in New Issue
Block a user