JENKINS-25226] - A direct unit test for the issue

The test checks that the variables substitution works properly for build parameters.
The change also refactors the provisioning of PerforceSCM stubs.

Signed-off-by: Oleg Nenashev <o.v.nenashev@gmail.com>
[FIXED JENKINS-25226] - Resolve environment variables with a highest priority

Other variables (projects, default parameters, etc.) will be used in the case of missing macros.
It should not happen in general, but may appear in buildEnvironment()

Signed-off-by: Oleg Nenashev <o.v.nenashev@gmail.com>