PHPackages                             funk-spec/symfony-extension - 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. funk-spec/symfony-extension

ActiveTestwork-extension

funk-spec/symfony-extension
===========================

extension that helps using your symfony application's services in your tests

0.1.2(7y ago)122.6kMITPHPPHP &gt;=5.4

Since Sep 29Pushed 7y ago1 watchersCompare

[ Source](https://github.com/funk-spec/symfony-extension)[ Packagist](https://packagist.org/packages/funk-spec/symfony-extension)[ RSS](/packages/funk-spec-symfony-extension/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (3)Versions (4)Used By (0)

funk-spec/symfony-extension
===========================

[](#funk-specsymfony-extension)

```
 composer require --dev funk-spec/symfony-extension

```

What ?
------

[](#what-)

A [funk-spec](https://github.com/funk-spec/funk-spec) extension that integrates your symfony application with your specs.

It will:

- resolve constructor arguments typehinted with `ContainerInterface`
- wrap each example with a doctrine transaction and rollback afterwards

Why ?
-----

[](#why-)

For the same exact reason than the [behat's one](https://github.com/Behat/Symfony2Extension/) exists.
Both are relying on the TestWork framework.
Unfortunately, a lot of duplication exists between both, but no real tentative has been done yet to abstract away the few differences.

How ?
-----

[](#how-)

In your funk.yml:

```
default:
    autoload:
        tests: '%paths.base%'

    suites:
        default: ~

    extensions:
        FunkSpec\Extension\Symfony\Extension:
            kernel:
                class: App\Symfony\Kernel # or AppKernel (must be autoloadable)
                env: test
```

Now your spec classes can have the container injected:

```
