createUser('sAdmin@test.com', ['ROLE_SUPER_ADMIN']); $this->client->loginUser($admin); $this->client->request('GET', '/'); self::assertResponseRedirects('/organization/'); $this->client->followRedirect(); } #[Test] public function test_index_successful_admin_single_org(): void { $admin = $this->createUser('admin@test.com', ['ROLE_ADMIN']); $this->client->loginUser($admin); $org = $this->createOrganization('Test Org'); $app = $this->createApp('Test App'); $app -> addOrganization($org); $uo = $this->createUOLink($admin, $org); $role = $this->createRole('ADMIN'); $uoa = $this->createUOALink($uo , $app, $role); $this->client->request('GET', '/'); self::assertResponseRedirects('/organization/'); $this->client->followRedirect(); self::assertResponseRedirects('/organization/view/' . $org->getId()); $this->client->followRedirect(); self::assertResponseIsSuccessful(); } #[Test] public function test_index_successful_admin_mutiple_org(): void { $admin = $this->createUser('admin@test.com', ['ROLE_ADMIN']); $this->client->loginUser($admin); $org = $this->createOrganization('Test Org'); $org2 = $this->createOrganization('Test Org2'); $app = $this->createApp('Test App'); $app -> addOrganization($org); $uo = $this->createUOLink($admin, $org); $uo2 = $this->createUOLink($admin, $org2); $role = $this->createRole('ADMIN'); $uoa = $this->createUOALink($uo , $app, $role); $uoa2 = $this->createUOALink($uo2 , $app, $role); $this->client->request('GET', '/'); self::assertResponseRedirects('/organization/'); $this->client->followRedirect(); self::assertResponseIsSuccessful(); } #[Test] public function test_index_successful_user(): void { $user = $this->createUser('user@test.com', ['ROLE_USER']); $this->client->loginUser($user); $org = $this->createOrganization('Test Org'); $app = $this->createApp('Test App'); $app -> addOrganization($org); $uo = $this->createUOLink($user, $org); $role = $this->createRole('USER'); $uoa = $this->createUOALink($uo , $app, $role); $this->client->request('GET', '/'); self::assertResponseRedirects('/application/'); $this->client->followRedirect(); self::assertResponseIsSuccessful(); } #[Test] public function test_index_unauthenticated(): void { $this->client->request('GET', '/'); self::assertResponseRedirects('/login'); } //endregion }