Use chdir() instead of calling multiple commands.

This improves compatibility with windows, and continues to work on *nix
systems.

Refs #5011
Fix doubly inflected variable names in controller task.

Variable names should not be doubly inflected.

Refs #5002
Don't mutate cwd.

Running composer dumpautoload should not mutate cwd.

Refs #5011
Make method name better represent what it is going to do.

Refs #5002
Merge pull request #5012 from cakephp/issue-5011

Fix a few issues.