Skip to content

Commit

Permalink
afup#1437 fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
stakovicz committed Oct 26, 2024
1 parent 0456ecc commit 41eb937
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 17 deletions.
4 changes: 2 additions & 2 deletions .env.dist
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ PAYBOX_IDENTIFIANT=110647233
BLOG_API_KEY=123456

SMTP_HOST="localhost"
SMTP_PORT="1025"
SMTP_TLS="0"
SMTP_PORT=1025
SMTP_TLS=0
SMTP_USERNAME=""
SMTP_PASSWORD=""
MAILER_FORCE_RECIPIENTS=""
Expand Down
4 changes: 2 additions & 2 deletions dependencies/magpierss/extlib/Snoopy.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,7 @@ class Snoopy
$cmdline_params .= " -m " . $this->read_timeout;
}

$headerfile = uniqid(time());
$headerfile = uniqid((string) time(), true);

# accept self-signed certs
$cmdline_params .= " -k";
Expand Down Expand Up @@ -857,7 +857,7 @@ class Snoopy
break;

case "multipart/form-data":
$this->_mime_boundary = "Snoopy" . md5(uniqid(microtime()));
$this->_mime_boundary = "Snoopy" . md5(uniqid((string) microtime()));

reset($formvars);

Expand Down
2 changes: 1 addition & 1 deletion sources/AppBundle/Association/Model/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ public function getLastSubscription()
public function setLastSubscription($sub)
{
if ($sub !== null) {
$this->lastSubscription = \DateTimeImmutable::createFromFormat('U', $sub);
$this->lastSubscription = \DateTimeImmutable::createFromFormat('U', (string)$sub);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function __construct(

public function generateRandomPassword()
{
return substr(md5(uniqid(mt_rand(), true)), 0, 10);
return substr(md5(uniqid((string) mt_rand(), true)), 0, 10);
}

public function resetPassword(User $user)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function __invoke($id, $token)
return new RedirectResponse($this->urlGenerator->generate('admin_event_list'));
}

if ($result->first()['est_supprimable'] !== '1') {
if ($result->first()['est_supprimable'] !== 1) {
$this->flashBag->add('error', 'Impossible de supprimer un évènement utilisé');
return new RedirectResponse($this->urlGenerator->generate('admin_event_list'));
}
Expand Down
2 changes: 1 addition & 1 deletion sources/AppBundle/Controller/Admin/HomeAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function __invoke()
}
}

$info['statistics']['montant total'] = number_format($montantTotal, 0, 0, ' ') . ' €';
$info['statistics']['montant total'] = number_format($montantTotal, 0, ',', ' ') . ' €';
$info['url'] = '/pages/administration/index.php?page=forum_inscriptions&id_forum=' . $event->getId();

$cards[] = $info;
Expand Down
2 changes: 1 addition & 1 deletion sources/AppBundle/Controller/Admin/LoginAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function __invoke(Request $request)
$lastUsername = $this->authenticationUtils->getLastUsername();

$actualUrl = $request->getSchemeAndHttpHost() . $request->getRequestUri();
$targetUri = $request->query->get('target');
$targetUri = $request->query->get('target', '');
$noDomain = parse_url($targetUri, PHP_URL_HOST) === null;
$targetPath = $targetUri !== $actualUrl && $noDomain ? $targetUri : null;

Expand Down
5 changes: 2 additions & 3 deletions sources/AppBundle/Email/Emails.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ public function __destruct()
public function sendInscription(Event $event, MailUser $recipient)
{
$mailContent = $event->getMailInscriptionContent();

if ('' === trim($mailContent)) {
if (!$mailContent) {
throw new InvalidArgumentException("Contenu du mail d'inscription non trouvé pour le forum " . $event->getTitle());
}

Expand All @@ -61,7 +60,7 @@ public function sendInscription(Event $event, MailUser $recipient)

private function getAttachementIcsInscription(Event $event, MailUser $recipient)
{
$uid = md5($event->getId());
$uid = md5((string) $event->getId());
$organizerCN = MailUserFactory::afup()->getName();
$attendeeCN = $recipient->getName();
$attendeeEmail = $recipient->getEmail();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ protected function getFromRegistrationsOnEvent(Event $event)
*/
private function extractAndCleanTags($comments)
{
if (!$comments) {
return null;
}
preg_match('@\<tag\>(.*)\</tags?\>@i', $comments, $matches);
$tags = isset($matches[1]) ? $matches[1] : '';
$tags = explode(';', $tags);
Expand Down
2 changes: 1 addition & 1 deletion sources/AppBundle/Github/GithubClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function getUserInfos($username)
}

if ($response->getStatusCode() === 200) {
return GithubUser::fromApi(json_decode($response->getBody(), true));
return GithubUser::fromApi(json_decode($response->getBody()->getContents(), true));
}

throw new UnableToGetGithubUserInfosException(
Expand Down
8 changes: 4 additions & 4 deletions sources/AppBundle/Offices/OfficeFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,10 @@ private function haversineGreatCircleDistance(
$latitudeFrom, $longitudeFrom, $latitudeTo, $longitudeTo, $earthRadius = 6371000)
{
// convert from degrees to radians
$latFrom = deg2rad($latitudeFrom);
$lonFrom = deg2rad($longitudeFrom);
$latTo = deg2rad($latitudeTo);
$lonTo = deg2rad($longitudeTo);
$latFrom = deg2rad((float) $latitudeFrom);
$lonFrom = deg2rad((float) $longitudeFrom);
$latTo = deg2rad((float) $latitudeTo);
$lonTo = deg2rad((float) $longitudeTo);

$latDelta = $latTo - $latFrom;
$lonDelta = $lonTo - $lonFrom;
Expand Down

0 comments on commit 41eb937

Please sign in to comment.