From e297d8253344a13f297793e7102ed1f51ff28235 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 8 Dec 2021 09:26:13 +0100 Subject: [PATCH] fixes on tests [WIP] --- .../ChillActivityBundle/Repository/ActivityRepository.php | 3 ++- .../src/Form/AsideActivityFormType.php | 2 +- src/Bundle/ChillEventBundle/Search/EventSearch.php | 2 +- src/Bundle/ChillMainBundle/Controller/PasswordController.php | 2 +- src/Bundle/ChillMainBundle/Export/ExportManager.php | 4 ++-- .../ChillMainBundle/Security/PasswordRecover/TokenManager.php | 2 +- .../Tests/Security/Authorization/AuthorizationHelperTest.php | 2 +- .../ChillPersonBundle/Entity/SocialWork/SocialIssue.php | 4 ++-- 8 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Repository/ActivityRepository.php b/src/Bundle/ChillActivityBundle/Repository/ActivityRepository.php index ebdc0a3c8..312d601ad 100644 --- a/src/Bundle/ChillActivityBundle/Repository/ActivityRepository.php +++ b/src/Bundle/ChillActivityBundle/Repository/ActivityRepository.php @@ -31,7 +31,8 @@ class ActivityRepository extends ServiceEntityRepository } /** - * @deprecated use @link{ActivityACLAwareRepositoryInterface::findByAccompanyingPeriod} + * @deprecated use @see{ActivityACLAwareRepositoryInterface::findByAccompanyingPeriod} + * * @return Activity[] */ public function findByAccompanyingPeriod(AccompanyingPeriod $period, array $scopes, ?bool $allowNullScope = false, ?int $limit = 100, ?int $offset = 0, array $orderBy = ['date' => 'desc']): array diff --git a/src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityFormType.php b/src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityFormType.php index 73f937ff1..b0147a20f 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityFormType.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityFormType.php @@ -137,7 +137,7 @@ final class AsideActivityFormType extends AbstractType $timezoneUTC = new DateTimeZone('GMT'); /** @var DateTimeImmutable $data */ $data = $formEvent->getData() === null ? - DateTime::createFromFormat('U', 300) : + DateTime::createFromFormat('U', '300') : $formEvent->getData(); $seconds = $data->getTimezone()->getOffset($data); $data->setTimeZone($timezoneUTC); diff --git a/src/Bundle/ChillEventBundle/Search/EventSearch.php b/src/Bundle/ChillEventBundle/Search/EventSearch.php index b3594c274..2b72c6dc3 100644 --- a/src/Bundle/ChillEventBundle/Search/EventSearch.php +++ b/src/Bundle/ChillEventBundle/Search/EventSearch.php @@ -145,7 +145,7 @@ class EventSearch extends AbstractSearch { // add security clauses $reachableCenters = $this->helper - ->getReachableCenters($this->user, new Role('CHILL_EVENT_SEE')); + ->getReachableCenters($this->user, 'CHILL_EVENT_SEE'); if (count($reachableCenters) === 0) { // add a clause to block all events diff --git a/src/Bundle/ChillMainBundle/Controller/PasswordController.php b/src/Bundle/ChillMainBundle/Controller/PasswordController.php index 853cb85d6..2dd700a89 100644 --- a/src/Bundle/ChillMainBundle/Controller/PasswordController.php +++ b/src/Bundle/ChillMainBundle/Controller/PasswordController.php @@ -108,7 +108,7 @@ class PasswordController extends AbstractController $username = $query->get(TokenManager::USERNAME_CANONICAL); $hash = $query->getAlnum(TokenManager::HASH); $token = $query->getAlnum(TokenManager::TOKEN); - $timestamp = $query->getInt(TokenManager::TIMESTAMP); + $timestamp = $query->getAlnum(TokenManager::TIMESTAMP); $user = $this->getDoctrine()->getRepository(User::class) ->findOneByUsernameCanonical($username); diff --git a/src/Bundle/ChillMainBundle/Export/ExportManager.php b/src/Bundle/ChillMainBundle/Export/ExportManager.php index 782a2fdd2..41fc05323 100644 --- a/src/Bundle/ChillMainBundle/Export/ExportManager.php +++ b/src/Bundle/ChillMainBundle/Export/ExportManager.php @@ -545,7 +545,7 @@ class ExportManager if (null === $centers) { $centers = $this->authorizationHelper->getReachableCenters( $this->user, - $role + $role->getName() ); } @@ -585,7 +585,7 @@ class ExportManager 'center' => $center, 'circles' => $this->authorizationHelper->getReachableScopes( $this->user, - $element->requiredRole(), + $element->requiredRole()->getName(), $center ), ]; diff --git a/src/Bundle/ChillMainBundle/Security/PasswordRecover/TokenManager.php b/src/Bundle/ChillMainBundle/Security/PasswordRecover/TokenManager.php index 6a7f6f03e..1c683be45 100644 --- a/src/Bundle/ChillMainBundle/Security/PasswordRecover/TokenManager.php +++ b/src/Bundle/ChillMainBundle/Security/PasswordRecover/TokenManager.php @@ -72,7 +72,7 @@ class TokenManager ]; } - public function verify($hash, $token, User $user, $timestamp) + public function verify($hash, $token, User $user, string $timestamp) { $token = hex2bin(trim($token)); diff --git a/src/Bundle/ChillMainBundle/Tests/Security/Authorization/AuthorizationHelperTest.php b/src/Bundle/ChillMainBundle/Tests/Security/Authorization/AuthorizationHelperTest.php index 0046b5a74..4618ba3b1 100644 --- a/src/Bundle/ChillMainBundle/Tests/Security/Authorization/AuthorizationHelperTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Security/Authorization/AuthorizationHelperTest.php @@ -247,7 +247,7 @@ final class AuthorizationHelperTest extends KernelTestCase $expectedResult, Scope $testedScope, User $user, - Role $role, + string $role, Center $center, $message ) { diff --git a/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialIssue.php b/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialIssue.php index f0a55b0f9..80b106b4e 100644 --- a/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialIssue.php +++ b/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialIssue.php @@ -122,7 +122,7 @@ class SocialIssue } /** - * get all the ancestors of the social issue + * get all the ancestors of the social issue. * * @param bool $includeThis if the array in the result must include the present SocialIssue */ @@ -135,7 +135,7 @@ class SocialIssue } $current = $this; - + while ($current->hasParent()) { $ancestors[] = $current = $current->getParent(); }