Added unit test for bug when calling getGlobals() before addGlobal() on Twig_Environment.
merged branch deadbeef84/getglobals-before-addglobal-bug (PR #990)

This PR was merged into the master branch.

Commits
-------

667b274 Added unit test for bug when calling getGlobals() before addGlobal() on Twig_Environment.

Discussion
----------

Bug when calling getGlobals() before addGlobal() on Twig_Environment.

There seems to be an issue when calling getGlobals() before addGlobal(), the globals wont get updated. It doesn't seem to matter if the global existed before the call to getGlobals(). An update of the globals can be forced by calling an additional getGlobals() after the addGlobal() call.

I believe the problem has something to do with runtimeInitialized/extensionInitialized being set to true during rendering, but globals don't get updated during that phase.

Not sure how to fix it so I'm just sending you a unit test showcasing the bug.
fixed globals when getGlobals is called early on (closes #990)