Avoid double implode which generates notices
Switched "expected" and "actual" in test assertions to make debugging easier
Merge pull request #5934 from mnapoli/test-fixes

Unit test fixes