self::USER_ADMIN, 'roles'=> [UserGroupPermissions::ROLE_SUPER_ADMIN]]); $ou = OrganizationalUnitFactory::createOne(['type' => OrganizationalUnitTypes::ORGANIZATIONAL_UNIT]); $hp = HardwareProfileFactory::createOne(['description' => self::HW_PROFILE]); $client = ClientFactory::createOne(['name' => self::CLIENT_CREATE, 'serialNumber' => '123abc', 'organizationalUnit' => $ou, 'hardwareProfile' => $hp]); PartitionFactory::createMany(10, ['client' => $client]); $this->createClientWithCredentials()->request('GET', '/partitions'); $this->assertResponseStatusCodeSame(Response::HTTP_OK); $this->assertResponseHeaderSame('content-type', 'application/ld+json; charset=utf-8'); $this->assertJsonContains([ '@context' => '/contexts/Partition', '@id' => '/partitions', '@type' => 'hydra:Collection', 'hydra:totalItems' => 10, ]); } /** * @throws RedirectionExceptionInterface * @throws DecodingExceptionInterface * @throws ClientExceptionInterface * @throws TransportExceptionInterface * @throws ServerExceptionInterface */ public function testCreatePartition(): void { UserFactory::createOne(['username' => self::USER_ADMIN, 'roles'=> [UserGroupPermissions::ROLE_SUPER_ADMIN]]); $ou = OrganizationalUnitFactory::createOne(['type' => OrganizationalUnitTypes::ORGANIZATIONAL_UNIT]); $hp = HardwareProfileFactory::createOne(['description' => self::HW_PROFILE]); ClientFactory::createOne(['name' => self::CLIENT_CREATE, 'serialNumber' => '123abc', 'organizationalUnit' => $ou, 'hardwareProfile' => $hp]); $iri = $this->findIriBy(Client::class, ['name' => self::CLIENT_CREATE]); OperativeSystemFactory::createOne(['name' => 'Ubuntu']); $osIri = $this->findIriBy(OperativeSystem::class, ['name' => 'Ubuntu']); $this->createClientWithCredentials()->request('POST', '/partitions',['json' => [ 'size' => 100, 'operativeSystem' => $osIri, 'client' => $iri, 'memoryUsage' => 100 ]]); $this->assertResponseStatusCodeSame(201); $this->assertResponseHeaderSame('content-type', 'application/ld+json; charset=utf-8'); $this->assertJsonContains([ '@context' => '/contexts/PartitionOutput', '@type' => 'Partition', 'size' => 100, 'memoryUsage' => 100 ]); } }