PHPackages                             kix/behat-sf2-service-generator - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. kix/behat-sf2-service-generator

ActiveLibrary[Testing &amp; Quality](/categories/testing)

kix/behat-sf2-service-generator
===============================

Behat Symfony2 service generator

0.1.0(11y ago)121MITPHPPHP &gt;=5.4

Since Nov 20Pushed 11y agoCompare

[ Source](https://github.com/kix/behat-sf2-service-generator)[ Packagist](https://packagist.org/packages/kix/behat-sf2-service-generator)[ Docs](https://github.com/kix/BehatExceptionListener)[ RSS](/packages/kix-behat-sf2-service-generator/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (1)Versions (2)Used By (0)

Behat Symfony2 service generator
================================

[](#behat-symfony2-service-generator)

This is a [Behat](http://behat.org) extension that catches calls to undefined Symfony services and runs PHPSpec to describe them.

Installation
------------

[](#installation)

Just run this:

```
	composer require kix/behat-sf2-service-generator "~0.1"

```

And then enable the extension in your `behat.yml`:

```
default:
  # ...
  extensions:
    Kix\Symfony2ServiceExtension\Symfony2ServiceExtension: ~

```

Now, when you try to access a non-existent service, you'll be asked if you want to generate a class for it. A YAML config will be dumped on the console for your convinience, too. Here's a quick peek at what it looks like.

```
Feature: Generating Symfony services
  Scenario: Creating a service when a ServiceNotFoundException is caught
    When I run behat
    And my step tries to get a service that doesn't exist
    Then a shiny notification is displayed asking if I want to generate it

```

```
