Goal-Calibration/tests/Unit/Plan/UseCases/CreatePlanTest.php

28 lines
682 B
PHP

<?php
namespace Tests\Unit\Plan\UseCases;
use App\Plan\UseCases\CreatePlan;
use App\Plan\UseCases\CreatePlanRequest;
use Tests\Fakes\FakePlanRepository;
use PHPUnit\Framework\TestCase;
class CreatePlanTest extends TestCase
{
private FakePlanRepository $planRepo;
private CreatePlan $useCase;
public function setUp(): void
{
$this->planRepo = new FakePlanRepository;
$this->useCase = new CreatePlan($this->planRepo);
}
public function test_create_plan(): void
{
$plan = $this->useCase->execute(new CreatePlanRequest(
name: 'testPlan',
));
$this->assertEquals('testPlan', $plan->getName());
}
}