The more dependencies a class has, the harder it becomes to initialize in unit tests with all its dependencies. Your tests will become longer and longer. This articles explores three ways to provide test doubles (also known as “mocks”) to your tested class, while keeping the tests as short and expressive as possible: Using properties in the test class, using a builder pattern with a fluent interface and using named parameters (available in PHP 8.
My notes from MenderCon 2021,
an open space conference on modernizing and improving existing codebases.
In this article you’ll learn how to run your PHPUnit tests whenever a PHP file changes. This is useful if you don’t use an IDE that does this or want to share the results during a pairing session where only one party has access to a PHP execution environment.
With the command line tool entr you can watch for changes in a list of files and run a command whenever one of the files changes.
“The Legacy of SoCraTes” is a virtual conference with talks on testing and
legacy code. You can find all the talks of the 3rd edition in the YouTube
playlist for the
This article is a summary of some talks.
My notes from some of the sessions I attended.
My notes from some of the sessions I attended, from hallway conversations and the schedule.
Here are my notes from some of the sessions I attended.
Keynote by David Snowden An inspiring talk about complexity and modeling, using the Cynefin framework to understand the nature of your domain (Complex/Complicated/Simple/Chaotic) and how to model and measure success according to that nature. What stood out to me was the idea that complex domains - like ecosystems, financial markets, large organizations or even “society” itself - can’t be analyzed and fully understood like complicated domains. Thus, they can’t be “modeled”, since every abstraction will miss crucial behavior.
I attended the SoCraTes Day Berlin and came back inspired and full of ideas I want to share with the world.
Lean Coffee We discussed estimations (Complexity vs time, who needs them, when are they helping) and I learned about the method of “Magic estimation”. Someone mentioned “Scripts to rule them all”, an attempt to establish a common set of scripts in each project that do certain project tasks like bootstrapping, resetting, updating, running the CI validation, etc.
I attended SoCraTes 2017 in Soltau. SoCraTes is an “Unconference”, where the participants set their own agenda and come up with topics for their sessions. Sessions can be presentations, workshops and open discussions.
Here are the notes from some of the sessions I attended:
Programming Exercise: Banishing State The example of this exercise was taken from a real-life project: A book indexing service that takes keyword/page number pairs as input and outputs either the page number, a range of page numbers or nothing, depending on previous inputs.
Test-driven driven development in PHP can become a pain when you’re dealing with the file system. The builtin functions like stat, getfilemtime, fopen and fgets assume the existence of actual files. Until now, I assumed you’d have to add a library like FileFetcher, Flysystem, Gaufrette or vfsSystem to your dependencies. While those libraries are nice, they are additional dependencies and some add additional capabilities like caching or providing a unified interface to cloud storage.