alexmanno / doctrine-auto-fixtures
Automatic fixture for doctrine entities
1.0.2
2018-05-02 17:58 UTC
Requires
- php: ^7.1
- doctrine/annotations: ^1.6
- doctrine/orm: ^2.6
- fzaninotto/faker: ^1.7
- ocramius/proxy-manager: ^2.1
Requires (Dev)
- facile-it/facile-coding-standard: ^0.2.0
- phpstan/phpstan: ^0.9.2
- phpunit/phpunit: ^7.1
This package is auto-updated.
Last update: 2024-10-22 21:17:21 UTC
README
Automatic fixture for doctrine entities
Installation
composer require alexmanno/doctrine-auto-fixtures
Usage
In your entity:
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; }
Link another entity on field
class Entity { /** * @Fixture(class="Acme\AnotherEntity") */ private $entityField; }
Than in your tests:
// ---- $engine = new AlexManno\Engine\FixtureEngine(); $fixture = $engine->get(Acme\Entity::class); // <- this will return your fixture // ----