diff --git a/src/app/entity/models/EntityModelAbstract.php b/src/app/entity/models/EntityModelAbstract.php index 512e5418660f89c880ea602a2da338d5f64c62b5..06c8f39abbeafee2f2beafa2dfa9df4eccc8733f 100755 --- a/src/app/entity/models/EntityModelAbstract.php +++ b/src/app/entity/models/EntityModelAbstract.php @@ -338,10 +338,7 @@ abstract class EntityModelAbstract if ($aArgs['userId'] == 'superadmin') { $rawEntitiesAllowed = EntityModel::get(['select' => ['entity_id'], 'where' => ['enabled = ?'], 'data' => ['Y'], 'orderBy' => ['entity_label']]); - $entitiesAllowed = []; - foreach ($rawEntitiesAllowed as $value) { - $entitiesAllowed[] = $value['entity_id']; - } + $entitiesAllowed = array_column($rawEntitiesAllowed, 'entity_id'); } else { $entitiesAllowed = EntityModel::getAllEntitiesByUserId(['userId' => $aArgs['userId']]); } diff --git a/src/app/resource/controllers/StoreController.php b/src/app/resource/controllers/StoreController.php index 084e2d42e8859fd83195ffce61c5c8271ef790b8..2583e1249c081dba677a96328d29c81a181e4a0b 100755 --- a/src/app/resource/controllers/StoreController.php +++ b/src/app/resource/controllers/StoreController.php @@ -203,7 +203,7 @@ class StoreController 'barcode' => $args['barcode'] ?? null, 'origin' => $args['origin'] ?? null, 'custom_fields' => !empty($args['customFields']) ? json_encode($args['customFields']) : null, - 'linked_resources' => !empty($args['linkedResources']) ? json_encode($args['linkedResources']) : null, + 'linked_resources' => !empty($args['linkedResources']) ? json_encode($args['linkedResources']) : '[]', 'external_id' => $externalId, 'creation_date' => 'CURRENT_TIMESTAMP' ]; diff --git a/test/unitTests/app/entity/EntityControllerTest.php b/test/unitTests/app/entity/EntityControllerTest.php index 5c2d3cce433beaac7f98681991ba9e86e20addbd..466a46190fc0ee698b3709aa815093bd29fe0e05 100755 --- a/test/unitTests/app/entity/EntityControllerTest.php +++ b/test/unitTests/app/entity/EntityControllerTest.php @@ -176,7 +176,7 @@ class EntityControllerTest extends TestCase $this->assertSame('PARIS', $responseBody->entity->city); $this->assertSame(null, $responseBody->entity->parent_entity_id); $this->assertInternalType('array', (array) $responseBody->entity->listTemplate); - $this->assertInternalType('array', $responseBody->entity->visaTemplate); + $this->assertInternalType('array', $responseBody->entity->visaCircuit); $this->assertSame(false, $responseBody->entity->hasChildren); $this->assertSame(0, $responseBody->entity->documents); $this->assertInternalType('array', $responseBody->entity->users); diff --git a/test/unitTests/app/resource/ResControllerTest.php b/test/unitTests/app/resource/ResControllerTest.php index 356455e9095eff7ea0b102959df839126a7ae979..8fd6942ecab1e7c60ef0f59838363bbe04fce825 100755 --- a/test/unitTests/app/resource/ResControllerTest.php +++ b/test/unitTests/app/resource/ResControllerTest.php @@ -378,7 +378,7 @@ class ResControllerTest extends TestCase 'subject' => $key .' Breaking News : 12345 Superman is alive - PHP unit', 'typist' => 19, 'priority' => $value[1], - 'diffusionList' => [['id' => 'bbain', 'type' => 'user', 'mode' => 'dest']] + 'diffusionList' => [['id' => 1, 'type' => 'user', 'mode' => 'dest']] ]; $fullRequest = \httpRequestCustom::addContentInBody($aArgs, $request); diff --git a/test/unitTests/core/AutocompleteControllerTest.php b/test/unitTests/core/AutocompleteControllerTest.php index 763ba9abbb1472bf6f16fdfdbeb9b6aadbc848e1..4e11063f73df8d7a1c42e500d9763f096759e09a 100755 --- a/test/unitTests/core/AutocompleteControllerTest.php +++ b/test/unitTests/core/AutocompleteControllerTest.php @@ -66,7 +66,8 @@ class AutocompleteControllerTest extends TestCase // $this->assertNotEmpty($value->idToDisplay); // $this->assertNotEmpty($value->otherInfo); if ($value->type == 'contact') { - $this->assertNotEmpty($value->fillingRate->color); + $this->assertNotEmpty($value->fillingRate->rate); + $this->assertNotEmpty($value->fillingRate->thresholdLevel); } } } @@ -149,7 +150,7 @@ class AutocompleteControllerTest extends TestCase foreach ($responseBody as $value) { $this->assertSame('user', $value->type); - $this->assertInternalType('string', $value->id); + $this->assertInternalType('integer', $value->id); $this->assertNotEmpty($value->id); $this->assertInternalType('string', $value->idToDisplay); $this->assertNotEmpty($value->idToDisplay);