Laravel Community Tools by Tighten

Tag "testing" tricks

33 tricks
Often you have a form in your application that has a file input (logo, picture, etc...) and you would like to test it. You might have been stuck when trying to test that form, puzzled at the odd errors you got while you did used the attach() method provided in the Laravel Integrated test package. I will show you how to smoothly send a file to your server when you run your PHPUnit test suite.
MehdiSouih... 10 years ago 13150
There are many tricks to return the response in `json`. Actually, if the returned value is an array or instance of "arrayableinterface" or "jsonableinterface" such as eloquent model, you could just return it, it'll be a json, magically. There are following three way i have noticed performance :) Thanks. #KeepSharing
pratikbuta... 10 years ago 9010
While returning of date field in JSON, I found some unexpected output which i have posted on stackoverflow. You can see here for more information: http://stackoverflow.com/q/31184170/1318946
pratikbuta... 10 years ago 8705
Getting an instance of the Laravel IOC container for testing. ONLY IF THE FUNCTIONAL TEST IS INSIDE A LARAVEL PACKAGE YOU CAN DO THE FOLLOWING: EXTEND THIS FROM YOUR PARENT TEST CLASS.
Mahmoudz 10 years ago 6840
1 . remove the Laravel4 module from the functional.suite.yml 2. codeception build 3. inside the FunctionalHelper, do extend the \Codeception\Module\Laravel4 4. and there add your extra Laravel functions.
Mahmoudz 10 years ago 6148
If you are using Web Developer Extension in Firefox (or similar), you can enable the debug mode creating a cookie. Just create a cookie called 'debug' with value '1', and path '/', then open up your app.php and edit the debug option with the following:
davidmoral... 10 years ago 7141
I was looking for a way to remove one of my middlewares in testing. I could not find it, so I wrote a simple function to do it. Put the following function in your 'TestCase.php'
moon0326 10 years ago 9175
Until Taylor makes it part of Homestead, here's one way to add SSL support for your dev sites. Plenty of room for improvement, so please add your ideas. For example, generating the ssl certs in the loop, instead of including them.
jhauraw 11 years ago 24061