Skip to content

Commit 028c139

Browse files
committed
phplint
1 parent d0e1303 commit 028c139

2 files changed

Lines changed: 38 additions & 33 deletions

File tree

install/migrations/update_10.0.x_to_11.0.0/ola.php

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,13 @@ function add_groups_id_field_in_olas(Migration $migration)
5050
$migration->addField(
5151
OLA::getTable(),
5252
Group::getForeignKeyField(),
53-
'fkey', [
54-
'value' => '0',
55-
'null' => false,
56-
'after' => 'slms_id',
57-
]);
53+
'fkey',
54+
[
55+
'value' => '0',
56+
'null' => false,
57+
'after' => 'slms_id',
58+
]
59+
);
5860

5961
// addKey requires the table to exist -> execute migration before
6062
$migration->executeMigration();
@@ -65,14 +67,14 @@ function add_groups_id_field_in_olas(Migration $migration)
6567
// - ajout du groupe à l'ola
6668
// - ajout de l'utilisateur 'normal' au groupe
6769
// @todo problème a résoudre avec Alexandre
68-
if(!countElementsInTable(Group::getTable())) {
70+
if (!countElementsInTable(Group::getTable())) {
6971
$group = new Group();
70-
if(!$group->add(['name' => 'ola_group', 'comment' => 'ola_group temporaire à fixer'])) {;
72+
if (!$group->add(['name' => 'ola_group', 'comment' => 'ola_group temporaire à fixer'])) {
73+
;
7174
throw new Exception('Impossible de créer le groupe ola_group');
7275
}
7376
$groups_id = $group->getID();
74-
}
75-
else {
77+
} else {
7678
// le premier groupe trouvé
7779
$group = new Group();
7880
$groups_ids = $group->find([]);
@@ -88,7 +90,7 @@ function add_groups_id_field_in_olas(Migration $migration)
8890
global $DB;
8991
$DB->delete(Group_User::getTable(), ['users_id' => $user->getID()]);
9092

91-
if(!$association->add(['groups_id' => $groups_id, 'users_id' => $user->getID(), 'is_dynamic' => 0, 'is_manager' => 0])) {
93+
if (!$association->add(['groups_id' => $groups_id, 'users_id' => $user->getID(), 'is_dynamic' => 0, 'is_manager' => 0])) {
9294
throw new Exception('Impossible d\'ajouter l\'utilisateur normal au groupe ola_group');
9395
}
9496

phpunit/functional/OLATest.php

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141

4242
class OLATest extends DbTestCase
4343
{
44-
4544
// default delay for tto & ttr ola
4645
// see @\LevelAgreement::getDefinitionTimeValues() for available unit values
4746
const OLA_TTO_DELAY = [90, 'minute'];
@@ -371,7 +370,6 @@ private function getValidTicketData(): array
371370
// 'tickettemplates_id' => 0,
372371
// 'externalid' => null,
373372
];
374-
375373
}
376374

377375
/**
@@ -388,29 +386,31 @@ private function createOLA(array $data = [], int $ola_type = \SLM::TTO, ?\Group
388386
$slm = $slm ?? $this->createSLM();
389387
$group = $group ?? $this->createGroup();
390388

391-
[$amount, $unit] = match($ola_type) {
389+
[$amount, $unit] = match ($ola_type) {
392390
SLM::TTO => self::OLA_TTO_DELAY,
393391
SLM::TTR => self::OLA_TTR_DELAY,
394392
};
395393

396-
$ola = $this->createItem(Ola::class,
394+
$ola = $this->createItem(
395+
Ola::class,
397396
$data + [
398-
// 'id' => 0,
397+
// 'id' => 0,
399398
'name' => 'OLA ' . time(),
400-
// 'entities_id' => 0,
399+
// 'entities_id' => 0,
401400
'is_recursive' => 1, // @todoseb voir avec quelqu'un le fonctionnement de l'entité 0 et de la récursivité. car la requete Item_Ola::getListForItem() dans \Ticket::getAssociatedOlas attend soit de la récursivité, soit une entité != 0
402401
'type' => $ola_type,
403402
'comment' => 'OLA comment ' . time(),
404403
'number_time' => $amount,
405404
'definition_time' => $unit,
406-
// 'use_ticket_calendar' => 0,
407-
// 'calendars_id' => 0,
408-
// 'date_mod' => null,
409-
// 'end_of_working_day' => 0,
410-
// 'date_creation' => null,
405+
// 'use_ticket_calendar' => 0,
406+
// 'calendars_id' => 0,
407+
// 'date_mod' => null,
408+
// 'end_of_working_day' => 0,
409+
// 'date_creation' => null,
411410
'slms_id' => $slm->getID(),
412411
'groups_id' => $group->getID(),
413-
]);
412+
]
413+
);
414414

415415
return ['ola' => $ola, 'slm' => $slm, 'group' => $group];
416416
}
@@ -419,18 +419,20 @@ private function createSLM(array $data = [], ?\Calendar $calendar = null): SLM
419419
{
420420
$calendar = $calendar ?? $this->createCalendar();
421421

422-
return $this->createItem(SLM::class,
422+
return $this->createItem(
423+
SLM::class,
423424
$data + [
424425
'id' => 0,
425426
'name' => 'SLM name ' . time(),
426-
// 'entities_id' => 0,
427-
// 'is_recursive' => 0,
427+
// 'entities_id' => 0,
428+
// 'is_recursive' => 0,
428429
'comment' => 'Slm comment text',
429-
// 'use_ticket_calendar' => 0,
430+
// 'use_ticket_calendar' => 0,
430431
'calendars_id' => $calendar->getID(),
431-
// 'date_mod' => null,
432-
// 'date_creation' => null,
433-
]);
432+
// 'date_mod' => null,
433+
// 'date_creation' => null,
434+
]
435+
);
434436
}
435437

436438
private function createGroup(): \Group
@@ -463,7 +465,6 @@ private function createGroup(): \Group
463465
// 'recursive_membership' => 0,
464466
// '2fa_enforced' => 0,
465467
]);
466-
467468
}
468469

469470
/**
@@ -473,7 +474,8 @@ private function createCalendar(): \Calendar
473474
{
474475
$calendar = $this->createItem(\Calendar::class, ['name' => 'Test Calendar ' . time()]);
475476
// today
476-
$this->createItem(\CalendarSegment::class,
477+
$this->createItem(
478+
\CalendarSegment::class,
477479
[
478480
'calendars_id' => $calendar->getID(),
479481
'day' => (int)date('w'),
@@ -482,7 +484,8 @@ private function createCalendar(): \Calendar
482484
]
483485
);
484486
// tomorrow
485-
$this->createItem(\CalendarSegment::class,
487+
$this->createItem(
488+
\CalendarSegment::class,
486489
[
487490
'calendars_id' => $calendar->getID(),
488491
'day' => (int)date('w') === 6 ? 0 : (int)date('w') + 1, // day of the week number
@@ -520,4 +523,4 @@ private function getDefaultTtoDelayInterval(): \DateInterval
520523

521524
return new \DateInterval(sprintf('PT%d%s', $amount, strtoupper(substr($unit, 0, 1))));
522525
}
523-
}
526+
}

0 commit comments

Comments
 (0)