# |
Jul 18th 2019, 13:10 |
neon1024 |
@spriz Oh no, is it that much of a pain! :grimacing: |
# |
Jul 18th 2019, 13:10 |
neon1024 |
I guess I could use the callback to make an array and assert that |
# |
Jul 18th 2019, 13:10 |
spriz |
which suck |
# |
Jul 18th 2019, 13:10 |
spriz |
No good answers from me, then. Besides checking raw SQL |
# |
Jul 18th 2019, 13:10 |
neon1024 |
Sometimes it adds contain and where, sometimes just where, etc |
# |
Jul 18th 2019, 13:10 |
spriz |
I found that troublesome previously |
# |
Jul 18th 2019, 13:10 |
spriz |
Ah yes |
# |
Jul 18th 2019, 13:09 |
neon1024 |
I have a behaviour which appends conditions to a query. I’d like to unit test it with various queries to ensure it’s doing what I expect |
# |
Jul 18th 2019, 13:09 |
spriz |
the the correct things were actually applied with ->where() ? |
# |
Jul 18th 2019, 13:09 |
spriz |
what do you want to test? |
# |
Jul 18th 2019, 13:09 |
spriz |
I'd assert on the SQL if i wanted to be that specific |
# |
Jul 18th 2019, 13:08 |
neon1024 |
I’m not sure how I would assert in a loop like that, I’d much prefer `$where->getConditions(): array` but it doesn’t seem to be in the API unless I’ve missed it |
# |
Jul 18th 2019, 13:07 |
neon1024 |
`$where = $query->clause('where'); $where->iterateParts($callable);` |
# |
Jul 18th 2019, 13:07 |
neon1024 |
I’d like to match a where, but I can’t get past |
# |
Jul 18th 2019, 13:06 |
neon1024 |
Do you get parts of the query and assert that, or assert on the SQL? |
# |
Jul 18th 2019, 13:06 |
neon1024 |
How do people assert on beforeFind? |
# |
Jul 18th 2019, 13:04 |
spriz |
I want to avoid the `stream_get_contents()` in that gist |
# |
Jul 18th 2019, 13:04 |
spriz |
@graziel thanks, but I think I did not explain it well enough - here is 10 lines that explain my troubles :slightly_smiling_face: https://gist.github.com/Spriz/8a3ce743f012e7ecd1714642e2256ca8 |
# |
Jul 18th 2019, 13:00 |
neon1024 |
..and ensure you sanitise any input query params |
# |
Jul 18th 2019, 12:59 |
neon1024 |
@noel If you want to sidestep the pre-flight OPTIONS request, proxy the api endpoint in your application and call that from Node |
# |
Jul 18th 2019, 12:58 |
graziel |
`->getBody()->write($string); |
# |
Jul 18th 2019, 12:58 |
neon1024 |
@noel https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS |
# |
Jul 18th 2019, 12:58 |
spriz |
I have data in a stream I got from `fopen()` :) |
# |
Jul 18th 2019, 12:58 |
neon1024 |
@noel This is part of the AJAX specification to prevent cross-origin ajax requests |
# |
Jul 18th 2019, 12:57 |
spriz |
Hi peeps! Is there an easy way to pass on all data in a php resource/stream to `$this->response->withBody()` (It expects a PSR StreamInterface) :thinking_face: |
# |
Jul 18th 2019, 12:33 |
noel |
I should point out that the same request made via Postman works but it doesn't work via axios. |
# |
Jul 18th 2019, 12:28 |
noel |
Hi. I'm working with the friendsofcake/CRUD plugin. I'm having a problem with DELETE messages, where it's hitting pre-flight check OPTIONS and failing. Not sure whether I need to configure CakePHP or axios to fix this, nor how? |
# |
Jul 18th 2019, 12:22 |
acosonic |
@neon1024 suggestion to use sendgrid is good for mass mailing |
# |
Jul 18th 2019, 12:21 |
acosonic |
@davorminchorov as I say... A watcher to watch for that in logs, then retry once timeout occcurs, however with gmail you have limitations, like 2000 messages per day... |
# |
Jul 18th 2019, 11:50 |
davorminchorov |
@neon1024 nope, only timeout in the logs |
# |
Jul 18th 2019, 11:49 |
slackebot |
<info356> |
# |
Jul 18th 2019, 11:43 |
neon1024 |
I guess you can’t check the response as you don’t get one right? |
# |
Jul 18th 2019, 11:43 |
davorminchorov |
Yeah that's something that I'll work on later on but it's weird that it timeouts randomly |
# |
Jul 18th 2019, 11:40 |
neon1024 |
All I could suggest would be using a message queue, so if it times out the worker re-adds the message to the queue to try again |
# |
Jul 18th 2019, 11:40 |
davorminchorov |
20-30 seconds I think, and then NGINX timeouts |
# |
Jul 18th 2019, 11:39 |
neon1024 |
@davorminchorov How long do you wait for a timeout? |
# |
Jul 18th 2019, 11:38 |
davorminchorov |
Yeah, this app will send a ton of emails and I don't have time to fight with spam |
# |
Jul 18th 2019, 11:38 |
neon1024 |
Ah :face_palm: I see my mistake in my unit test now! |
# |
Jul 18th 2019, 11:37 |
neon1024 |
@davorminchorov Just for balance I’m the total opposite of @acosonic and would never setup my own mail server for sending email, and would instead use a service like Sendgrid |
# |
Jul 18th 2019, 11:36 |
acosonic |
@davorminchorov anything that you have full control and responsibility of... If it's mail server, then it means making your own stmp, and ensuring it gets 10/10 on mail-tester.com ... |
# |
Jul 18th 2019, 11:35 |
neon1024 |
When unit testing, do I have to declare a schema for a table? It seems to be missing, but I am not mocking the table class, and I’m using a fixture |