# |
Jul 13th 2017, 15:07 |
sauvaget |
Although I don't really care about how long they run |
# |
Jul 13th 2017, 15:07 |
sauvaget |
Haha okay ;) |
# |
Jul 13th 2017, 15:07 |
neon1024 |
Well I mean, that’s what I would do ;) |
# |
Jul 13th 2017, 15:07 |
neon1024 |
@sauvaget If you’re running tests on push, then I would stick to critical path unit tests. Integration tests take a long time to run |
# |
Jul 13th 2017, 15:06 |
johnwayne |
@ericadeefox and @neon1024 thank you I will take a look tommorow, thank you for the tips :slightly_smiling_face: |
# |
Jul 13th 2017, 15:06 |
sauvaget |
I think that is probably my main problem, I just haven't got enough experience, when to use which testing method |
# |
Jul 13th 2017, 15:05 |
sauvaget |
So I should abort the Integration Test completly and only write Unittests or can I somehow inject the mocked class into my integration test? |
# |
Jul 13th 2017, 14:55 |
neon1024 |
I like to write my CakePHP helpers in a TDD way to keep my hand in :P |
# |
Jul 13th 2017, 14:55 |
neon1024 |
Which then ties into writing ‘testable code’, which helps loads. Especially if you respect the SOLID principles |
# |
Jul 13th 2017, 14:54 |
neon1024 |
At least in my experience ;) |
# |
Jul 13th 2017, 14:54 |
neon1024 |
Keeping your unit under test as small as possible will make writing tests super easy |
# |
Jul 13th 2017, 14:53 |
neon1024 |
By having your stub MailGun class return a 500 or something |
# |
Jul 13th 2017, 14:53 |
neon1024 |
You might want to test the third party service failing |
# |
Jul 13th 2017, 14:53 |
neon1024 |
As all you can really test is that you send a request |
# |
Jul 13th 2017, 14:52 |
neon1024 |
But if you’re using a third party to send mail, it’s pretty pointless to test it |
# |
Jul 13th 2017, 14:52 |
neon1024 |
In this case to unit test your email send, you would inject a mock Mailgun class which has a fixed return |
# |
Jul 13th 2017, 14:51 |
neon1024 |
That is not unit testing, that is integration testing. |
# |
Jul 13th 2017, 14:50 |
slackebot |
That's why I thought testing the tasks directly would do the trick. |
# |
Jul 13th 2017, 14:50 |
sauvaget |
Okay, but for example in my QueueShellTest I create the Job SendEmail and start the worker with ``` $this->QueueShell->runworker(); ``` It will do everything fine. Now for sending the Email I use Mailgun. I don't really want to call the Mailgun API every time I run my Unittests (which run with every push to gitlab) So I will have to Mock the method in my SendEMail Task. But since I am not testing the Task directly I don't know how to Mock th |
# |
Jul 13th 2017, 14:50 |
sturm |
Wait; nevermind. I totally didn’t check the Add and Edit pages. |
# |
Jul 13th 2017, 14:49 |
sturm |
Working on the final part, “Improving the Tagging Experience,” and I don’t see what the changes have done. I don’t see the list of tags as a string anywhere. |
# |
Jul 13th 2017, 14:45 |
sturm |
Back for another round of being confused by the boomarker tutorial! |
# |
Jul 13th 2017, 14:44 |
neon1024 |
I would recommend unit testing the methods in your worker, probably using a fixutre |
# |
Jul 13th 2017, 14:44 |
sauvaget |
Hey guys, I am having a little problem writing some Tests. I am using @dereuromark cakephp-queue plugin. Now I have a test for the QueueShell. But I would also like to test my actual tasks. Unfortunatly there is no example file for that case and I am still pretty noobie testing wise. Has anybody got an example lying around? |
# |
Jul 13th 2017, 14:28 |
ericadeefox |
day 2 of this error message: `Cake\Routing\Exception\MissingControllerException: Controller class could not be found.` |
# |
Jul 13th 2017, 14:27 |
ericadeefox |
^I use that! it's 10/10, really easy to set up, makes it super easy to build queries, lmk if you want to see how I use it @johnwayne |
# |
Jul 13th 2017, 14:26 |
neon1024 |
I’d use the friendsofcake/search plugin personally |
# |
Jul 13th 2017, 14:18 |
johnwayne |
my idea was to explode string and for each word make where 'Table.column_name Like' =>'%'.$search_term.'%'... |
# |
Jul 13th 2017, 14:17 |
johnwayne |
What is the best practice to build a query with a multi-word search string, searching multiple fields and/in multiple tables? |
# |
Jul 13th 2017, 14:09 |
nemmons |
@jack-sparrow in the first iteration of the foreach loop, `$arrOfFields[$value]['option_labels'][$t]['count']` hasn't been defined yet. You could solve this by adding (on line 36 of the pastebin code) `$arrOfFields[$value]['option_labels'][$t]['count'] = 0;` |
# |
Jul 13th 2017, 14:08 |
nemmons |
@devito https://book.cakephp.org/3.0/en/orm/validation.html is a good overview. It looks like it says you should be able to validation before saving |
# |
Jul 13th 2017, 13:47 |
devito |
cause something odd happened to me last night. i went to check entity->errors() before i save and its empty but after i attempt to save its got errors in it. is that the propper way to check? |
# |
Jul 13th 2017, 13:44 |
devito |
do validation errors get set after a save attempt or before? |
# |
Jul 13th 2017, 13:42 |
jack-sparrow |
https://pastebin.com/dRBTeCQF here i am getting //error : Warning (2): Illegal string offset 'count'.. i want to store how many time i got the specifc values like "Less than 6 months" count |
# |
Jul 13th 2017, 13:02 |
obinoob |
for values that are not obligatory in view I use the ->has('property') in case I need property->name can i use "has"? |
# |
Jul 13th 2017, 12:55 |
clementcrown |
if $sub <1, I still get the $audiomax and the rest complaining of variable undefined |
# |
Jul 13th 2017, 12:54 |
clementcrown |
@mikesmoniker above is my code |
# |
Jul 13th 2017, 12:42 |
mikesmoniker |
@clementcrown You’re referencing a variable $sub) that hasn’t been defined (yet), but we can’t tell much else from that one line alone. |
# |
Jul 13th 2017, 12:23 |
clementcrown |
any idea ? |
# |
Jul 13th 2017, 11:58 |
clementcrown |
for example, i do get this Notice (8): Undefined variable: sub [APP/Controller\SubscriptionsController.php, line 67] in my view..... |
# |
Jul 13th 2017, 11:57 |
hmic |
admad: i guess he is talking about something like: $arr['key'] = null; |