refs #451. Testing Operative System
parent
f186e9d481
commit
1bd85c848e
|
@ -130,6 +130,6 @@ Una vez tengamos la base de datos cargada, podremos ejecutar las migraciones de
|
|||
--- Migraciones de OpenGnsys. ---
|
||||
docker exec ogcore-php php bin/console opengnsys:migration:organizational-unit #cargamos las unidades organizativas
|
||||
docker exec ogcore-php php bin/console opengnsys:migrate-hardware-profiles #cargamos los perfiles de hardware
|
||||
docker exec ogcore-php php bin/console pengnsys:migration:clients #cargamos los clientes
|
||||
docker exec ogcore-php php bin/console opengnsys:migration:clients #cargamos los clientes
|
||||
```
|
||||
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20240619104206 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE `partition` ADD operative_system_id INT DEFAULT NULL, DROP os_name');
|
||||
$this->addSql('ALTER TABLE `partition` ADD CONSTRAINT FK_9EB910E4F1E9F66E FOREIGN KEY (operative_system_id) REFERENCES operative_system (id)');
|
||||
$this->addSql('CREATE INDEX IDX_9EB910E4F1E9F66E ON `partition` (operative_system_id)');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE `partition` DROP FOREIGN KEY FK_9EB910E4F1E9F66E');
|
||||
$this->addSql('DROP INDEX IDX_9EB910E4F1E9F66E ON `partition`');
|
||||
$this->addSql('ALTER TABLE `partition` ADD os_name VARCHAR(255) NOT NULL, DROP operative_system_id');
|
||||
}
|
||||
}
|
|
@ -2,7 +2,9 @@
|
|||
|
||||
namespace App\Command\Migration;
|
||||
|
||||
use App\Entity\Hardware;
|
||||
use App\Entity\HardwareProfile;
|
||||
use App\Entity\HardwareType;
|
||||
use App\Entity\OrganizationalUnit;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\Query\ResultSetMapping;
|
||||
|
@ -31,8 +33,68 @@ class MigrateHardwareAndHardwareProfileCommand extends Command
|
|||
|
||||
$organizationalUnitRepository = $this->entityManager->getRepository(OrganizationalUnit::class);
|
||||
$hardwareProfileRepository = $this->entityManager->getRepository(HardwareProfile::class);
|
||||
$hardwareTypeRepository = $this->entityManager->getRepository(HardwareType::class);
|
||||
$hardwareRepository = $this->entityManager->getRepository(Hardware::class);
|
||||
|
||||
/** Obtener los centros de la base de datos antigua **/
|
||||
/** Obtener los perfiles hardware de la base de datos antigua **/
|
||||
$rsmHardwareTypes = new ResultSetMapping();
|
||||
$rsmHardwareTypes->addScalarResult('idtipohardware', 'idtipohardware');
|
||||
$rsmHardwareTypes->addScalarResult('descripcion', 'descripcion');
|
||||
|
||||
$hardwareTypesQuery = $oldDatabaseEntityManager->createNativeQuery('SELECT idtipohardware, descripcion FROM tipohardwares', $rsmHardwareTypes);
|
||||
$hardwareTypes = $hardwareTypesQuery->getResult();
|
||||
|
||||
$output->writeln("TIPOS HARDWARE TOTAL: ". count($hardwareTypes));
|
||||
foreach ($hardwareTypes as $hardwareType){
|
||||
$hardwareProfileEntity = null;
|
||||
$hardwareProfileEntity = $hardwareTypeRepository->findOneBy(['migrationId' => $hardwareType['idtipohardware']]);
|
||||
if(!$hardwareProfileEntity){
|
||||
$hardwareProfileEntity = new HardwareType();
|
||||
$hardwareProfileEntity->setMigrationId($hardwareType['idtipohardware']);
|
||||
$hardwareProfileEntity->setName($hardwareType['descripcion']);
|
||||
}
|
||||
|
||||
$this->entityManager->persist($hardwareProfileEntity);
|
||||
}
|
||||
|
||||
/** Obtener los hardware de la base de datos antigua **/
|
||||
$rsmHardware = new ResultSetMapping();
|
||||
$rsmHardware->addScalarResult('idhardware', 'idhardware');
|
||||
$rsmHardware->addScalarResult('idtipohardware', 'hardwares.idtipohardware');
|
||||
$rsmHardware->addScalarResult('descripcion', 'descripcion');
|
||||
$rsmHardware->addScalarResult('grupoid', 'hardwares.grupoid');
|
||||
$rsmHardware->addScalarResult('idcentro', 'hardwares.idcentro');
|
||||
|
||||
$hardwareQuery = $oldDatabaseEntityManager->createNativeQuery('SELECT idhardware, hardwares.idtipohardware, hardwares.descripcion, hardwares.grupoid, hardwares.idcentro FROM hardwares LEFT JOIN tipohardwares ON hardwares.idtipohardware = tipohardwares.idtipohardware', $rsmHardware);
|
||||
$hardwareCollection = $hardwareQuery->getResult();
|
||||
|
||||
$output->writeln("HARDWARE TOTAL: ". count($hardwareCollection));
|
||||
foreach ($hardwareCollection as $hardware){
|
||||
$hardwareEntity = null;
|
||||
$hardwareEntity = $hardwareRepository->findOneBy(['migrationId' => $hardware['idhardware']]);
|
||||
if(!$hardwareEntity){
|
||||
$hardwareEntity = new Hardware();
|
||||
$hardwareEntity->setMigrationId($hardware['idhardware']);
|
||||
$hardwareEntity->setDescription($hardware['descripcion']);
|
||||
$hardwareEntity->setName($hardware['descripcion']);
|
||||
}
|
||||
|
||||
$hardwareType = $hardwareTypeRepository->findOneBy(['migrationId' => $hardware['hardwares.idtipohardware']]);
|
||||
if ($hardwareType){
|
||||
$hardwareEntity->setType($hardwareType);
|
||||
}
|
||||
|
||||
$migrationId = $hardware['hardwares.grupoid'] === 0 ? $hardware['hardwares.idcentro'] : $hardware['hardwares.grupoid'];
|
||||
$organizationalUnit = $organizationalUnitRepository->findOneBy(['migrationId' => $migrationId]);
|
||||
|
||||
if ($organizationalUnit){
|
||||
$hardwareEntity->setOrganizationalUnit($organizationalUnit);
|
||||
}
|
||||
|
||||
$this->entityManager->persist($hardwareEntity);
|
||||
}
|
||||
|
||||
/** Obtener los perfiles hardware de la base de datos antigua **/
|
||||
$rsmHardwareProfiles = new ResultSetMapping();
|
||||
$rsmHardwareProfiles->addScalarResult('idperfilhard', 'idperfilhard');
|
||||
$rsmHardwareProfiles->addScalarResult('descripcion', 'descripcion');
|
||||
|
@ -64,6 +126,27 @@ class MigrateHardwareAndHardwareProfileCommand extends Command
|
|||
|
||||
$this->entityManager->persist($hardwareProfileEntity);
|
||||
}
|
||||
|
||||
/** Obtener los hardware, y asignarselos a los perfiles hardware **/
|
||||
$rsmHardwareProfilesRelation = new ResultSetMapping();
|
||||
$rsmHardwareProfilesRelation->addScalarResult('idperfilhard', 'idperfilhard');
|
||||
$rsmHardwareProfilesRelation->addScalarResult('idhardware', 'idhardware');
|
||||
|
||||
$hardwareProfilesQuery = $oldDatabaseEntityManager->createNativeQuery('SELECT idperfilhard, idhardware FROM perfileshard_hardwares', $rsmHardwareProfilesRelation);
|
||||
$hardwareProfileRelations = $hardwareProfilesQuery->getResult();
|
||||
|
||||
$output->writeln("PERFILES HARDWARE RELACIONES TOTAL: ". count($hardwareProfileRelations));
|
||||
foreach ($hardwareProfileRelations as $hardwareProfileRelation){
|
||||
$hardwareProfileEntity = $hardwareProfileRepository->findOneBy(['migrationId' => $hardwareProfileRelation['idperfilhard']]);
|
||||
$hardwareEntity = $hardwareRepository->findOneBy(['migrationId' => $hardwareProfileRelation['idhardware']]);
|
||||
|
||||
if ($hardwareProfileEntity && $hardwareEntity){
|
||||
$hardwareProfileEntity->addHardwareCollection($hardwareEntity);
|
||||
}
|
||||
$this->entityManager->persist($hardwareProfileEntity);
|
||||
}
|
||||
|
||||
|
||||
$this->entityManager->flush();
|
||||
|
||||
return Command::SUCCESS;
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
<?php
|
||||
|
||||
namespace App\Command\Migration;
|
||||
|
||||
use App\Entity\Client;
|
||||
use App\Entity\HardwareProfile;
|
||||
use App\Entity\OperativeSystem;
|
||||
use App\Entity\OrganizationalUnit;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\Query\ResultSetMapping;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use Symfony\Component\Console\Attribute\AsCommand;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
#[AsCommand(name: 'opengnsys:migration:os', description: 'Migrate os data')]
|
||||
class MigrateOperativeSystemCommand extends Command
|
||||
{
|
||||
public function __construct(
|
||||
private readonly EntityManagerInterface $entityManager,
|
||||
private readonly ManagerRegistry $doctrine
|
||||
)
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
/** @var EntityManagerInterface $oldDatabaseEntityManager */
|
||||
$oldDatabaseEntityManager = $this->doctrine->getManager('og_1');
|
||||
|
||||
$osRepository = $this->entityManager->getRepository(OperativeSystem::class);
|
||||
|
||||
/** Obtener los sistemas operativos de la base de datos antigua **/
|
||||
$rsmOperativeSystems = new ResultSetMapping();
|
||||
$rsmOperativeSystems->addScalarResult('idnombreso', 'idnombreso');
|
||||
$rsmOperativeSystems->addScalarResult('nombreso', 'nombreso');
|
||||
|
||||
$operativeSystemQuery = $oldDatabaseEntityManager->createNativeQuery('SELECT idnombreso, nombreso FROM nombresos', $rsmOperativeSystems);
|
||||
$opeativeSystems = $operativeSystemQuery->getResult();
|
||||
|
||||
/** Sistemas operativos **/
|
||||
$output->writeln("SISTEMAS OPERATIVOS TOTAL: ". count($opeativeSystems));
|
||||
foreach ($opeativeSystems as $client){
|
||||
$osEntity = $osRepository->findOneBy(['migrationId' => $client['idnombreso']]);
|
||||
if(!$osEntity) {
|
||||
$osEntity = new OperativeSystem();
|
||||
$osEntity->setMigrationId($client['idnombreso']);
|
||||
$osEntity->setName($client['nombreso']);
|
||||
}
|
||||
|
||||
$this->entityManager->persist($osEntity);
|
||||
}
|
||||
$this->entityManager->flush();
|
||||
|
||||
return Command::SUCCESS;
|
||||
}
|
||||
}
|
|
@ -4,6 +4,7 @@ namespace App\Dto\Input;
|
|||
|
||||
use ApiPlatform\Metadata\ApiProperty;
|
||||
use App\Dto\Output\ClientOutput;
|
||||
use App\Dto\Output\OperativeSystemOutput;
|
||||
use App\Dto\Output\OrganizationalUnitOutput;
|
||||
use App\Entity\HardwareProfile;
|
||||
use App\Entity\Menu;
|
||||
|
@ -41,7 +42,7 @@ final class PartitionInput
|
|||
#[Assert\NotNull()]
|
||||
#[Groups(['partition:write'])]
|
||||
#[ApiProperty(description: 'The operative system name of the partition', example: "Ubuntu")]
|
||||
public ?string $osName = null;
|
||||
public ?OperativeSystemOutput $operativeSystem = null;
|
||||
|
||||
#[Assert\NotNull()]
|
||||
#[Groups(['partition:write'])]
|
||||
|
@ -65,7 +66,7 @@ final class PartitionInput
|
|||
$this->size = $partition->getSize();
|
||||
$this->cacheContent = $partition->getCacheContent();
|
||||
$this->filesystem = $partition->getFilesystem();
|
||||
$this->osName = $partition->getOsName();
|
||||
$this->operativeSystem = new OperativeSystemOutput($partition->getOperativeSystem());
|
||||
$this->client = new ClientOutput($partition->getClient());
|
||||
$this->memoryUsage = $partition->getMemoryUsage();
|
||||
}
|
||||
|
@ -82,7 +83,7 @@ final class PartitionInput
|
|||
$partition->setSize($this->size * 100);
|
||||
$partition->setCacheContent($this->cacheContent);
|
||||
$partition->setFilesystem($this->filesystem);
|
||||
$partition->setOsName($this->osName);
|
||||
$partition->setOperativeSystem($this->operativeSystem->getEntity());
|
||||
$partition->setClient($this->client->getEntity());
|
||||
$partition->setMemoryUsage($this->memoryUsage * 100);
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace App\Dto\Output;
|
||||
|
||||
use ApiPlatform\Metadata\ApiProperty;
|
||||
use ApiPlatform\Metadata\Get;
|
||||
use App\Entity\Hardware;
|
||||
use Symfony\Component\Serializer\Annotation\Groups;
|
||||
|
@ -16,13 +17,14 @@ final class HardwareOutput extends AbstractOutput
|
|||
public ?string $description = '';
|
||||
|
||||
#[Groups(['hardware:read'])]
|
||||
#[ApiProperty(readableLink: true)]
|
||||
public ?HardwareTypeOutput $type = null;
|
||||
|
||||
#[Groups(['hardware:read'])]
|
||||
public \DateTime $createAt;
|
||||
public \DateTime $createdAt;
|
||||
|
||||
#[Groups(['hardware:read'])]
|
||||
public ?string $createBy = null;
|
||||
public ?string $createdBy = null;
|
||||
|
||||
public function __construct(Hardware $hardware)
|
||||
{
|
||||
|
@ -31,7 +33,7 @@ final class HardwareOutput extends AbstractOutput
|
|||
$this->name = $hardware->getName();
|
||||
$this->description = $hardware->getDescription();
|
||||
$this->type = new HardwareTypeOutput($hardware->getType());
|
||||
$this->createAt = $hardware->getCreatedAt();
|
||||
$this->createBy = $hardware->getCreatedBy();
|
||||
$this->createdAt = $hardware->getCreatedAt();
|
||||
$this->createdBy = $hardware->getCreatedBy();
|
||||
}
|
||||
}
|
|
@ -2,7 +2,9 @@
|
|||
|
||||
namespace App\Dto\Output;
|
||||
|
||||
use ApiPlatform\Metadata\ApiProperty;
|
||||
use ApiPlatform\Metadata\Get;
|
||||
use App\Entity\Hardware;
|
||||
use App\Entity\HardwareProfile;
|
||||
use Symfony\Component\Serializer\Annotation\Groups;
|
||||
|
||||
|
@ -18,6 +20,9 @@ final class HardwareProfileOutput extends AbstractOutput
|
|||
#[Groups(['hardware-profile:read'])]
|
||||
public ?OrganizationalUnitOutput $organizationalUnit = null;
|
||||
|
||||
#[Groups(['hardware-profile:read'])]
|
||||
public ?array $hardwareCollection = [];
|
||||
|
||||
#[Groups(['hardware-profile:read'])]
|
||||
public \DateTime $createdAt;
|
||||
|
||||
|
@ -33,6 +38,11 @@ final class HardwareProfileOutput extends AbstractOutput
|
|||
if($hardwareProfile->getOrganizationalUnit()) {
|
||||
$this->organizationalUnit = new OrganizationalUnitOutput($hardwareProfile->getOrganizationalUnit());
|
||||
}
|
||||
|
||||
$this->hardwareCollection = $hardwareProfile->getHardwareCollection()->map(
|
||||
fn(Hardware $hardware) => new HardwareOutput($hardware)
|
||||
)->toArray();
|
||||
|
||||
$this->createdAt = $hardwareProfile->getCreatedAt();
|
||||
$this->createdBy = $hardwareProfile->getCreatedBy();
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ class PartitionOutput extends AbstractOutput
|
|||
public ?string $filesystem = null;
|
||||
|
||||
#[Groups(['partition:read', 'client:read'])]
|
||||
public ?string $osName = null;
|
||||
public ?OperativeSystemOutput $operativeSystem = null;
|
||||
|
||||
#[Groups(['partition:read'])]
|
||||
public ?int $memoryUsage = null;
|
||||
|
@ -43,7 +43,9 @@ class PartitionOutput extends AbstractOutput
|
|||
$this->size = $partition->getSize() / 100;
|
||||
$this->cacheContent = $partition->getCacheContent();
|
||||
$this->filesystem = $partition->getFilesystem();
|
||||
$this->osName = $partition->getOsName();
|
||||
if ($partition->getOperativeSystem()) {
|
||||
$this->operativeSystem = new OperativeSystemOutput($partition->getOperativeSystem());
|
||||
}
|
||||
$this->memoryUsage = $partition->getMemoryUsage() / 100;
|
||||
}
|
||||
}
|
|
@ -3,10 +3,54 @@
|
|||
namespace App\Entity;
|
||||
|
||||
use App\Repository\OperativeSystemRepository;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: OperativeSystemRepository::class)]
|
||||
class OperativeSystem extends AbstractEntity
|
||||
{
|
||||
use NameableTrait;
|
||||
|
||||
/**
|
||||
* @var Collection<int, Partition>
|
||||
*/
|
||||
#[ORM\OneToMany(mappedBy: 'operativeSystem', targetEntity: Partition::class)]
|
||||
private Collection $partitions;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->partitions = new ArrayCollection();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, Partition>
|
||||
*/
|
||||
public function getPartitions(): Collection
|
||||
{
|
||||
return $this->partitions;
|
||||
}
|
||||
|
||||
public function addPartition(Partition $partition): static
|
||||
{
|
||||
if (!$this->partitions->contains($partition)) {
|
||||
$this->partitions->add($partition);
|
||||
$partition->setOperativeSystem($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removePartition(Partition $partition): static
|
||||
{
|
||||
if ($this->partitions->removeElement($partition)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($partition->getOperativeSystem() === $this) {
|
||||
$partition->setOperativeSystem(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,15 +27,15 @@ class Partition extends AbstractEntity
|
|||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $filesystem = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $osName = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'partitions')]
|
||||
private ?Client $client = null;
|
||||
|
||||
#[ORM\Column]
|
||||
private ?int $memoryUsage = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'partitions')]
|
||||
private ?OperativeSystem $operativeSystem = null;
|
||||
|
||||
public function getDiskNumber(): ?int
|
||||
{
|
||||
return $this->diskNumber;
|
||||
|
@ -108,18 +108,6 @@ class Partition extends AbstractEntity
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function getOsName(): ?string
|
||||
{
|
||||
return $this->osName;
|
||||
}
|
||||
|
||||
public function setOsName(string $osName): static
|
||||
{
|
||||
$this->osName = $osName;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getClient(): ?Client
|
||||
{
|
||||
return $this->client;
|
||||
|
@ -143,4 +131,16 @@ class Partition extends AbstractEntity
|
|||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getOperativeSystem(): ?OperativeSystem
|
||||
{
|
||||
return $this->operativeSystem;
|
||||
}
|
||||
|
||||
public function setOperativeSystem(?OperativeSystem $operativeSystem): static
|
||||
{
|
||||
$this->operativeSystem = $operativeSystem;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
<?php
|
||||
|
||||
namespace App\Factory;
|
||||
|
||||
use App\Entity\OperativeSystemType;
|
||||
use App\Repository\OperativeSystemTypeRepository;
|
||||
use Zenstruck\Foundry\ModelFactory;
|
||||
use Zenstruck\Foundry\Persistence\PersistentProxyObjectFactory;
|
||||
use Zenstruck\Foundry\Persistence\Proxy;
|
||||
use Zenstruck\Foundry\Persistence\ProxyRepositoryDecorator;
|
||||
|
||||
/**
|
||||
* @extends PersistentProxyObjectFactory<OperativeSystemType>
|
||||
*/
|
||||
final class OperativeSystemTypeFactory extends ModelFactory
|
||||
{
|
||||
/**
|
||||
* @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#factories-as-services
|
||||
*
|
||||
* @todo inject services if required
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public static function class(): string
|
||||
{
|
||||
return OperativeSystemType::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#model-factories
|
||||
*
|
||||
* @todo add your default values here
|
||||
*/
|
||||
protected function getDefaults(): array
|
||||
{
|
||||
return [
|
||||
'createdAt' => self::faker()->dateTime(),
|
||||
'name' => self::faker()->text(255),
|
||||
'updatedAt' => self::faker()->dateTime(),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#initialization
|
||||
*/
|
||||
protected function initialize(): static
|
||||
{
|
||||
return $this
|
||||
// ->afterInstantiate(function(OperativeSystemType $operativeSystemType): void {})
|
||||
;
|
||||
}
|
||||
|
||||
protected static function getClass(): string
|
||||
{
|
||||
return OperativeSystemType::class;
|
||||
}
|
||||
}
|
|
@ -39,7 +39,6 @@ final class PartitionFactory extends ModelFactory
|
|||
return [
|
||||
'createdAt' => self::faker()->dateTime(),
|
||||
'memoryUsage' => self::faker()->randomNumber(),
|
||||
'osName' => self::faker()->text(255),
|
||||
'size' => self::faker()->randomNumber(),
|
||||
'updatedAt' => self::faker()->dateTime()
|
||||
];
|
||||
|
|
|
@ -4,10 +4,12 @@ namespace Functional;
|
|||
|
||||
use App\Entity\Client;
|
||||
use App\Entity\Menu;
|
||||
use App\Entity\OperativeSystem;
|
||||
use App\Entity\Partition;
|
||||
use App\Factory\ClientFactory;
|
||||
use App\Factory\HardwareProfileFactory;
|
||||
use App\Factory\MenuFactory;
|
||||
use App\Factory\OperativeSystemFactory;
|
||||
use App\Factory\OrganizationalUnitFactory;
|
||||
use App\Factory\PartitionFactory;
|
||||
use App\Factory\UserFactory;
|
||||
|
@ -73,9 +75,12 @@ class PartitionTest extends AbstractTest
|
|||
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,
|
||||
'osName' => 'Ubuntu',
|
||||
'operativeSystem' => $osIri,
|
||||
'client' => $iri,
|
||||
'memoryUsage' => 100
|
||||
]]);
|
||||
|
@ -86,7 +91,7 @@ class PartitionTest extends AbstractTest
|
|||
'@context' => '/contexts/PartitionOutput',
|
||||
'@type' => 'Partition',
|
||||
'size' => 100,
|
||||
'osName' => 'Ubuntu',
|
||||
'operativeSystem' => $osIri,
|
||||
'memoryUsage' => 100
|
||||
]);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue