# |
Jun 10th 2021, 17:41 |
greg138 |
Simulate which part of it? There's great support for testing controller actions with any method you want and any data you care to pass to them. |
# |
Jun 10th 2021, 17:41 |
kevin.pfeifer |
now i understand |
# |
Jun 10th 2021, 17:41 |
kevin.pfeifer |
ahhhhhh |
# |
Jun 10th 2021, 17:41 |
tyler.adam.lazenby |
sorry just lots of issues and my adhd brain is developing code and asking at the same time |
# |
Jun 10th 2021, 17:40 |
tyler.adam.lazenby |
problem is how do you simulate making the request from a page with unit testing? |
# |
Jun 10th 2021, 17:40 |
greg138 |
If it's something that's going to be invariant, why wouldn't you use a unit test? It confirms your initial code, and also makes sure it keeps working forever. |
# |
Jun 10th 2021, 17:39 |
kevin.pfeifer |
why should that be janky? |
# |
Jun 10th 2021, 17:39 |
kevin.pfeifer |
ok then i totally dont get what youre asking :,) |
# |
Jun 10th 2021, 17:39 |
tyler.adam.lazenby |
Just seems janky |
# |
Jun 10th 2021, 17:38 |
tyler.adam.lazenby |
hahaha yeah yeah I know |
# |
Jun 10th 2021, 17:38 |
kevin.pfeifer |
well you can set a xdebug breakpoint in a test as well if you want :) |
# |
Jun 10th 2021, 17:38 |
tyler.adam.lazenby |
and I use PHPstorm so unit testing is very easy |
# |
Jun 10th 2021, 17:37 |
tyler.adam.lazenby |
because I use a CI |
# |
Jun 10th 2021, 17:37 |
tyler.adam.lazenby |
ok, I get that, but I also am unit testing lol |
# |
Jun 10th 2021, 17:37 |
kevin.pfeifer |
in this case where you probably just return json data and want to check what is in a variable you can also just log the variable with `Log::write()` |
# |
Jun 10th 2021, 17:35 |
tyler.adam.lazenby |
I personally make heavy use of `debug()` and `dd()` |
# |
Jun 10th 2021, 17:34 |
tyler.adam.lazenby |
without having to pass that |
# |
Jun 10th 2021, 17:34 |
tyler.adam.lazenby |
I am basically trying to make an ajax command that will check if the page making the request is contact action called view, and then check to see what the ID of the viewed item is |
# |
Jun 10th 2021, 17:34 |
kevin.pfeifer |
but I know enough people who still prefer/löve `var_dump()` aka `pr()` |
# |
Jun 10th 2021, 17:34 |
tyler.adam.lazenby |
hahaha |
# |
Jun 10th 2021, 17:33 |
kevin.pfeifer |
I basically can't live without xdebug any more :) |
# |
Jun 10th 2021, 17:33 |
tyler.adam.lazenby |
exactly, like if for example I am making sure I am getting the referrer's parsed parameters |
# |
Jun 10th 2021, 17:28 |
kevin.pfeifer |
like when you are first creating the logic for that controller action? |
# |
Jun 10th 2021, 17:26 |
tyler.adam.lazenby |
when you are first going through creating a controller action, and want to make sure you are getting the right information passed, do you use unit testing (as opposed to just echoing it to the screen) or is there a more "standard" approach? |
# |
Jun 10th 2021, 13:52 |
philo.hamel |
see `colType` |
# |
Jun 10th 2021, 13:51 |
philo.hamel |
https://github.com/FriendsOfCake/search/tree/master/docs#like |
# |
Jun 10th 2021, 13:49 |
philo.hamel |
```->like('myfield', [ 'field' => 'myfield', 'colType' => ['myfield' => 'string'], ])``` |
# |
Jun 10th 2021, 13:47 |
philo.hamel |
that was easier in CakePHP 2, at least that's what I'm finding while migrating our application |
# |
Jun 10th 2021, 13:46 |
kevin.pfeifer |
sometimes its not possible to just jam everything into just one search input and you have to add more inputs to allow more precise searching |
# |
Jun 10th 2021, 13:42 |
kevin.pfeifer |
well I would guess you want to do something like that, right? ```'Users.myfield LIKE' => '%test%'``` where Users.myfield is a decimal but your search input is a string |
# |
Jun 10th 2021, 13:40 |
paolo.bragagni |
PS. we are only 3 that use this slack?? :( |
# |
Jun 10th 2021, 13:39 |
paolo.bragagni |
in friendsofcake search plugin which is the best way to manage errors (I mean Cannot convert value of type `string` to a decimal) |
# |
Jun 10th 2021, 13:11 |
kevin.pfeifer |
thanks for that explanation :) |
# |
Jun 10th 2021, 13:10 |
kevin.pfeifer |
i see |
# |
Jun 10th 2021, 13:04 |
admad |
@kevin.pfeifer @thomas078 There problem isn't with env variables but with the `.env` files. Env variables as per their belong in the environment not files. The `.env` files should only be used locally to emulate env vars. In production only **actual** env vars should be used. |
# |
Jun 10th 2021, 11:30 |
slackebot |
<jpramirez> |
# |
Jun 10th 2021, 09:34 |
thomas078 |
confusing |
# |
Jun 10th 2021, 09:34 |
thomas078 |
@kevin.pfeifer how i understand is that it is atleast a performance issue. .env variables should be set to local environment, not using that file |
# |
Jun 10th 2021, 09:30 |
kevin.pfeifer |
@thomas078 I am also curious about that `.env` topic because there is no warning about that in the cakephp 4 book https://book.cakephp.org/4/en/development/configuration.html#environment-variables |
# |
Jun 10th 2021, 09:09 |
kevin.pfeifer |
or whatever webserver you are using |
# |
Jun 10th 2021, 09:08 |
kevin.pfeifer |
See https://apache.tutorials24x7.com/blog/how-to-enable-tls-1-2-and-tls-1-3-in-apache-web-server for Apache or https://www.howtoforge.com/how-to-enable-tls-13-in-nginx/ for NGINX |