Inline tests for PHP

So, what are the advantages of inline tests compared to conventional unit tests (PHPUnit, etc.)?
Benefits
- Simplicity and speed of adding tests : needless to say, sometimes you want to write a test, but when you remember that for this you will have to create the entire hierarchy of folders for this class (e.g. App_Module_Class), then create a file and a test class, write the same boring code checks, then look for where this PHPUnit is located and how to run it correctly - hands drop. And it’s not a pity to do this if the test is complex and important, but when it’s simple ...
- Inline tests can supplement / replace the documentation of the method : indeed, it is sometimes easier for the programmer to understand the essence of the code by reading what and under what parameters it returns than reading the description.
- Inline tests can even be written for private methods of the class : since the startup script actually extracts functions and methods from the context, it does not matter if they are private or public.
- They cannot be lost : tests will always be with the code.
Of course, the scope of such tests is rather narrow, there are 2 limitations:
Limitations
- Only suitable for simple tests : firstly, the test needs to be placed on one line of the comment, and secondly, you can’t write a complex test using the interconnection of several functions.
- Only suitable for isolated functions / methods : a function should communicate with the outside world only through arguments and return value.
You can download the test run script here: github.com/ptrofimov/phpinlinetest
P.S. Since PHPUnit uses assert tags to auto-generate its tests, it was decided to keep the same name for compatibility.