# |
Jul 3rd 2018, 06:58 |
liaogz82 |
what kind of asserts I should use? |
# |
Jul 3rd 2018, 06:52 |
dakota |
As for testing it, controller tests allow you to capture the output, which you can then compare against a known CSV file |
# |
Jul 3rd 2018, 06:51 |
dakota |
https://github.com/FriendsOfCake/cakephp-csvview |
# |
Jul 3rd 2018, 06:51 |
dakota |
@liaogz82 Best tool is the CsvView plugin from FriendsOfCake |
# |
Jul 3rd 2018, 06:38 |
liaogz82 |
how do I read the exported data using unit test? |
# |
Jul 3rd 2018, 06:23 |
hmic |
liaogz82: whz not read it and compare to the data you tried to export in the first place? |
# |
Jul 3rd 2018, 06:20 |
liaogz82 |
and how do I write unit test that the export is indeed a CSV file? |
# |
Jul 3rd 2018, 06:17 |
hmic |
the reason is obvious though, you do have an input with no name assigned. |
# |
Jul 3rd 2018, 06:16 |
hmic |
mohitprakashsharma555: this looks like an js error to me. |
# |
Jul 3rd 2018, 06:02 |
liaogz82 |
hi guys, what are the best tools/library for CSV export in cake 3.5? |
# |
Jul 3rd 2018, 04:59 |
mohitprakashsharma555 |
hey gusy i am why i am getting `An invalid form control with name='' is not focusable.` this error |
# |
Jul 3rd 2018, 04:37 |
humbba12 |
thank you for your advice! |
# |
Jul 3rd 2018, 03:45 |
hmic |
chrisshick: your advice on the table structure of the settigns table is wrong too IMHO. you don't create columns for each setting but key/value fields only to save your settings! |
# |
Jul 3rd 2018, 03:43 |
hmic |
user settings usually go with a user_settings table, this is things like a currency or language for example |
# |
Jul 3rd 2018, 03:42 |
hmic |
enviromnent settings go with app_local.php for me, or just .env files, i personally keep api keys there too most of the time, because thez differ from the envs too |
# |
Jul 3rd 2018, 03:40 |
hmic |
i would want to implement different means of setting these! |
# |
Jul 3rd 2018, 03:39 |
hmic |
humbba12: you should consider different ways to have these settings stored. you seem to mix up different things here, like: environment dependent settigns (sandbox/production), you have settigns an admin might want/need to change - which might need to be protected in some way (like the payment api key) and application settings, maybe even user settings, like the currency |
# |
Jul 3rd 2018, 03:29 |
chrisshick |
No problem |
# |
Jul 3rd 2018, 03:27 |
humbba12 |
I appreciate your help |
# |
Jul 3rd 2018, 03:27 |
humbba12 |
thank you so much |
# |
Jul 3rd 2018, 03:27 |
humbba12 |
I see |
# |
Jul 3rd 2018, 03:25 |
chrisshick |
would be columns |
# |
Jul 3rd 2018, 03:24 |
chrisshick |
api_key environment currency |
# |
Jul 3rd 2018, 03:24 |
chrisshick |
Then, there shouldn't be an issue at all to just simply create a settings table with the options you need |
# |
Jul 3rd 2018, 03:22 |
humbba12 |
I'm sorry I mean no. I'm using the api in the controller |
# |
Jul 3rd 2018, 03:21 |
chrisshick |
with all the settings in it |
# |
Jul 3rd 2018, 03:21 |
chrisshick |
you could create a settings table |
# |
Jul 3rd 2018, 03:20 |
chrisshick |
but if you wanted to stick with models |
# |
Jul 3rd 2018, 03:20 |
chrisshick |
I would recommend using events and utilizing it that way |
# |
Jul 3rd 2018, 03:20 |
chrisshick |
Personally, any time you using models within models, it starts to get hairy and creates dependencies |
# |
Jul 3rd 2018, 03:18 |
humbba12 |
yes |
# |
Jul 3rd 2018, 03:17 |
chrisshick |
I'm assuming you are using the payment processor api directly in the model? |
# |
Jul 3rd 2018, 03:17 |
humbba12 |
for example to get the payment proccesor api key to charge the customer in orders model |
# |
Jul 3rd 2018, 03:16 |
chrisshick |
Why would you need it in other models? |
# |
Jul 3rd 2018, 03:02 |
humbba12 |
I'm working in a e-commerce website I need to give the admin the posibility to change payment proccesor api keys, change from sandbox to production, change currency, etc. I got Orders, coupons, users, customers controller and model, etc |
# |
Jul 3rd 2018, 02:35 |
chrisshick |
A few more details would hlep |
# |
Jul 3rd 2018, 02:35 |
chrisshick |
@humbba12 what are you trying to do? |
# |
Jul 2nd 2018, 23:45 |
humbba12 |
what would be the best aproach to handle settings table which I need in other models? |
# |
Jul 2nd 2018, 19:59 |
saeideng |
I did not see first goal |
# |
Jul 2nd 2018, 19:58 |
josbeir |
First jap goal was luck |
# |
Jul 2nd 2018, 19:58 |
josbeir |
Such teamwork |