[ 'request_registered' => 'p-registered', 'payment_confirmed' => 'p-payment', 'report_ready' => 'p-report', ]]); $this->service = app(SmsNotificationService::class); } public function test_request_registered_dispatches_sms_to_requester(): void { $this->service->requestRegistered(Document::factory()->create()); Queue::assertPushed(SendPatternSms::class, 1); } public function test_payment_confirmed_dispatches_sms_to_invoice_user(): void { $this->service->paymentConfirmed(Invoice::factory()->create()); Queue::assertPushed(SendPatternSms::class, 1); } public function test_report_ready_dispatches_sms_to_requester(): void { $this->service->reportReady(Document::factory()->create()); Queue::assertPushed(SendPatternSms::class, 1); } public function test_nothing_is_dispatched_when_pattern_is_missing(): void { config(['services.iranpayamak.patterns.request_registered' => null]); $this->service->requestRegistered(Document::factory()->create()); Queue::assertNothingPushed(); } public function test_nothing_is_dispatched_when_document_has_no_requester(): void { $document = Document::factory()->create(); $document->requester()->dissociate(); $document->setRelation('requester', null); $this->service->reportReady($document); Queue::assertNothingPushed(); } public function test_nothing_is_dispatched_when_user_phone_is_empty(): void { $document = Document::factory()->create(); $document->requester->phone = ''; $this->service->requestRegistered($document); Queue::assertNothingPushed(); } }