applied jobs to tests

This commit is contained in:
denisdulici
2019-11-17 15:06:00 +03:00
parent 272905decc
commit 58048a1979
25 changed files with 194 additions and 186 deletions

View File

@ -2,7 +2,7 @@
namespace Tests\Feature\Commands;
use App\Models\Expense\Bill;
use App\Jobs\Expense\CreateBill;
use App\Notifications\Expense\Bill as BillNotification;
use Illuminate\Support\Facades\Notification;
use Jenssegers\Date\Date;
@ -23,7 +23,7 @@ class BillReminderTest extends FeatureTestCase
{
Notification::fake();
$bill = Bill::create($this->getBillRequest());
$bill = $this->dispatch(new CreateBill($this->getBillRequest()));
Date::setTestNow(Date::now()->subDays($this->addDay));
@ -39,7 +39,7 @@ class BillReminderTest extends FeatureTestCase
}
/**
* Copied in InvoicesTest
* Bill request
*
* @param int $recurring
* @return array
@ -58,7 +58,7 @@ class BillReminderTest extends FeatureTestCase
'order_number' => '1',
'currency_code' => setting('default.currency'),
'currency_rate' => '1',
'item' => $items,
'items' => $items,
'discount' => '0',
'notes' => $this->faker->text(5),
'category_id' => $this->company->categories()->type('income')->first()->id,

View File

@ -2,7 +2,7 @@
namespace Tests\Feature\Commands;
use App\Models\Income\Invoice;
use App\Jobs\Income\CreateInvoice;
use App\Notifications\Income\Invoice as InvoiceNotification;
use Illuminate\Support\Facades\Notification;
use Jenssegers\Date\Date;
@ -23,7 +23,7 @@ class InvoiceReminderTest extends FeatureTestCase
{
Notification::fake();
$invoice = Invoice::create($this->getInvoiceRequest());
$invoice = $this->dispatch(new CreateInvoice($this->getInvoiceRequest()));
Date::setTestNow(Date::now()->addDay($this->addDay));
@ -39,12 +39,11 @@ class InvoiceReminderTest extends FeatureTestCase
}
/**
* Copied in InvoicesTest
* Invoice request
*
* @param int $recurring
* @return array
*/
private function getInvoiceRequest($recurring = 0)
private function getInvoiceRequest()
{
$amount = $this->faker->randomFloat(2, 2);
@ -58,7 +57,7 @@ class InvoiceReminderTest extends FeatureTestCase
'order_number' => '1',
'currency_code' => setting('default.currency'),
'currency_rate' => '1',
'item' => $items,
'items' => $items,
'discount' => '0',
'notes' => $this->faker->text(5),
'category_id' => $this->company->categories()->type('income')->first()->id,
@ -73,13 +72,6 @@ class InvoiceReminderTest extends FeatureTestCase
'company_id' => $this->company->id,
];
if ($recurring) {
$data['recurring_frequency'] = 'yes';
$data['recurring_interval'] = '1';
$data['recurring_custom_frequency'] = $this->faker->randomElement(['monthly', 'weekly']);
$data['recurring_count'] = '1';
}
return $data;
}
}