2017 © Pedro Peláez
 

library phactory-laravel

Use Phactory inside Laravel

image

talyssonoc/phactory-laravel

Use Phactory inside Laravel

  • Wednesday, June 10, 2015
  • by talyssonoc
  • Repository
  • 1 Watchers
  • 1 Stars
  • 5 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Phactory Laravel

With Phactory Laravel you'll be able to use Phactory with Laravel 5., (*1)

If you don't know what Phactory is:, (*2)

Phactory is an alternative to using database fixtures in your PHP unit tests. Instead of maintaining a separate XML file of data, you define a blueprint for each table and then create as many different objects as you need in your PHP code.

Phactory Laravel will access the database based on your Laravel config, simple as that., (*3)

Be aware that you must specify a testing database, otherwise Phactory Laravel will insert data in your development database., (*4)

Installation

First you need to add this to your composer.json requires:, (*5)

    "talyssonoc/phactory-laravel": "dev-master"

Then set the minimum-stability of your dependencies to dev, adding this to your composer.json:, (*6)

    "minimum-stability": "dev"

Then run:, (*7)

    $ composer install

After that you should add this to your service providers (at config/app.php):, (*8)

    'PhactoryLaravel\PhactoryServiceProvider'

And that to your aliases (at the same file):, (*9)

    'Phactory'  => 'PhactoryLaravel\\Phactory'

After that, Phactory facade will be available for you to use., (*10)

Creating a factory

Yours factories must be inside the folder app/Factories, and you should use the API provided by Phactory. The content of each file must be something like this:, (*11)

<?php

    Phactory::define('user', [
      'name' => 'UserName :D'
    ]);

Laravel 5.1

Note that is is not entirely necessary with Laravel 5.1, since it has model factories out-of-box, but you can still use Phactory Laravel with Laravel 5.1 if you prefer., (*12)

To do

  • [ ] Make configurable the Factories folder
  • [ ] Add support to Laravel MongoDB

The Versions

10/06 2015

dev-master

9999999-dev

Use Phactory inside Laravel

  Sources   Download

MIT

The Requires

 

by Avatar talyssonoc

laravel tests factory phactory

10/06 2015

v0.1

0.1.0.0

Use Phactory inside Laravel

  Sources   Download

MIT

The Requires

 

by Avatar talyssonoc

laravel tests factory phactory