Friday, September 8, 2017

Choosing the first available program from list of options

GNU tar accepts an external program to perform compression, via the option --use-compress-program. I'd normally want pigz if it's available, but if not, fallback to gzip. Is there a compact way to get represent this? Yes! which --skip-alias --skip-functions pigz gzip 2>/dev/null | head -1 GNU...

Monday, March 27, 2017

What is a @dataProvider?

I'm asked about data providers almost every time I introduce a developer to PHPUnit. Once you understand them, they're quite clear, but on first pass they seem to give developers pause. So what are they? Practically, a data provider is any static method that produces an array of arrays. The outer array...