planRepo = new FakePlanRepository(); $this->userRepo = new FakeUserRepository(); $this->textRepo = new FakeTextRepository(); $this->nodeRepo = new FakeNodeRepository(); $this->scheduledNodeRepo = new FakeScheduledNodeRepository(); $this->userRepo->create(new CreateUserDto( email: new EmailAddress('test@test.com'), )); $text = $this->textRepo->create(new CreateTextDto('testname')); $this->nodeRepo->create(new CreateNodeDto( text: $text, title: 'Root Node', parentNode: null, )); $createScheduledNode = new CreateScheduledNode( scheduledNodeRepo: $this->scheduledNodeRepo, planRepo: $this->planRepo, ); $this->createPlan = new CreatePlan( $this->planRepo, $this->userRepo, $this->textRepo, $this->nodeRepo, $createScheduledNode, ); $this->controller = new PlanController(); } private function makeRequest(array $data): ServerRequestInterface { $body = new StreamFactory()->createStream(json_encode($data)); return new ServerRequestFactory() ->createServerRequest('POST', 'http://localhost/api/plans') ->withHeader('Content-Type', 'application/json') ->withBody($body); } }