2017 © Pedro Peláez
 

library doctrine-auto-fixtures

Automatic fixture for doctrine entities

image

alexmanno/doctrine-auto-fixtures

Automatic fixture for doctrine entities

  • Wednesday, May 2, 2018
  • by alexmanno
  • Repository
  • 1 Watchers
  • 2 Stars
  • 5 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

doctrine-auto-fixtures

Automatic fixture for doctrine entities, (*1)

Build Status Scrutinizer Coverage, (*2)

Installation

composer require alexmanno/doctrine-auto-fixtures

Usage

In your entity:, (*3)

Fixed value on field
class Entity {
    /**
     * @Fixture(value="Fixed value")
     */
    private $entityField;
}
Factory on field
class Entity {
    /**
     * @Fixture(factory="Acme\FactoryClass:factoryMethod")
     */
    private $entityField;
}
Faker on field
class Entity {
    /**
     * @Fixture(faker="address")
     */
    private $entityField;
}
class Entity {
    /**
     * @Fixture(class="Acme\AnotherEntity")
     */
    private $entityField;
}

Than in your tests:, (*4)

    // ----
    $engine = new AlexManno\Engine\FixtureEngine();
    $fixture = $engine->get(Acme\Entity::class); // <- this will return your fixture
    // ----

The Versions