davedevelopment/behat-registry

Inject a registry in to feature contexts

Maintainers

👁 davedevelopment

Package info

github.com/davedevelopment/behat-registry

Type:behat-extension

pkg:composer/davedevelopment/behat-registry

Statistics

Installs: 5 473

Dependents: 0

Suggesters: 0

Stars: 1

Open Issues: 0

v0.1.0 2013-04-18 22:16 UTC

Requires

Requires (Dev)

None

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT 21a200215a251a8e28828a67abd583e69fefb491

Behattest

This package is auto-updated.

Last update: 2026-06-06 13:41:28 UTC


README

What is it?

A little extension that allows a simple registry to be injected in to FeatureContexts, allowing steps to share data across contexts if necessary

Installation

The only documented way to install behat-registry is with composer

$ composer.phar require --dev davedevelopment/behat-registry:* 

Usage

Add the extension to your behat.yml file:

default:
 extensions:
 DaveDevelopment\BehatRegistry\Extension:

If you implement the DaveDevelopment\BehatRegistry\Context\Initializer\RegistryAwareInterface with your Context classes, they will have a Registry injected.

<?php 

use DaveDevelopment\BehatRegistry\Context\Initializer\RegistryAwareInterface;
use DaveDevelopment\BehatRegistry\Registry;

class FeatureContext implements RegistryAwareInterface
{
 public function setRegistry(Registry $registry)
 {
 $this->registry = $registry;
 }

If you want some items to persist between scenarios, call the persist method with the key.

<?php

 $this->registry->userId = 123;
 $this->registry->persist("userId");

Copyright

Copyright (c) 2012 Dave Marshall. See LICENCE for further details