Merge "Improve test coverage for ApiMain.php"