Avoid false positives by utilising magic values in your tests
It can be very hard to spot a false positive within a test. So how do you avoid them?
Read more [timacdonald.me]
Posts tagged with testing
It can be very hard to spot a false positive within a test. So how do you avoid them?
Read more [timacdonald.me]
In this video, you'll learn how to generate code coverage reports, and how to display them directly in PhpStorm.
This video is part of our Laravel Package Training video course. In that course, you'll learn how to create both framework agnostic and Laravel specific packages. We'll also source dive some popular Spatie packages together, so you can pick up some tricks we apply there.
Join thousands of developers
Every two weeks, I share practical tips, tutorials, and behind-the-scenes insights from maintaining 300+ open source packages.
No spam. Unsubscribe anytime. You can also follow me on X.
Dave Marshall replies to a blogpost that Frank De Jonge published recently.
Read more [davedevelopment.co.uk]
In this video, Mohammed Said shares a nice, clean strategy for multitenancy in Laravel.
My buddy Nuno is working on an interesting project to improve the experience of writing tests.
Read more [nunomaduro.com]
– driesvints.com - submitted by Dries Vints
Here are three different ways you could test Laravel Cashier.
Read more [driesvints.com]
A must read by Frank de Jonghe on testing.
Read more [blog.frankdejonge.nl]
Recently we started using GitHub Actions to test all our packages. You can read more about our general setup in this blog post.
For most of the packages, this works great. However, some of our packages, such as Laravel Tags, use JSON functions that are not available in SQLite. Luckily it's straightforward to use a database like MySQL in GitHub Actions.
Have you every come across confusing if statements with complex conditionals such as this? I bet you did!
// please kill me 🤯
if (!(($this->shipping_country == "GB" || (strcmp($this-status, "Valid") !== 0)) {
To me, this is completely unreadable.
In the video below I show how I deal with this situation. Spoiler: add some tests around it and break the conditionals apart.
This video is part of the Mailcoach video course. It contains many more videos on how to write clear code. You can use this coupon code to get a nice discount of $10.
YES-I-WANT-TO-WRITE-READABLE-CODE
Sebastian Bergmann, creator of PHPUnit, walks us through some history and design decisions for PHPUnit.
Read more [thephp.cc]
Last week, my colleague Ruben and I released a package called spatie/docker, that makes it easy to spin up docker containers and execute commands on them. In this blog post, I'd like to introduce what you can do with it and why we built this.
Last week our team launched Mailcoach, a self-hosted solution to send out email campaigns and newsletters. Rather than being the end, laughing something is the beginning of a journey. Users start encountering bugs and ask for features that weren't considered before.
One of those features requests we got, is the ability the set the guard to be used when checking if somebody is allowed to access the Mailcoach UI.
In this blog post, I'd like to show you how we implemented and tested this.
– cwhite.me - submitted by Chris White
Disabling client-side browser validation will allow you to test your real validation rules, instead of Chrome's.
Read more [cwhite.me]
For many years we've relied on Travis to run the tests of our packages. For projects we used Circle CI. Recently we moved this responsibility from Travis and Circle CI to GitHub actions. In this blogpost I'd like to explain why and how we did this.
⚗️ One of the most common integrations developers struggle to test is Guzzle. Fortunately, it has a `MockHandler` you can set up to return predefined responses.
— Jason McCreary (@gonedark) 23 december 2019
Since it uses the existing `Client` and `Response` objects, there's no need to change your implementation. pic.twitter.com/Ui2Zyqj2Lt
Read more [twitter.com]
Here's a little tip: you can use `yield` in phpunit data providers to make them a little more readable pic.twitter.com/rQeKw7jBed
— Brent (@brendt_gd) 12 december 2019
Read more [twitter.com]
Mattias Geniar explains how you can use GitHub actions to run the testsuite of your Laravel app.
Last year we wrote a blogpost about our setup we use for Oh Dear! with Gitlab, and how we use their pipelines for running our CI tests. Since then, we've moved back to Github since they introduced their free private repositories. In this post I'll describe how we re-configured our CI environment using Github Actions.
Read more [ma.ttias.be]
Regarding https://t.co/Ky9pICMocc, here's an example (not saying it makes sense to write this test, just showing how it works). pic.twitter.com/1MOFXk1H79
— Matthias Noback (@matthiasnoback) 2 oktober 2019
Read more [twitter.com]
Roberto B wrote a good tutorial on how to test your Laravel 6 application using GitHub actions.
The scenario that I would like to explain you is: I have a Web App based on Laravel 6, every time I push some new code on master branch on the GitHub repository, I would like to execute automatically Unit tests and Feature tests.
Read more [medium.com]