Laravel Community Tools by Tighten

Tag "testing" tricks

33 tricks
This code shows how to trigger a Modal onScroll event to perform and assert against an ajax request
nezarfadle 8 years ago 8921
This code snippet overrides DuskTestCase->createBrowsers method to allow HTML elements count assertion
nezarfadle 8 years ago 9072
When I was testing some code I wanted to check if some variable in a JSON column was updated. I was thinking about a LIKE query but when I digged into Laravel's code I saw the following possibility. After all it was pretty obvious because you can do this with normal queries as well, but I still wanted to share this solution.
MrAtiebati... 9 years ago 7499
Don't forget to add the `DATABASE_QUERIES_DEBUG` in the .env file. Call this function `$this->debugDatabaseQueries()` from any service provider `register` function:
Mahmoudz 9 years ago 7053
Dynamically testing and Pagination feature in a Restful API
Mahmoudz 9 years ago 12826
Bumped into a problem while trying to authorize user against laravel basic auth middleware when testing a REST API through phpunit. I used phpunit call method to send a POST request to API's endpoint which needed users basic HTTP authentication. Every time, laravels basic auth middleware rejected it and I had no idea why, since I've sent proper HTTP Authorization header with phpunit call. Here is the solution ! Or watch it in a video https://www.youtube.com/watch?v=LCrt7jqDsgU Read more on http://laravel.io/forum/03-20-2014-authbasic-fails
Novica89 10 years ago 15944
When you have a model with unique value column and tries seeder your table using a big amout, sometimes the QueryException is thrown, because Faker doesn't know what values was previously generated and the number of combinations is limited.
lcdss 10 years ago 16056
DRY (Don’t Repeat Yourself) is a key principle in software engineering. It simply states that one should not reinvent the wheel while you are writing any application. If you have written some PHP application earlier, you will find that you are reinventing the wheel again and again to write the same process, like User Authentication, Database Management, Mailing Service, Validation System, etc. However, PHP now has effective and mature frameworks in hand that can perform nearly all the basic processes as stated above with their core. In fact, if you are smart enough, only then you will cherry pick the components from other frameworks like Zend, Laravel, Symfony, etc. This is the most hectic phase where you need to keep the dependencies of the required components, or else you will create a huge mess. Here are complete tutorial: http://www.cloudways.com/blog/composer-with-laravel/
wajidstack 10 years ago 7412
with this code you can test all get page without params (index,create,etc...)
d3v2a 10 years ago 14615