peridot-php / peridot

Event driven BDD test framework for PHP
http://peridot-php.github.io/
MIT License
328 stars 27 forks source link

Single context should be passed #139

Closed brianium closed 9 years ago

brianium commented 9 years ago

Context needs to be a dreaded singleton in order for it to work inside of a DSL. It is used sparingly in the codebase, but even that is too much.

It's singleton access should only be used in the DSL file, and possibly the top level of the application (Application?).

The current situation may cause problems (rarely) if a global composer version of Peridot is installed, as well as a local one - both having different versions. The problem would arise if both versions of the Context do not match. So the problem would arise if there is a global/local version mismatch AND the Context has been changed - a pretty rare case, but one that exists from the 1.14.0 jump to the 1.15.0 jump.

A goal for 2.0 should be to limit singleton access to only the points where necessary.