Introduction
When we write a client to integrate an API in our systems it is important to test it to be sure we can handle every possible response.
Guzzle client provides a very simple way to mock external APIs responses: Guzzle Mock Handler. This tool provides a mock handler
that can be used to fulfill HTTP requests with a response or exception by shifting return values off of a queue.
Introduction
Imagine you need to use a fixed numeric value in your code, let’s say 20000. It is what we call a literal constant, that is a value that will always remain the exact same in your code.
Now imagine you need to use that value more than once. Sooner or later you will read your code and you will not remember what 20000 was, it will happen for sure. But what if you assign the value to an immutable variable with a meaningful name? Let’s say something like this:
Why do I need to test?
Everyone who works in software development has stumbled upon software testing.
Why should a developer know anything about testing?
Well, software testing is a valuable asset and a big part of development: it does not only test the application, it also teaches to think outside the box and to write code with quality in mind.
Software testing is not finding bugs
The goal of software testing is not only to find bugs and “break things”. Testing can range from a pure exploration of functionalities to a deep understanding of the tested application. Testing can give an idea of what, why and how the application is tested together with the guiding concept of quality.
The goal of this article is to define basic concepts related to testing, trying not to take anything for granted.
Why do we test??
Why is it important to write automated tests? I asked myself and I did some research because the answer to this question was not obvious to me. I knew it was important but I didn’t know why. So, I decided to try to explain it starting from a point of view as impartial as possible.
The 2020 edition of PHPDay took place on September 8th in a remote fashion.
Having experienced the 2019 edition (indeed my first one, despite being a PHP developer from eons!) I would say that it was a little difficult to stay focused for such a long event. However, given the high-quality level of lecturers and talks, it was totally worth the effort.
I would like to thank the folks at Grusp for their passionate work. Please support them!