Fix incorrect variable incrementation in testall.
Redmine#5241: do not reevaluate promises for known classes
Short-circut evaluation of classes promises if class is already set

Close #5241
Acceptance test unstaged