self::USER_ADMIN, 'roles'=> [UserGroupPermissions::ROLE_SUPER_ADMIN]]); PxeTemplateFactory::createMany(10); $this->createClientWithCredentials()->request('GET', '/pxe-templates'); $this->assertResponseStatusCodeSame(Response::HTTP_OK); $this->assertResponseHeaderSame('content-type', 'application/ld+json; charset=utf-8'); $this->assertJsonContains([ '@context' => '/contexts/PxeTemplate', '@id' => '/pxe-templates', '@type' => 'hydra:Collection', 'hydra:totalItems' => 10, ]); } /* public function testCreatePxeTemplate(): void { UserFactory::createOne(['username' => self::USER_ADMIN, 'roles'=> [UserGroupPermissions::ROLE_SUPER_ADMIN]]); $this->createClientWithCredentials()->request('POST', '/pxe-templates',['json' => [ 'name' => self::PXE_TEMPLATE_CREATE, 'templateContent' => 'content' ]]); $this->assertResponseStatusCodeSame(201); $this->assertResponseHeaderSame('content-type', 'application/ld+json; charset=utf-8'); $this->assertJsonContains([ '@context' => '/contexts/PxeTemplateOutput', '@type' => 'PxeTemplate', 'name' => self::PXE_TEMPLATE_CREATE, 'templateContent' => 'content' ]); } */ /** * @throws RedirectionExceptionInterface * @throws DecodingExceptionInterface * @throws ClientExceptionInterface * @throws TransportExceptionInterface * @throws ServerExceptionInterface */ public function testUpdatePxeTemplate(): void { UserFactory::createOne(['username' => self::USER_ADMIN, 'roles'=> [UserGroupPermissions::ROLE_SUPER_ADMIN]]); PxeTemplateFactory::createOne(['name' => self::PXE_TEMPLATE_CREATE, 'templateContent' => 'content']); $iri = $this->findIriBy(PxeTemplate::class, ['name' => self::PXE_TEMPLATE_CREATE]); $this->createClientWithCredentials()->request('PUT', $iri, ['json' => [ 'name' => self::PXE_TEMPLATE_UPDATE, 'templateContent' => 'updated-content', ]]); $this->assertResponseIsSuccessful(); $this->assertJsonContains([ '@id' => $iri, 'name' => self::PXE_TEMPLATE_UPDATE, 'templateContent' => 'updated-content', ]); } /** * @throws TransportExceptionInterface * @throws ServerExceptionInterface * @throws RedirectionExceptionInterface * @throws DecodingExceptionInterface * @throws ClientExceptionInterface */ public function testDeletePxeTemplate(): void { UserFactory::createOne(['username' => self::USER_ADMIN, 'roles'=> [UserGroupPermissions::ROLE_SUPER_ADMIN]]); PxeTemplateFactory::createOne(['name' => self::PXE_TEMPLATE_DELETE, 'templateContent' => 'content']); $iri = $this->findIriBy(PxeTemplate::class, ['name' => self::PXE_TEMPLATE_DELETE]); $this->createClientWithCredentials()->request('DELETE', $iri); $this->assertResponseStatusCodeSame(204); $this->assertNull( static::getContainer()->get('doctrine')->getRepository(PxeTemplate::class)->findOneBy(['name' => self::PXE_TEMPLATE_DELETE]) ); } }