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
|
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
|
public function test_create_plan(): void
|
||||||
{
|
{
|
||||||
$planRepo = new FakePlanRepository;
|
$plan = $this->useCase->execute(new CreatePlanRequest(
|
||||||
$useCase = new CreatePlan($planRepo);
|
|
||||||
$plan = $useCase->execute(new CreatePlanRequest(
|
|
||||||
name: 'testPlan',
|
name: 'testPlan',
|
||||||
));
|
));
|
||||||
$this->assertEquals('testPlan', $plan->getName());
|
$this->assertEquals('testPlan', $plan->getName());
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue