Home

Awesome

AliceGenerator Build Status

Recursively convert existing objects into Alice Fixtures.

Introduction

Sometimes you find yourself working on a large project with no existing fixtures. In this case even though Alice makes fixtures much easier to write, that process can still be tedious.

This library proposes an alternate starting point - automatically generate fixtures from your existing data.

This opens up a whole new, much faster way to get your test data established... just enter it in your user interface!

Example

Let's say you have the following objects

<?php
class Post {
    public $title;
    public $body;
    public $postedBy;
}

class User {
    public $username;
}

$user = new User();
$user->username = 'Trappar';

$post1 = new Post();
$post1->title = 'Is Making Fixtures Too Time Consuming?';
$post1->body = 'Check out Alice!';
$post1->postedBy = $user;

$post2 = new Post();
$post2->title = 'Too Much Data to Hand Write?';
$post2->body = 'Check out AliceGenerator!';
$post2->postedBy = $user;

This library let's you turn that directly into...

Post:
    Post-1:
        title: 'Is Making Fixtures Too Time Consuming?'
        body: 'Check out Alice!'
        postedBy: '@User-1'
    Post-2:
        title: 'Too Much Data to Hand Write?'
        body: 'Check out AliceGenerator!'
        postedBy: '@User-1'
User:
    User-1:
        username: Jeff

Installation

You can use Composer to install the library to your project:

composer require trappar/alice-generator

Features

Table of Contents

Resources

Credits

This bundle was developed by Jeff Way with quite a lot of inspiration from:

Other contributors.

License

license