Revert to resolve realpath in lookupUnit().

Revert part of commit ecdce55. Fixes the problem with running phpunit.

Closes #4501.