refactor to set up method
This commit is contained in:
parent
9f29b9b94e
commit
66c49e07dd
1 changed files with 10 additions and 3 deletions
|
|
@ -9,11 +9,18 @@ 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
|
||||
{
|
||||
$planRepo = new FakePlanRepository;
|
||||
$useCase = new CreatePlan($planRepo);
|
||||
$plan = $useCase->execute(new CreatePlanRequest(
|
||||
$plan = $this->useCase->execute(new CreatePlanRequest(
|
||||
name: 'testPlan',
|
||||
));
|
||||
$this->assertEquals('testPlan', $plan->getName());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue