# |
Dec 25th 2019, 20:44 |
ashesh.social |
Thanks :raised_hands::skin-tone-3: |
# |
Dec 25th 2019, 18:30 |
ndm |
Means your form is missing the token, which should be added automatically when using the form helper. Check the generated HTML. |
# |
Dec 25th 2019, 18:24 |
ashesh.social |
In cakephp 4 |
# |
Dec 25th 2019, 18:24 |
ashesh.social |
But now it’s during form POST |
# |
Dec 25th 2019, 18:24 |
ashesh.social |
“Missing CSRF token body in /usr/local/myapp/vendor/cakephp/cakephp/src/Http/Middleware/CsrfProtectionMiddleware.php on line 234” |
# |
Dec 25th 2019, 18:04 |
ndm |
Oh well, maybe if there's something in your `contactUs()` method that overrides the transport |
# |
Dec 25th 2019, 18:03 |
ndm |
@challgren Sorry, had to have a chat with my neighbours about drill and sledgehammer powered home improvement work on christmas day's evening. I don't see anything inherently wrong with the code, if the mailers `deliver()` method is being reached, then I'd expect this to work. |
# |
Dec 25th 2019, 17:08 |
challgren |
Can't mock the mailer or set the transport |
# |
Dec 25th 2019, 17:05 |
slackebot |
<challgren> |
# |
Dec 25th 2019, 17:03 |
challgren |
That sets Email so I could mock it |
# |
Dec 25th 2019, 17:03 |
challgren |
getMailer is called on construct |
# |
Dec 25th 2019, 17:02 |
challgren |
Email is the mailer |
# |
Dec 25th 2019, 17:02 |
ndm |
I don't really know what's happening in `QueueCustomEmail`, so it's hard to tell, but if it's not called, then it's probably not the transports fault |
# |
Dec 25th 2019, 17:00 |
slackebot |
<challgren> |
# |
Dec 25th 2019, 16:59 |
challgren |
1) App\Test\TestCase\Shell\Task\QueueCustomEmailTaskTest::testRunFailure Expectation failed for method name is “send” when invoked 1 time(s). Method was expected to be called 1 times, actually called 0 times. |
# |
Dec 25th 2019, 16:59 |
challgren |
And @ndm mocked transport doesn’t work :( |
# |
Dec 25th 2019, 16:58 |
slackebot |
<ndm> |
# |
Dec 25th 2019, 16:58 |
ndm |
Totally different question, why do the CakePHP docs try to bamboozle poor meth users? |
# |
Dec 25th 2019, 16:49 |
challgren |
Figured this was gonna be an easy switch but seems like a bit got shuffled around |
# |
Dec 25th 2019, 16:49 |
challgren |
Ahh ok that makes sense. Just trying to learn the new methodology |
# |
Dec 25th 2019, 16:48 |
admad |
A trait which you use in your mailer |
# |
Dec 25th 2019, 16:46 |
challgren |
Ok so heres a question, the mailgun plugin has a couple convience functions that allow setting headers but without the all X-Mailgun-* wheres the best way to implement that now in the Message class or Mailer class? |
# |
Dec 25th 2019, 16:36 |
ndm |
no problem |
# |
Dec 25th 2019, 16:36 |
admad |
@ndm thanks for the doc update |
# |
Dec 25th 2019, 16:32 |
challgren |
But the exception makes more sense now to figure out how to semver a release back to prerelease and add the beta tag |
# |
Dec 25th 2019, 16:30 |
challgren |
No try { in https://book.cakephp.org/4/en/core-libraries/email.html |
# |
Dec 25th 2019, 16:30 |
ndm |
I thought I've seen an example in docs that wrapped the `Email::send()` call in `try ... catch`, but I can find it, so maybe that's just my imagination |
# |
Dec 25th 2019, 16:28 |
challgren |
Ok so I got some work on the mailgun plugin to fix things up |
# |
Dec 25th 2019, 16:26 |
ndm |
Failures in transports should be indicated by throwing exceptions |
# |
Dec 25th 2019, 16:25 |
challgren |
Im not sure honestly, but my question is since it returns an array and it looks like it always has headers and messages how does one detect a failure |
# |
Dec 25th 2019, 16:25 |
ndm |
Wasn't it always `array`, or least for quite some time? I don't remember |
# |
Dec 25th 2019, 16:22 |
challgren |
Yeah, before it returned mixed but now its array |
# |
Dec 25th 2019, 16:22 |
ndm |
Not sure what exactly you mean by "_it_"? The transport? |
# |
Dec 25th 2019, 16:18 |
challgren |
But it no longer returns false on failure :( |
# |
Dec 25th 2019, 16:18 |
challgren |
Ok @ndm you got something with replacing the transport |
# |
Dec 25th 2019, 15:56 |
ndm |
gn8 |
# |
Dec 25th 2019, 15:55 |
ndm |
Just sprinkle some more swapping magic on top :) |
# |
Dec 25th 2019, 15:54 |
challgren |
I'll try later though, it's bedtime |
# |
Dec 25th 2019, 15:53 |
challgren |
It's used during testing, it's magically swapped out in testing |
# |
Dec 25th 2019, 15:52 |
ndm |
How so? Where do you use that? |
# |
Dec 25th 2019, 15:50 |
challgren |
@ndm using a different transport would kill DebugTransport |