PHPackages                             tps/util-bundle - 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. tps/util-bundle

ActiveSymfony-bundle[Testing &amp; Quality](/categories/testing)

tps/util-bundle
===============

generate phpunit-templates for services, including mocked dependencies

136.7k1PHP

Since Mar 19Pushed 8y ago1 watchersCompare

[ Source](https://github.com/leberknecht/util-bundle)[ Packagist](https://packagist.org/packages/tps/util-bundle)[ RSS](/packages/tps-util-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)DependenciesVersions (1)Used By (0)

[![Build Status](https://camo.githubusercontent.com/85aa51ee56d05d87c3ec9b4cc37833566ec2602bbb63facdd5937c9fdd945bf7/68747470733a2f2f6170692e7472617669732d63692e6f72672f6c656265726b6e656368742f7574696c2d62756e646c652e706e67)](https://travis-ci.org/leberknecht/util-bundle)[![Coverage Status](https://camo.githubusercontent.com/bba4086e09f6bf9f8d85c772c9bdd4fc4923efc915fca9803eb916acc661bbdd/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6c656265726b6e656368742f7574696c2d62756e646c652f62616467652e706e67)](https://coveralls.io/r/leberknecht/util-bundle)

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

[](#installation)

Require the bundle via composer:

```
composer require "tps/util-bundle":"dev-master"
```

Or add to composer.json:

```
"require": {
    [...]
    "tps/util-bundle": "dev-master"
},

```

Activate in AppKernel.php:

```
$bundles = [
    [...]
    new Tps\UtilBundle\TpsUtilBundle()
]
```

Generate unit-tests from service classes
----------------------------------------

[](#generate-unit-tests-from-service-classes)

From time to time it happens that a dev is confronted with a brownfield service that has no unit-test, and wants to fix that. If the service has a lot of dependencies in the constructor, preparing the mocks for that can be really annoying (yes, the clean solution is to split the service to smaller parts with nice and easy-to-mock constructor). Anyways, if you are in a situation where you want to add a proper test for a monster-service, this tool can be ver handy.

Lets say you have a simple service like this:

```
