Fixed bug with incorrect arguments placement in generated command line

Unfortunately I introduced a new bug with my previous bugfix: Composer command line was generated incorrectly if there were arguments:
`php --arg composer.phar install` instead of `php composer.phar install --arg`

This commit fixes the bug and adds more conditions in unit test.