fixes on tests [WIP]

This commit is contained in:
Julien Fastré 2021-12-08 09:26:13 +01:00
parent 56dd825f39
commit e297d82533
8 changed files with 11 additions and 10 deletions

View File

@ -31,7 +31,8 @@ class ActivityRepository extends ServiceEntityRepository
} }
/** /**
* @deprecated use @link{ActivityACLAwareRepositoryInterface::findByAccompanyingPeriod} * @deprecated use @see{ActivityACLAwareRepositoryInterface::findByAccompanyingPeriod}
*
* @return Activity[] * @return Activity[]
*/ */
public function findByAccompanyingPeriod(AccompanyingPeriod $period, array $scopes, ?bool $allowNullScope = false, ?int $limit = 100, ?int $offset = 0, array $orderBy = ['date' => 'desc']): array public function findByAccompanyingPeriod(AccompanyingPeriod $period, array $scopes, ?bool $allowNullScope = false, ?int $limit = 100, ?int $offset = 0, array $orderBy = ['date' => 'desc']): array

View File

@ -137,7 +137,7 @@ final class AsideActivityFormType extends AbstractType
$timezoneUTC = new DateTimeZone('GMT'); $timezoneUTC = new DateTimeZone('GMT');
/** @var DateTimeImmutable $data */ /** @var DateTimeImmutable $data */
$data = $formEvent->getData() === null ? $data = $formEvent->getData() === null ?
DateTime::createFromFormat('U', 300) : DateTime::createFromFormat('U', '300') :
$formEvent->getData(); $formEvent->getData();
$seconds = $data->getTimezone()->getOffset($data); $seconds = $data->getTimezone()->getOffset($data);
$data->setTimeZone($timezoneUTC); $data->setTimeZone($timezoneUTC);

View File

@ -145,7 +145,7 @@ class EventSearch extends AbstractSearch
{ {
// add security clauses // add security clauses
$reachableCenters = $this->helper $reachableCenters = $this->helper
->getReachableCenters($this->user, new Role('CHILL_EVENT_SEE')); ->getReachableCenters($this->user, 'CHILL_EVENT_SEE');
if (count($reachableCenters) === 0) { if (count($reachableCenters) === 0) {
// add a clause to block all events // add a clause to block all events

View File

@ -108,7 +108,7 @@ class PasswordController extends AbstractController
$username = $query->get(TokenManager::USERNAME_CANONICAL); $username = $query->get(TokenManager::USERNAME_CANONICAL);
$hash = $query->getAlnum(TokenManager::HASH); $hash = $query->getAlnum(TokenManager::HASH);
$token = $query->getAlnum(TokenManager::TOKEN); $token = $query->getAlnum(TokenManager::TOKEN);
$timestamp = $query->getInt(TokenManager::TIMESTAMP); $timestamp = $query->getAlnum(TokenManager::TIMESTAMP);
$user = $this->getDoctrine()->getRepository(User::class) $user = $this->getDoctrine()->getRepository(User::class)
->findOneByUsernameCanonical($username); ->findOneByUsernameCanonical($username);

View File

@ -545,7 +545,7 @@ class ExportManager
if (null === $centers) { if (null === $centers) {
$centers = $this->authorizationHelper->getReachableCenters( $centers = $this->authorizationHelper->getReachableCenters(
$this->user, $this->user,
$role $role->getName()
); );
} }
@ -585,7 +585,7 @@ class ExportManager
'center' => $center, 'center' => $center,
'circles' => $this->authorizationHelper->getReachableScopes( 'circles' => $this->authorizationHelper->getReachableScopes(
$this->user, $this->user,
$element->requiredRole(), $element->requiredRole()->getName(),
$center $center
), ),
]; ];

View File

@ -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)); $token = hex2bin(trim($token));

View File

@ -247,7 +247,7 @@ final class AuthorizationHelperTest extends KernelTestCase
$expectedResult, $expectedResult,
Scope $testedScope, Scope $testedScope,
User $user, User $user,
Role $role, string $role,
Center $center, Center $center,
$message $message
) { ) {

View File

@ -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 * @param bool $includeThis if the array in the result must include the present SocialIssue
*/ */
@ -135,7 +135,7 @@ class SocialIssue
} }
$current = $this; $current = $this;
while ($current->hasParent()) { while ($current->hasParent()) {
$ancestors[] = $current = $current->getParent(); $ancestors[] = $current = $current->getParent();
} }