mirror of
https://gitlab.com/izyim/wetrack.git
synced 2026-08-19 04:23:57 +00:00
30 lines
735 B
PHP
30 lines
735 B
PHP
<?php
|
|
|
|
namespace Tests\Support;
|
|
|
|
use Illuminate\Foundation\Testing\WithFaker;
|
|
use Src\Services\Project\Application\Mappers\ProjectMapper;
|
|
use Src\Services\Project\Domain\Factories\ProjectFactory;
|
|
use Src\Services\Project\Domain\Models\Project;
|
|
|
|
trait WithProjects
|
|
{
|
|
use WithFaker;
|
|
|
|
public function newProject(): Project
|
|
{
|
|
$project = ProjectFactory::new();
|
|
$projectEloquentModel = ProjectMapper::toEloquent($project);
|
|
$projectEloquentModel->save();
|
|
return ProjectMapper::fromEloquent($projectEloquentModel);
|
|
}
|
|
|
|
public function createRandomProjects(int $projectsCount) : void
|
|
{
|
|
foreach (range(1, $projectsCount) as $_) {
|
|
$this->newProject();
|
|
}
|
|
}
|
|
|
|
}
|