2017 © Pedro Peláez
 

library factory-gas

Simple lib like a FactoryGirl for FuelPHP.

image

imasami/factory-gas

Simple lib like a FactoryGirl for FuelPHP.

  • Friday, August 4, 2017
  • by imasami
  • Repository
  • 1 Watchers
  • 0 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

factory-gas

Packagist, (*1)

composer

"require-dev": {
    "positrium/factory-gas": "dev-master"
},

setup

copy vendor/positrium/factory-gas/tests/factories/foo_factory.php.dist to below. _factory.php is suffix., (*2)

app
 `--- tests
       `--- factories
             `--- brabra_success_factory.php
             `--- brabra_fail_factory.php

define factories to brabra_success_factory.php, (*3)

<?php

use positrium\FactoryGas\FactoryGas;

// ---------------------------------------------------------------------------

FactoryGas::define('users', 'Controller_Users_Test_success', [
  'name' => 'Alan',
  'age' => 25
]);

define factories to brabra_fail_factory.php, (*4)

<?php

use positrium\FactoryGas\FactoryGas;

// ---------------------------------------------------------------------------

FactoryGas::define('users', 'Controller_Users_Test_fail', [
  'name' => 'Bob',
  'age' => 12
]);

use

build

build to memory., (*5)

<?php

use positrium\FactoryGas\FactoryGas;

class Controller_Users_Test extends \PHPUnit_Framework_TestCase
{
  protected function setUp()
  {
    $model = FactoryGas::build('Controller_Users_Test_success');
    print_r($model);
    // Array
    // (
    //  [name] => 'Alan'
    //  [age] => 25
    // )
  }

create

create record to database., (*6)

<?php

use positrium\FactoryGas\FactoryGas;

class Controller_Users_Test extends \PHPUnit_Framework_TestCase
{
  protected function setUp()
  {
    $model = FactoryGas::create('Controller_Users_Test_success');
    print($model['id']);
    // 11
    FactoryGas::create('Controller_Users_Test_fail');
  }

truncate

<?php

use positrium\FactoryGas\FactoryGas;

class Controller_Users_Test extends \PHPUnit_Framework_TestCase
{
  protected function tearDown()
  {
    FactoryGas::truncate('Controller_Users_Test_success');
  }

The Versions

04/08 2017

dev-master

9999999-dev

Simple lib like a FactoryGirl for FuelPHP.

  Sources   Download

MIT

The Requires

 

The Development Requires

by ito
by Avatar positrium

07/06 2017

2.1.0

2.1.0.0

Simple lib like a FactoryGirl for FuelPHP.

  Sources   Download

MIT

The Requires

 

The Development Requires

by ito

06/06 2017

2.0.0

2.0.0.0

Simple lib like a FactoryGirl for FuelPHP.

  Sources   Download

MIT

The Requires

 

The Development Requires

by ito

31/05 2017

1.1.0

1.1.0.0

Simple lib like a FactoryGirl for FuelPHP.

  Sources   Download

MIT

The Requires

 

by ito

26/05 2017

1.0.0

1.0.0.0

Simple lib like a FactoryGirl for FuelPHP.

  Sources   Download

MIT

The Requires

 

by ito