For years, the test framework EcomDev_PHPUnit is quasi-standard for Magento unit tests. The current version is 0.3.7 and last state of official documentation is version 0.2.0 – since then, much has changed which you have to search yourself in code and GitHub issues. This series shall collect practical usage tips.
Tip #8: “sort_order is ambiguous” Error
Zend_Db_Statement_Exception: SQLSTATE: Integrity constraint violation: 1052 Column ‘sort_order’ in order clause is ambiguous
If you get this MySQL error in your tests, you probably forgot the attribute set in your EAV fixtures.
attribute_set_id should always be set, even for customers and addresses (just use “0” there)