# |
Apr 12th 2019, 14:39 |
ricksaccous |
actually trimming white space would ruin some stuff |
# |
Apr 12th 2019, 14:39 |
neon1024 |
No, as I said, you don’t want to do that |
# |
Apr 12th 2019, 14:39 |
neon1024 |
Well that’s what `$this->assertResponseContains()` can do for you, but it doesn’t understand nesting |
# |
Apr 12th 2019, 14:39 |
ricksaccous |
you might be able to do assertEqual if you trim whitespace, not sure about that |
# |
Apr 12th 2019, 14:38 |
ricksaccous |
hehe, yeah i suppose, json as arrays seem the easiest in php |
# |
Apr 12th 2019, 14:38 |
neon1024 |
Even with fixtures |
# |
Apr 12th 2019, 14:38 |
neon1024 |
But you don’t want to to `$this->assertEqual($response, $json)` as it’s too fragile |
# |
Apr 12th 2019, 14:37 |
ricksaccous |
got it |
# |
Apr 12th 2019, 14:37 |
neon1024 |
@ricksaccous I am refactoring the way we produce our json response, away from a horrible helper into using league/fractal. So I need to have test-cases to ensure that the refactor is producing the same results as the existing response |
# |
Apr 12th 2019, 14:32 |
ricksaccous |
oh ok |
# |
Apr 12th 2019, 14:32 |
neon1024 |
I am writing a test-case for my JSON web service. So neither of those |
# |
Apr 12th 2019, 14:32 |
ricksaccous |
lol |
# |
Apr 12th 2019, 14:32 |
ricksaccous |
or just a raw json response? |
# |
Apr 12th 2019, 14:31 |
ricksaccous |
with html |
# |
Apr 12th 2019, 14:31 |
ricksaccous |
wait are you trying to grab the json out of a web page? |
# |
Apr 12th 2019, 14:31 |
neon1024 |
Makes sense, thanks @dereuromark |
# |
Apr 12th 2019, 14:31 |
neon1024 |
Yeah, array and assert array I guess |
# |
Apr 12th 2019, 14:31 |
dereuromark |
it can json decode for it |
# |
Apr 12th 2019, 14:31 |
ricksaccous |
oh wow |
# |
Apr 12th 2019, 14:31 |
neon1024 |
Figured perhaps regex? But regex on json feels kinda wrong |
# |
Apr 12th 2019, 14:31 |
dereuromark |
write your own assertJson..() methods via trait |
# |
Apr 12th 2019, 14:30 |
neon1024 |
I can use `$this->assertResponseContains()`, but it doesn’t seem to do nesting |
# |
Apr 12th 2019, 14:30 |
neon1024 |
I’d like to ensure that `{ "call": { "features": "" } }` exists |
# |
Apr 12th 2019, 14:30 |
neon1024 |
What’s a good solution for doing integration testing on json to assert something exists inside another dimension of json? |
# |
Apr 12th 2019, 14:08 |
spencdev |
looks like `$this->request->session()` is where I can check how much time is left |
# |
Apr 12th 2019, 14:01 |
spencdev |
by interfering I mean extending the timeout, I'm just using the basic auth componenet |
# |
Apr 12th 2019, 13:59 |
dereuromark |
depens on how he is locked in. and checking the session is not really interfering with it is it? |
# |
Apr 12th 2019, 13:52 |
spencdev |
hey, been away from cake for awhile, is it possible to check if a user is logged in without interfering with the session? |
# |
Apr 12th 2019, 13:37 |
ricksaccous |
including all fields necessary for joining |
# |
Apr 12th 2019, 13:37 |
ricksaccous |
if you ->select you are required to specify fields in contain |
# |
Apr 12th 2019, 13:37 |
ricksaccous |
->select and within a contain 'fields' key |
# |
Apr 12th 2019, 13:36 |
liaogz82 |
say i want to show tag id |
# |
Apr 12th 2019, 13:36 |
liaogz82 |
how do I filter away the columns of tags? |
# |
Apr 12th 2019, 13:35 |
liaogz82 |
then for hasMany relationship say article has many tags |
# |
Apr 12th 2019, 13:35 |
liaogz82 |
ok |
# |
Apr 12th 2019, 13:15 |
josbeir |
there's many ways to do joins in the orm... |
# |
Apr 12th 2019, 13:15 |
josbeir |
@liaogz82 read up on associations, contain and query builder |
# |
Apr 12th 2019, 13:14 |
josbeir |
fridays... |
# |
Apr 12th 2019, 13:11 |
dereuromark |
one to many or one too mayn? :P |
# |
Apr 12th 2019, 13:09 |
liaogz82 |
its one to many |
# |
Apr 12th 2019, 13:07 |
liaogz82 |
if i want to do a left join across 3 tables how do i do it? |