loginAsUser($client); $client->request('POST', '/en/my-account/groups/'.TestReference::GROUP_5.'/join'); self::assertResponseIsUnprocessable(); } /** * Group not found. */ public function testJoinNotFoundException(): void { $client = self::createClient(); $this->loginAsUser($client); $client->request('POST', '/en/my-account/groups/'.TestReference::UUID_404.'/join'); self::assertResponseStatusCodeSame(Response::HTTP_NOT_FOUND); } /** * Nominal case: join a public group with free access. */ public function testJoinSuccess(): void { $client = self::createClient(); $this->loginAsAdmin($client); $crawler = $client->request('GET', self::ROUTE_SHOW_FREE); self::assertResponseIsSuccessful(); $form = $crawler->selectButton('templates.pages.group.show.group_join.form.submit')->form(); $client->submit($form); self::assertResponseRedirects(); $client->followRedirect(); self::assertResponseIsSuccessful(); self::assertRouteSame('app_group_show'); } /** * Test list of user groups. */ public function testList(): void { $client = self::createClient(); $this->loginAsSarah($client); $client->request('GET', self::ROUTE_USER_LIST); self::assertResponseIsSuccessful(); self::assertSame(1, $client->getCrawler()->filter('.invitation-test')->count()); self::assertSame(3, $client->getCrawler()->filter('.group-test')->count()); } }