fixed tests

This commit is contained in:
denisdulici
2019-11-18 10:54:26 +03:00
parent 63ab57730d
commit 2cdc431f8c
17 changed files with 123 additions and 154 deletions

View File

@ -4,19 +4,19 @@ namespace Tests\Feature\Commands;
use App\Jobs\Expense\CreateBill;
use App\Notifications\Expense\Bill as BillNotification;
use Illuminate\Support\Facades\Notification;
use Illuminate\Support\Facades\Notification as Notification;
use Jenssegers\Date\Date;
use Tests\Feature\FeatureTestCase;
class BillReminderTest extends FeatureTestCase
{
private $addDay;
private $add_days;
protected function setUp(): void
{
parent::setUp();
$this->addDay = 3;
$this->add_days = 3;
}
public function testBillReminderByDueDate()
@ -25,7 +25,7 @@ class BillReminderTest extends FeatureTestCase
$bill = $this->dispatch(new CreateBill($this->getBillRequest()));
Date::setTestNow(Date::now()->subDays($this->addDay));
Date::setTestNow(Date::now()->subDays($this->add_days));
$this->artisan('reminder:bill');
@ -41,7 +41,6 @@ class BillReminderTest extends FeatureTestCase
/**
* Bill request
*
* @param int $recurring
* @return array
*/
private function getBillRequest()
@ -50,27 +49,27 @@ class BillReminderTest extends FeatureTestCase
$items = [['name' => $this->faker->text(5), 'item_id' => null, 'quantity' => '1', 'price' => $amount, 'currency' => 'USD']];
$data = [
'contact_id' => '0',
$data = [
'company_id' => $this->company->id,
'billed_at' => $this->faker->date(),
'due_at' => Date::now()->subDays($this->addDay - 1),
'due_at' => Date::now()->subDays($this->add_days - 1),
'bill_number' => '1',
'order_number' => '1',
'currency_code' => setting('default.currency'),
'currency_code' => setting('default.currency', 'USD'),
'currency_rate' => '1',
'items' => $items,
'discount' => '0',
'notes' => $this->faker->text(5),
'category_id' => $this->company->categories()->type('income')->first()->id,
'category_id' => $this->company->categories()->type('expense')->pluck('id')->first(),
'recurring_frequency' => 'no',
'contact_name' => $this->faker->name,
'contact_email' => $this->faker->email,
'contact_id' => '0',
'contact_name' => $this->faker->name,
'contact_email' =>$this->faker->email,
'contact_tax_number' => null,
'contact_phone' => null,
'contact_address' => $this->faker->address,
'bill_status_code' => 'sent',
'contact_phone' => null,
'contact_address' => $this->faker->address,
'bill_status_code' => 'received',
'amount' => $amount,
'company_id' => $this->company->id,
];
return $data;