Acceptance test for redmine 6568
Follow normal ordering also in common bundles

Evaluate variables promises before classes promises.

Also reduce code duplication.

Fixes Redmine 6568
Merge pull request #1971 from vohi/redmine/6568

Redmine/6568: Fix ordering of variables and classes in common bundles