PHPackages                             benblub/ftg - 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. benblub/ftg

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

benblub/ftg
===========

A Functional Test Generator for Api Platform

v1.0.1-beta(5y ago)0388MITPHPPHP &gt;=7.4

Since Apr 28Pushed 5y ago1 watchersCompare

[ Source](https://github.com/benblub/ftg)[ Packagist](https://packagist.org/packages/benblub/ftg)[ RSS](/packages/benblub-ftg/feed)WikiDiscussions main Synced 3w ago

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

ftg
===

[](#ftg)

A Functional Test Generator.

### Requires

[](#requires)

-

### Install

[](#install)

`composer require benblub/ftg "dev-main"`

### Config Api Platform / Symfony / Foundry

[](#config-api-platform--symfony--foundry)

There is no autoconfig yet..

add to `config/bundles.php`

```
Benblub\Ftg\BenblubFtgBundle::class => ['dev' => true],

```

add to `services.yaml`

```
    Benblub\Ftg\Bundle\Maker\MakeFunctionalTest:
        tags: ['maker.command']

```

Foundry
-------

[](#foundry)

This Generator make use of Foundry Factories. For every Testclass we generate we need to have a Factory too. Create your Factory `php bin/console make:factory User --test` and set defaults. The defaults are at least all required fields from your Entity.

Add Method myDefaults to your Factories

```
    public static function myDefaults(): array
    {
        $class = new self();

        return $class->getDefaults();
    }
```

Extends ApiTestCase / implement AuthHelperInterface
---------------------------------------------------

[](#extends-apitestcase--implement-authhelperinterface)

Your Test classes extend any class which extends ApiTestCase from ApiPlatform. To use Auth you need to implement the AuthHelperInterface like shown in the examble. also needs config set "custom\_auth: true" (config is not implemented yet)

else you can use the defaults from AuthHelper (use id as identifier)

```
