public function testTimeFormat()
 {
     // arrange
     // act
     $formattedTime = npmso_time_format($this->testDateTime);
     // assert
     $this->assertEquals('9:41 am', $formattedTime);
 }
예제 #2
0
 /**
  * Sends a notification that an occurrence has been cancelled
  */
 public function sendCancellationNotification(OpportunityOccurrence $occurrence)
 {
     $opportunity = $occurrence->opportunity;
     $occ_type = $occurrence->opportunity->type;
     // Process all the various attributes and form the proper email to send
     $fromEmail = $this->_getFromEmail($occurrence);
     $recipients = [$opportunity->beneficiary->organization->from_email];
     if ($beneficiaryContact = $occurrence->opportunity->contact_email) {
         $recipients[] = $beneficiaryContact;
     }
     // All emails need these standard email fields
     $config = \NpmWeb\ServiceOpportunities\Models\Config::singleton();
     $email = ['recipients' => $recipients, 'sender' => [$fromEmail => $config->system_name . ' Admin System'], 'subject' => $config->system_name . ' Cancellation: ' . $opportunity->name];
     $customData = ['organization' => $opportunity->beneficiary->organization->name, 'beneficiary' => $opportunity->beneficiary->name, 'event_title' => $opportunity->name, 'event_date' => npmso_email_date_format($occurrence->occurrence_date), 'event_start_time' => npmso_time_format($occurrence->start_time), 'event_end_time' => npmso_time_format($occurrence->end_time), 'sponsorship_end_date' => npmso_email_date_format($occurrence->sponsorship_end_date), 'email_signature' => $opportunity->beneficiary->organization->email_signature, 'email_signature_address' => $fromEmail];
     $tmplData = array_merge($email, $customData);
     if ($occ_type == 'regular') {
         $this->sendEmail(['service-opportunities::backend.opportunity-occurrences.email.cancellation_regular_html', 'service-opportunities::backend.opportunity-occurrences.email.cancellation_regular_text'], $tmplData);
     } else {
         /* Is a sponsorship */
         $this->sendEmail(['service-opportunities::backend.opportunity-occurrences.email.cancellation_sponsorship_html', 'service-opportunities::backend.opportunity-occurrences.email.cancellation_sponsorship_text'], $tmplData);
     }
 }