fixed tests
This commit is contained in:
		| @@ -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; | ||||
|   | ||||
| @@ -10,13 +10,13 @@ use Tests\Feature\FeatureTestCase; | ||||
|  | ||||
| class InvoiceReminderTest extends FeatureTestCase | ||||
| { | ||||
|     private $addDay; | ||||
|     private $add_days; | ||||
|  | ||||
|     protected function setUp(): void | ||||
|     { | ||||
|         parent::setUp(); | ||||
|  | ||||
|         $this->addDay = 3; | ||||
|         $this->add_days = 3; | ||||
|     } | ||||
|  | ||||
|     public function testInvoiceReminderByDueDate() | ||||
| @@ -25,7 +25,7 @@ class InvoiceReminderTest extends FeatureTestCase | ||||
|  | ||||
|         $invoice = $this->dispatch(new CreateInvoice($this->getInvoiceRequest())); | ||||
|  | ||||
|         Date::setTestNow(Date::now()->addDay($this->addDay)); | ||||
|         Date::setTestNow(Date::now()->addDay($this->add_days)); | ||||
|  | ||||
|         $this->artisan('reminder:invoice'); | ||||
|  | ||||
| @@ -50,26 +50,26 @@ class InvoiceReminderTest extends FeatureTestCase | ||||
|         $items = [['name' => $this->faker->text(5), 'item_id' => null, 'quantity' => '1', 'price' => $amount, 'currency' => 'USD']]; | ||||
|  | ||||
|         $data = [ | ||||
|             'contact_id' => '0', | ||||
|             'company_id' => $this->company->id, | ||||
|             'invoiced_at' => $this->faker->date(), | ||||
|             'due_at' => Date::now()->addDay($this->addDay - 1), | ||||
|             'due_at' => Date::now()->subDays($this->add_days - 1), | ||||
|             'invoice_number' => '1', | ||||
|             'order_number' => '1', | ||||
|             'currency_code' => setting('default.currency'), | ||||
|             'order_number' =>  '1', | ||||
|             '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('income')->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, | ||||
|             'contact_phone' =>  null, | ||||
|             'contact_address' =>  $this->faker->address, | ||||
|             'invoice_status_code' => 'sent', | ||||
|             'amount' => $amount, | ||||
|             'company_id' => $this->company->id, | ||||
|         ]; | ||||
|  | ||||
|         return $data; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user