diff --git a/app/Services/Scheduler/EmailProductSalesReport.php b/app/Services/Scheduler/EmailProductSalesReport.php index 5a473d0816..b9b0a18099 100644 --- a/app/Services/Scheduler/EmailProductSalesReport.php +++ b/app/Services/Scheduler/EmailProductSalesReport.php @@ -16,6 +16,7 @@ use App\Models\Scheduler; use App\Mail\DownloadReport; use App\Utils\Traits\MakesHash; use App\Utils\Traits\MakesDates; +use App\Jobs\Mail\NinjaMailerJob; use App\Jobs\Mail\NinjaMailerObject; use App\Export\CSV\ProductSalesExport; use App\DataMapper\Schedule\EmailStatement; diff --git a/tests/Feature/Scheduler/SchedulerTest.php b/tests/Feature/Scheduler/SchedulerTest.php index 5248b22194..222c21f5e4 100644 --- a/tests/Feature/Scheduler/SchedulerTest.php +++ b/tests/Feature/Scheduler/SchedulerTest.php @@ -55,6 +55,29 @@ class SchedulerTest extends TestCase ); } + + public function testProductSalesReportGeneration() + { + $data = [ + 'name' => 'A test product sales scheduler', + 'frequency_id' => RecurringInvoice::FREQUENCY_MONTHLY, + 'next_run' => now()->format('Y-m-d'), + 'template' => 'email_product_sales_report', + 'parameters' => [ + 'date_range' => EmailStatement::LAST_MONTH, + 'clients' => [], + ], + ]; + + $response = $this->withHeaders([ + 'X-API-SECRET' => config('ninja.api_secret'), + 'X-API-TOKEN' => $this->token, + ])->postJson('/api/v1/task_schedulers', $data); + + $response->assertStatus(200); + } + + public function testSchedulerGet3() { @@ -539,6 +562,7 @@ class SchedulerTest extends TestCase $response->assertStatus(200); } + public function testDeleteSchedule() { $data = [