Re: Testing image upload

2011-12-13 Thread leigh
Hi Matteo, My first advice would be read this mate http://book.cakephp.org/2.0/en/development/testing.html it will help you. If you are using cake 2.0, which I'm starting to think you are.. the simplest solution for controller testing would be to use the kick ass generate method to stub out the

Re: Testing image upload

2011-12-13 Thread Matteo Landi
On Tue, Dec 13, 2011 at 3:49 AM, leigh wrote: > Hello Matteo, > > Looks like the only way is to wrap the functions, on a second look > Sebastian Bergmann's php-test-helpers is only for user created > functions. > > kind regards, > > Leigh Leigh, thanks for the hint. I made a quick search on Goog

Re: Testing image upload

2011-12-12 Thread leigh
Hello Matteo, Looks like the only way is to wrap the functions, on a second look Sebastian Bergmann's php-test-helpers is only for user created functions. kind regards, Leigh On Dec 13, 9:21 am, leigh wrote: > Hello Matteo, > > It's not supported because of PHP and if you wrap them you can > o

Re: Testing image upload

2011-12-12 Thread leigh
Hello Matteo, It's not supported because of PHP and if you wrap them you can override them. If you want to get full stubbing/mocking of functions use https://github.com/sebastianbergmann/php-test-helpers I've not used it yet. Google testing file uploads with phpUnit or simpleTest will bring up so

Re: Testing image upload

2011-12-12 Thread Miles J
That doesn't actually test if files are uploaded and image transformations worked. On Dec 12, 7:12 am, Matteo Landi wrote: > On Mon, Dec 12, 2011 at 4:46 AM, leigh wrote: > > Hi Matteo, > > > Wrap move_uploaded_file and is_uploaded_file inside the controller > > > function moveUploadedFIle($file

Re: Testing image upload

2011-12-12 Thread Matteo Landi
On Mon, Dec 12, 2011 at 4:46 AM, leigh wrote: > Hi Matteo, > > Wrap move_uploaded_file and is_uploaded_file inside the controller > > function moveUploadedFIle($filename, $destination) { >  return move_uploaded_file($filename, $destination); > } > > function moveUploadedFIle($filename, $destinatio

Re: Testing image upload

2011-12-11 Thread leigh
Hi Matteo, Wrap move_uploaded_file and is_uploaded_file inside the controller function moveUploadedFIle($filename, $destination) { return move_uploaded_file($filename, $destination); } function moveUploadedFIle($filename, $destination) { return is_uploaded_file($filename, $destination); } The

Re: Testing image upload

2011-12-11 Thread Matteo Landi
bump! On Sat, Dec 3, 2011 at 8:01 PM, Matteo Landi wrote: > Hi list, > what is the right way (if any) to test a controller which handles file > uploads? At the moment I fill $_FILES with an array containing the > fields expected by the controller (i.e. 'tmp_name', 'size', etc.) and > then invoke