feat(db): add entities
This commit is contained in:
27
tests/Common/FakerTrait.php
Normal file
27
tests/Common/FakerTrait.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Tests\Common;
|
||||
|
||||
use Faker\Factory;
|
||||
use Faker\Generator;
|
||||
|
||||
trait FakerTrait
|
||||
{
|
||||
private ?Generator $faker;
|
||||
|
||||
protected function bootFaker(): void
|
||||
{
|
||||
$this->faker = Factory::create();
|
||||
}
|
||||
|
||||
protected function getFaker(): Generator
|
||||
{
|
||||
if ($this->faker === null) {
|
||||
throw new \LogicException('Faker has not been booted yet.');
|
||||
}
|
||||
|
||||
return $this->faker;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user