Fix a failing unit test

This should fix a unit test currently failing on selected environments (e.g. Travis).
This is a back-port of joomla/joomla-cms#2596