tests working with emails alsog
This commit is contained in:
@@ -77,7 +77,7 @@ class ContactUsComponent extends Component
|
||||
/**
|
||||
* @return EntityInterface|ContactUsFormSubmission
|
||||
*/
|
||||
public function processContactUsForm(EntityInterface $contactUsFormSubmission, array $postData = null)
|
||||
public function processContactUsForm(EntityInterface $contactUsFormSubmission, array|null $postData)
|
||||
{
|
||||
if (!isset($postData)) {
|
||||
$postData = $this->getController()->getRequest()->getData();
|
||||
|
||||
@@ -22,10 +22,8 @@ class ContactUsFormSubmissionsMailer extends Mailer
|
||||
protected function confirmation(EntityInterface $contactUsFormSubmission, array $options = [])
|
||||
{
|
||||
$name = isset($contactUsFormSubmission['name']) ? $contactUsFormSubmission['name'] . ', ' : '';
|
||||
// un-hide the token to be able to send it in the email content
|
||||
$subject = __d('cake_contact_us', 'We have received your message');
|
||||
|
||||
|
||||
$this
|
||||
->setTo($contactUsFormSubmission['email'])
|
||||
->setSubject($name . $subject)
|
||||
@@ -46,13 +44,11 @@ class ContactUsFormSubmissionsMailer extends Mailer
|
||||
*/
|
||||
protected function backend(EntityInterface $contactUsFormSubmission, array $options = [])
|
||||
{
|
||||
$name = isset($contactUsFormSubmission['name']) ? ' by ' . $contactUsFormSubmission['name'] : '';
|
||||
// un-hide the token to be able to send it in the email content
|
||||
$subject = __d('cake_contact_us', 'Contact Us Form Submitted');
|
||||
|
||||
$name = isset($contactUsFormSubmission['name']) ? ' by ' . $contactUsFormSubmission['name'] : '';
|
||||
|
||||
$this
|
||||
->setTo(Configure::readOrFail('ContactUs.email.backend.to'))
|
||||
->setTo(Configure::readOrFail('ContactUs.fields.email.backend.to'))
|
||||
->setSubject($subject . $name)
|
||||
->setEmailFormat(Message::MESSAGE_BOTH)
|
||||
->setViewVars([
|
||||
|
||||
@@ -134,7 +134,6 @@ class ContactUsFormSubmissionsTable extends Table
|
||||
$this->getMailer($mailer)->send('confirmation', [$contactUsFormSubmission]);
|
||||
$updateData['confirm_email_sent'] = $now;
|
||||
} catch (CakeException $exception) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,11 +143,8 @@ class ContactUsFormSubmissionsTable extends Table
|
||||
$this->getMailer($mailer)->send('backend', [$contactUsFormSubmission]);
|
||||
$updateData['backend_email_sent'] = $now;
|
||||
} catch (CakeException $exception) {
|
||||
|
||||
}
|
||||
}
|
||||
Log::debug(print_r('$updateData', true));
|
||||
Log::debug(print_r($updateData, true));
|
||||
if ($updateData) {
|
||||
$contactUsFormSubmission = $this->patchEntity($contactUsFormSubmission, $updateData, ['validate' => false]);
|
||||
$this->saveOrFail($contactUsFormSubmission);
|
||||
|
||||
Reference in New Issue
Block a user