Log message #4052916

# At Username Text
# Jul 17th 2017, 14:59 neon1024 Or has mobile gone now? https://github.com/cakephp/cakephp/blob/master/src/Http/ServerRequest.php#L141
# Jul 17th 2017, 14:59 neon1024 Speaking of testing, anyone know how I can make a new ServerRequest instance which will pass an `is('mobile')` check?
# Jul 17th 2017, 14:54 neon1024 Then there is no need to even execute the query, you can just assert on the resulting object
# Jul 17th 2017, 14:54 ericadeefox ^^that makes sense
# Jul 17th 2017, 14:53 neon1024 If I had code building a complex query object, I’d unit test the method building the object
# Jul 17th 2017, 14:52 neon1024 Testing a part of the response will mitigate the problem, but only partially
# Jul 17th 2017, 14:52 neon1024 Bearing in mind that testing a fixed response will make your tests extremely fragile
# Jul 17th 2017, 14:50 ericadeefox ^^I can do that then. testing responses will also suffice for what I'm doing, I was just curious, y'know?
# Jul 17th 2017, 14:49 neon1024 Unless you’re doing an integration test, in which case you should test the observable behaviour
# Jul 17th 2017, 14:49 neon1024 Or use fixtures and mock the database
# Jul 17th 2017, 14:49 neon1024 Or you need to test the generated SQL string, rather than letting it hit the database. As the Cake ORM already has tests
# Jul 17th 2017, 14:48 neon1024 Then it needs refactoring
# Jul 17th 2017, 14:48 ericadeefox @neon1024 it does, but the part of the site I'm testing is to do with lots of `foreach` statements and `if` statements and weird queries
# Jul 17th 2017, 14:46 neon1024 @ericadeefox That seems a strange thing to want to do
# Jul 17th 2017, 14:43 inoas johnwayne union
# Jul 17th 2017, 14:39 ericadeefox ok real quick question: when writing a test, is there a way to check for stuff in the SQL log?
# Jul 17th 2017, 14:19 Martin` hi :)
# Jul 17th 2017, 14:19 Junior yello )
# Jul 17th 2017, 13:45 neothermic Hmm, if I do a saveAll (which with the data I provide will be a saveMany call), and I set atomic to false, will it save all the ones it can and automatically skip over the ones that fail, or will it error on the first failure?
# Jul 17th 2017, 13:38 daniel_san cool, thanks!
# Jul 17th 2017, 13:36 adriencs @hmic thanks
# Jul 17th 2017, 13:30 dereuromark withData() still works afaik :slightly_smiling_face:
# Jul 17th 2017, 13:30 daniel_san How should I set values in a modelless forms in cake 3? https://book.cakephp.org/3.0/en/core-libraries/form.html> suggests to use $this->request-data( but that is marked as deprecated..
# Jul 17th 2017, 13:22 igreat NIce, I will look em up
# Jul 17th 2017, 13:22 dereuromark @igreat Did you hear about https://github.com/FriendsOfCake/awesome-cakephp#imagery yet? Always check the awesome list first :slightly_smiling_face:
# Jul 17th 2017, 13:21 cleptric Or use glide. ADmad wrote cake wrapper: https://github.com/ADmad/cakephp-glide
# Jul 17th 2017, 13:20 cleptric @igreat imagick ^^
# Jul 17th 2017, 13:19 ericadeefox ^^let me get the name of mine, it's a pretty good one.
# Jul 17th 2017, 13:19 igreat Please is there any plugin I can use for image resizing?
# Jul 17th 2017, 13:18 igreat Good day all
# Jul 17th 2017, 13:16 hmic adriencs: if you dont need the associated data but only the count, group and count in the query already!
# Jul 17th 2017, 13:06 adriencs yeah was looking at cakebook API, but it come after the query, load a sh!ton of data
# Jul 17th 2017, 13:05 hmic https://book.cakephp.org/3.0/en/core-libraries/collections.html
# Jul 17th 2017, 13:05 hmic you might want to checkout the Collection class docs - every query result is a collection actually, so you can use all of that goodness...
# Jul 17th 2017, 13:04 adriencs `->countBy` ? Never heard about that :thinking_face:
# Jul 17th 2017, 13:02 hmic adriencs maybe like: $q->find()->contain('OtherTable')->countBy(function($el) { retrun count($el->other_table); });
# Jul 17th 2017, 12:55 adriencs howTo: count results from a contain who's hasMany link ?
# Jul 17th 2017, 12:53 anvyst it should as per code: https://api.cakephp.org/1.3/source-class-View.html#380
# Jul 17th 2017, 12:36 BrainWork hi, in cakephp 1.3 (yes, i know, old version) is it possible to have a / in a call to $this->element() in a view? e.g. <?=$this->element('somedir/elementname')?> ? i ask because we have an awful lot of elements, it's a huge codebase.
# Jul 17th 2017, 12:13 juststeveking Would it be a virtual field, just with the result being an array of items?
# Jul 17th 2017, 12:03 juststeveking I have a Person model, and on that I have a method called collection. What collection does is get the result of a query to "collect" loads of data. I want the Model to load this by default