As discussed in #12778, the table sort in
Piwik\DataAccess\LogQueryBuilder\JoinGenerator should be stable for more reliable testing.
In case the order of two joins is irrelevant, they are now sorted by the table alias which should be unique. This makes the sorting identical in PHP 5 and PHP 7.
Looks like some other tests need to be updated.
Still some failures in integration tests. Seems the join generator results in an invalid query?
I realised that using
uasort() and friends will simply not work. The problem is that these functions assume transitivity, i.e. if the callback reports that A < B and B < C (i.e. A depends on B, and B depends on C), then it should also report that A < C, but it doesn't.
I think we need to implement a topological sort.