load('services.xml'); } } class YourCustomContext extends BehatContext { /** * @beforeSuite */ public static function bS() { echo __METHOD__ . "\n"; } } class MinkAwareInitializer implements InitializerInterface { private $mink; public function __construct(Mink $mink) { $this->mink = $mink; } public function supports(ContextInterface $context) { // in real life you should use interface for that return method_exists($context, 'setMink'); } public function initialize(ContextInterface $context) { $context->setMink($this->mink); } } class MinkContextClassGuesser implements ClassGuesserInterface { public function guess() { return "YourCustomContext"; } } #return new MyAwesomeExtension();