entityManager = static::getContainer()->get(EntityManagerInterface::class); } public function testGetCollection(): void { static::createClient()->request('GET', '/v4/projects'); $this->assertResponseIsSuccessful(); $this->assertJsonContains(['@id' => '/v4/projects']); $this->assertJsonContains(['@type' => 'Collection']); $this->assertJsonContains(['totalItems' => 0]); $this->assertJsonContains(['member' => []]); $owner = new User(); $owner->setHandle('test_user'); $owner->setEmail('testuser@example.com'); $owner->setPassword('projectapitestuserpassword'); $project = new Project(); $project->setTitle('Test Project'); $project->setSubtitle('Test Project Subtitle'); $project->setDeadline(ProjectDeadline::Minimum); $project->setCategory(Category::LibreSoftware); $project->setDescription('Test Project Description'); $project->setTerritory(new ProjectTerritory('ES')); $project->setOwner($owner); $project->setStatus(ProjectStatus::InEditing); $this->entityManager->persist($owner); $this->entityManager->persist($project); $this->entityManager->flush(); static::createClient()->request('GET', '/v4/projects'); $this->assertResponseIsSuccessful(); $this->assertJsonContains(['totalItems' => 1]); $this->assertJsonContains(['member' => [ [ 'title' => 'Test Project', 'status' => ProjectStatus::InEditing->value, 'rewards' => [], ], ]]); } }