I guess because it threw me. In most cases, I've previously checked isPost, now is('post'). In other places, I would check for data, but that's not good practice now, because GET data is also on the request.
Also, when I see method="post" on the form element, and POST on the HTTP call, then I would expect the method on the request to also be post. If method() is going to report PUT, then I would expect that the actual form method, and HTTP verb would also be PUT. After all, that's convention (over configuration, or code obfuscation). On Wednesday, May 14, 2014, euromark <dereurom...@gmail.com> wrote: > I am not quite sure why you are making this into your own science project > :) > it is fairly simple actually > > have an "id" field in your table => edit => PUT > dont have an "id" field in your table => add => POST > > That's documented - and exactly as easy and straightforward as it sounds > > If you don't care about PUT/POST in your actions, you can indeed just > check for both (as I have always done so far): > > if ($this->request->is(array('post', 'put')) {} > > This works for all edit and add actions. Always. > > Done in a few seconds.. :) > > > > Am Mittwoch, 14. Mai 2014 02:09:51 UTC+2 schrieb Reuben: >> >> So, having decided to always specify the action is the Form::create, so I >> can only be concerns with detecting a POST for form submissions, I'd really >> like to make sure that is covered in my unit testing. >> >> But that's a tricky one. >> >> I guess I would need to write a unit test for any view that has a form, >> and mock the FormHelper to expect that any create() had an array with an >> action entry to specify the expected action. Writing unit tests for views >> is generally frowned on, so much so, that an example of how to do this is >> not given in the doco. >> >> If the issue holds my attention long enough, I'll post back. >> > -- > Like Us on FaceBook https://www.facebook.com/CakePHP > Find us on Twitter http://twitter.com/CakePHP > > --- > You received this message because you are subscribed to a topic in the > Google Groups "CakePHP" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/cake-php/3ypcXFatKQk/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > cake-php+unsubscr...@googlegroups.com<javascript:_e(%7B%7D,'cvml','cake-php%2bunsubscr...@googlegroups.com');> > . > To post to this group, send email to > cake-php@googlegroups.com<javascript:_e(%7B%7D,'cvml','cake-php@googlegroups.com');> > . > Visit this group at http://groups.google.com/group/cake-php. > For more options, visit https://groups.google.com/d/optout. > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.