It is a common practice to put your tests apart from the actual code of the application, usually into the
In this article, I explain why I see it as a bad practice and why you should always put them right next
to the code they are testing.
Ctrl+Shift+Tthat works even without this practice).
Table ├── __snapshots__ | ├── simpleTable.html | ├── tableWithActions.html | └── tableWithCellRenderer.html ├── Cell.php ├── CellTest.php ├── Row.php ├── RowTest.php ├── Table.php └── TableTest.php
Example of tests for the UI component.
"This means less cognitive overhead, which is always important to keep in mind when architecting an application." 
Deleting test files in your build process with some smart
find command. I recommend
introducing some more robust naming convention (like
to prevent accidental deletion of the application's code.
.gitattributes. Just add
*.phpt export-ignore to the
in the root of your git repository and tests will be excluded from the
tar release package.
You can check the example
Fixtures and snapshots can be sorted out into
__snapshots__ directory which is placed
next to the test file. General tools and helpers can be placed in separate namespace inside of your application
or better: separated a dependency into its own package. Those directories can by deleted or excluded from distribuiton
as suggested above.
Yes, we use it at Brand Embassy on quite a huge project without any problems.
testsfolder as discussed here .
If you have any comment feel free to mention me on Twitter .
.gitattributes. (Tue Sep 25 00:53:09 2018 GMT+2)