PHPUnit: Testing Abstract Classes with an anonymous class
Before PHP 7, the only way to test an Abstract Class was to mock it, or to create a new Class separately and extending the abstract in just some other file separately.
Now, thanks to PHP 7, anonymous classes can be saved in one line. So no more empty instantiable classes in a separate file just for testing or mocking a class and “expecting” a method without testing the inner functionality.
This really helps with putting the testing logic into the file in charge of the testing instead of creating files not related to it or cluttering up unnecessary code.