GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - trappar/AliceGenerator: Recursively convert existing objects into Alice fixtures

BranchesTags
Open more actions menu

Latest commit

 

History

72 Commits
72 Commits

Folders and files

NameName
Last commit message
Last commit date
doc
doc
 
 
src/Trappar/AliceGenerator
src/Trappar/AliceGenerator
 
 
tests
tests
 
 
.gitignore
.gitignore
 
 
.travis.yml
.travis.yml
 
 
CHANGELOG.md
CHANGELOG.md
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
composer.json
composer.json
 
 
phpunit.xml.dist
phpunit.xml.dist
 
 

Repository files navigation

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

  • Framework support
    • Supports Symfony via AliceGeneratorBundle - Start generating fixtures immediately with zero custom code required!
  • ORM support
    • Supports Doctrine natively
    • Can operate without any ORM
    • Can be extended to support any ORM
  • Many ways to make use of Faker providers
  • Configure how your objects are serialized using annotations or YAML metadata
  • Can serialize any object type using custom ObjectHandlers
  • Supports multiple levels of recursion taming
    • Handles circular references automatically
    • Customizable maximum recursion depth
    • Can restrict object traversal to only specific objects of a type
  • Supports several methods of naming Alice references natively - fully customizable

Table of Contents

  • Usage
    • Basic usage
    • Fixture Generation Contexts
      • Limiting Recursion
        • Limiting Recursion Depth
        • Limiting Recursion With Object Constraints
      • Customizing Reference Naming Strategy
      • Force Inclusion of Properties at Default Values
  • Property Metadata
    • Data
    • Ignore
    • Faker
    • Built-in Faker Resolver Types
      • array
      • value-as-arg
      • callback
  • Custom Object Handlers
  • Configuration
    • Constructing a FixtureGenerator
    • Using with Doctrine
    • Property Namer Strategy
    • Adding Custom Object Handlers
    • Configuring Metadata Locations
    • Disabling Strict Type Checking

Resources

  • Changelog

Credits

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

  • nelmio/alice
  • schmittjoh/serializer

Other contributors.

License

license

About

Recursively convert existing objects into Alice fixtures

Resources

Readme
MIT license
Activity

Stars

52 stars

Watchers

2 watching

Forks

20 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.