2017 © Pedro Peláez
 

library laravel-fixture

Lightweight fixtures for Laravel 4

image

foothing/laravel-fixture

Lightweight fixtures for Laravel 4

  • Monday, February 16, 2015
  • by brazorf
  • Repository
  • 1 Watchers
  • 1 Stars
  • 12 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Laravel Fixture

Basic light-weight fixtures management for Laravel 4., (*1)

How to use

Setup the tearDown() in your test cases, (*2)

public function tearDown() {
    // Your code
    // ...
    Fixture::tearDown();
}

Usage of Fixture::need()

class FooTest {
    public function testBar() {
        // Create your fixture by passing the namespaced class name
        // you want to fixture and an array of attributes.
        // If an User instance matching the given attributes is found,
        // then it will be returned. Otherwise a new User instance will be
        // saved to the testing database.
        // Note that User must be an Eloquent implementation.
        $user = Fixture::need('User', array('email' => 'email1'));

        // Example, $user now exists with the given attributes.
        $this->assertEquals($user->email, 'email1');

        // ...
        // more tests.
    }
}

You'll want to use the need method when your test requires a given instance., (*3)

Usage of Fixture::needNot()

class FooTest {
    public function testBar() {
        // Ensure that no instances of Some\Object matching the given
        // attributes are stored in the testing database.
        Fixture::needNot('Some\Object', array('attribute' => 'value'));
    }
}

You'll use this when your test requires that your database is clean before running., (*4)

This may save you some time since you can have a fine data setup instead of running migrations that slower down test execution time., (*5)

Note that Fixture is not a Facade, so you don't need to configure any service provider., (*6)

The Versions

16/02 2015

dev-master

9999999-dev

Lightweight fixtures for Laravel 4

  Sources   Download

The Requires

 

by Fabrizio Ranieri

16/02 2015

v0.1.0

0.1.0.0

Lightweight fixtures for Laravel 4

  Sources   Download

The Requires

 

by Fabrizio Ranieri

16/02 2015

dev-develop

dev-develop

Lightweight fixtures for Laravel 4

  Sources   Download

The Requires

 

by Fabrizio Ranieri