self::USER_ADMIN, 'roles'=> [UserGroupPermissions::ROLE_SUPER_ADMIN]]); OrganizationalUnitFactory::createMany(2, ['type' => OrganizationalUnitTypes::ORGANIZATIONAL_UNIT]); OrganizationalUnitFactory::createMany(2, ['type' => OrganizationalUnitTypes::CLASSROOMS_GROUP]); OrganizationalUnitFactory::createMany(2, ['type' => OrganizationalUnitTypes::CLASSROOM]); OrganizationalUnitFactory::createMany(2, ['type' => OrganizationalUnitTypes::CLIENTS_GROUP]); $this->createClientWithCredentials()->request('GET', '/organizational-units'); $this->assertResponseStatusCodeSame(Response::HTTP_OK); $this->assertResponseHeaderSame('content-type', 'application/ld+json; charset=utf-8'); $this->assertJsonContains([ '@context' => '/contexts/OrganizationalUnit', '@id' => '/organizational-units', '@type' => 'hydra:Collection', 'hydra:totalItems' => 8, ]); } /** * @throws RedirectionExceptionInterface * @throws DecodingExceptionInterface * @throws ClientExceptionInterface * @throws TransportExceptionInterface * @throws ServerExceptionInterface */ public function testCreateOrganizationalUnitRoot(): void { UserFactory::createOne(['username' => self::USER_ADMIN, 'roles'=> [UserGroupPermissions::ROLE_SUPER_ADMIN]]); $this->createClientWithCredentials()->request('POST', '/organizational-units/root',['json' => [ 'name' => self::ORGANIZATIONAL_UNIT_CREATE, ]]); $this->assertResponseStatusCodeSame(201); $this->assertResponseHeaderSame('content-type', 'application/ld+json; charset=utf-8'); $this->assertJsonContains([ '@context' => '/contexts/OrganizationalUnitOutput', '@type' => 'OrganizationalUnit', 'name' => self::ORGANIZATIONAL_UNIT_CREATE, 'type' => OrganizationalUnitTypes::ORGANIZATIONAL_UNIT, ]); } /** * @throws RedirectionExceptionInterface * @throws DecodingExceptionInterface * @throws ClientExceptionInterface * @throws TransportExceptionInterface * @throws ServerExceptionInterface */ public function testCreateOrganizationalUnitClassroomGroup(): void { UserFactory::createOne(['username' => self::USER_ADMIN, 'roles'=> [UserGroupPermissions::ROLE_SUPER_ADMIN]]); $this->createClientWithCredentials()->request('POST', '/organizational-units/classroom-group',['json' => [ 'name' => self::ORGANIZATIONAL_UNIT_CREATE, ]]); $this->assertResponseStatusCodeSame(201); $this->assertResponseHeaderSame('content-type', 'application/ld+json; charset=utf-8'); $this->assertJsonContains([ '@context' => '/contexts/OrganizationalUnitOutput', '@type' => 'OrganizationalUnit', 'name' => self::ORGANIZATIONAL_UNIT_CREATE, 'type' => OrganizationalUnitTypes::CLASSROOMS_GROUP, ]); } /** * @throws RedirectionExceptionInterface * @throws DecodingExceptionInterface * @throws ClientExceptionInterface * @throws TransportExceptionInterface * @throws ServerExceptionInterface */ public function testCreateOrganizationalUnitClassroom(): void { UserFactory::createOne(['username' => self::USER_ADMIN, 'roles'=> [UserGroupPermissions::ROLE_SUPER_ADMIN]]); $this->createClientWithCredentials()->request('POST', '/organizational-units/classroom',['json' => [ 'name' => self::ORGANIZATIONAL_UNIT_CREATE, ]]); $this->assertResponseStatusCodeSame(201); $this->assertResponseHeaderSame('content-type', 'application/ld+json; charset=utf-8'); $this->assertJsonContains([ '@context' => '/contexts/OrganizationalUnitOutput', '@type' => 'OrganizationalUnit', 'name' => self::ORGANIZATIONAL_UNIT_CREATE, 'type' => OrganizationalUnitTypes::CLASSROOM, ]); } /** * @throws RedirectionExceptionInterface * @throws DecodingExceptionInterface * @throws ClientExceptionInterface * @throws TransportExceptionInterface * @throws ServerExceptionInterface */ public function testCreateOrganizationalUnitClientGroup(): void { UserFactory::createOne(['username' => self::USER_ADMIN, 'roles'=> [UserGroupPermissions::ROLE_SUPER_ADMIN]]); $this->createClientWithCredentials()->request('POST', '/organizational-units/client-group',['json' => [ 'name' => self::ORGANIZATIONAL_UNIT_CREATE, ]]); $this->assertResponseStatusCodeSame(201); $this->assertResponseHeaderSame('content-type', 'application/ld+json; charset=utf-8'); $this->assertJsonContains([ '@context' => '/contexts/OrganizationalUnitOutput', '@type' => 'OrganizationalUnit', 'name' => self::ORGANIZATIONAL_UNIT_CREATE, 'type' => OrganizationalUnitTypes::CLIENTS_GROUP, ]); } }