self::USER_ADMIN, 'roles'=> [UserGroupPermissions::ROLE_SUPER_ADMIN]]); OgLiveFactory::createMany(10); $this->createClientWithCredentials()->request('GET', '/og-lives'); $this->assertResponseStatusCodeSame(Response::HTTP_OK); $this->assertResponseHeaderSame('content-type', 'application/ld+json; charset=utf-8'); $this->assertJsonContains([ '@context' => '/contexts/OgLive', '@id' => '/og-lives', '@type' => 'hydra:Collection', 'hydra:totalItems' => 10, ]); } /** * @throws RedirectionExceptionInterface * @throws DecodingExceptionInterface * @throws ClientExceptionInterface * @throws TransportExceptionInterface * @throws ServerExceptionInterface */ public function testCreateOgLive(): void { UserFactory::createOne(['username' => self::USER_ADMIN, 'roles'=> [UserGroupPermissions::ROLE_SUPER_ADMIN]]); $this->createClientWithCredentials()->request('POST', '/og-lives',['json' => [ 'filename' => self::OGLIVE_CREATE, 'downloadUrl' => self::OGLIVE_CREATE ]]); $this->assertResponseStatusCodeSame(201); $this->assertResponseHeaderSame('content-type', 'application/ld+json; charset=utf-8'); $this->assertJsonContains([ '@context' => '/contexts/OgLiveOutput', '@type' => 'OgLive', 'filename' => self::OGLIVE_CREATE, 'status' => OgLiveStatus::INACTIVE ]); } /** * @throws RedirectionExceptionInterface * @throws DecodingExceptionInterface * @throws ClientExceptionInterface * @throws TransportExceptionInterface * @throws ServerExceptionInterface */ public function testUpdateOgLive(): void { UserFactory::createOne(['username' => self::USER_ADMIN, 'roles'=> [UserGroupPermissions::ROLE_SUPER_ADMIN]]); OgLiveFactory::createOne(['filename' => self::OGLIVE_CREATE, 'downloadUrl' => self::OGLIVE_UPDATE]); $iri = $this->findIriBy(OgLive::class, ['filename' => self::OGLIVE_CREATE]); $this->createClientWithCredentials()->request('PUT', $iri, ['json' => [ 'filename' => self::OGLIVE_UPDATE, ]]); $this->assertResponseIsSuccessful(); $this->assertJsonContains([ '@id' => $iri, 'filename' => self::OGLIVE_UPDATE, ]); } /** * @throws TransportExceptionInterface * @throws ServerExceptionInterface * @throws RedirectionExceptionInterface * @throws DecodingExceptionInterface * @throws ClientExceptionInterface */ public function testDeleteOgLive(): void { UserFactory::createOne(['username' => self::USER_ADMIN, 'roles'=> [UserGroupPermissions::ROLE_SUPER_ADMIN]]); OgLiveFactory::createOne(['filename' => self::OGLIVE_CREATE, 'downloadUrl' => 'http://example.com']); $iri = $this->findIriBy(OgLive::class, ['filename' => self::OGLIVE_CREATE]); $this->createClientWithCredentials()->request('DELETE', $iri); $this->assertResponseStatusCodeSame(204); $this->assertNull( static::getContainer()->get('doctrine')->getRepository(OgLive::class)->findOneBy(['filename' => self::OGLIVE_CREATE]) ); } }