diff --git a/phpstan_next.neon b/phpstan_next.neon index a64c0e075..dc5bb17bd 100644 --- a/phpstan_next.neon +++ b/phpstan_next.neon @@ -40,7 +40,6 @@ parameters: - Presenters/ - WebServices/ - lib/ - - tests/fakes/ - tests/Presenters/ bootstrapFiles: - vendor/autoload.php diff --git a/tests/fakes/DBFakes.php b/tests/fakes/DBFakes.php index ef3b3ac6e..01bb254bc 100644 --- a/tests/fakes/DBFakes.php +++ b/tests/fakes/DBFakes.php @@ -135,7 +135,7 @@ public function GetRow() if (sizeof($this->rows) > $this->idx) { return $this->rows[$this->idx++]; } - return false; + return []; } public function NumRows() @@ -177,7 +177,7 @@ public function Disconnect() public function Query(ISqlCommand $command) { $this->_LastSqlCommand = $command; - return null; + return new FakeReader([]); } public function Execute(ISqlCommand $command) @@ -200,7 +200,7 @@ public function GetLastInsertId() public function LimitQuery(ISqlCommand $command, $limit, $offset = null) { $this->_LimitQueryCalled = true; - return null; + return new FakeReader([]); } } diff --git a/tests/fakes/DBRows.php b/tests/fakes/DBRows.php index 1728e512b..8db4ad2bb 100644 --- a/tests/fakes/DBRows.php +++ b/tests/fakes/DBRows.php @@ -4,7 +4,7 @@ class CustomAttributeValueRow { private $rows = []; - public function Rows() + public function Rows(): array { return $this->rows; } @@ -303,7 +303,7 @@ private function AddRow($referenceNumber, $userId, $levelId) * @param array|int[] $participantIds * @return ReservationUserRow */ - public function WithParticipants($instance, $participantIds) + public function WithParticipants(Reservation $instance, array $participantIds): ReservationUserRow { foreach ($participantIds as $id) { $this->AddRow($instance->ReferenceNumber(), $id, ReservationUserLevel::PARTICIPANT); @@ -316,7 +316,7 @@ public function WithParticipants($instance, $participantIds) * @param array|int[] $inviteeIds * @return ReservationUserRow */ - public function WithInvitees($instance, $inviteeIds) + public function WithInvitees(Reservation $instance, array $inviteeIds): ReservationUserRow { foreach ($inviteeIds as $id) { $this->AddRow($instance->ReferenceNumber(), $id, ReservationUserLevel::INVITEE); @@ -329,7 +329,7 @@ class ReservationGuestRow { private $rows = []; - public function Rows() + public function Rows(): array { return $this->rows; } @@ -344,9 +344,9 @@ private function AddRow($referenceNumber, $email, $levelId) /** * @param Reservation $instance * @param array|string[] $participants - * @return ReservationUserRow + * @return ReservationGuestRow */ - public function WithParticipants($instance, $participants) + public function WithParticipants(Reservation $instance, array $participants): ReservationGuestRow { foreach ($participants as $email) { $this->AddRow($instance->ReferenceNumber(), $email, ReservationUserLevel::PARTICIPANT); @@ -356,13 +356,13 @@ public function WithParticipants($instance, $participants) /** * @param Reservation $instance - * @param array|int[] $invitees - * @return ReservationUserRow + * @param array|string[] $invitees + * @return ReservationGuestRow */ - public function WithInvitees($instance, $invitees) + public function WithInvitees(Reservation $instance, array $invitees): ReservationGuestRow { - foreach ($invitees as $email) { - $this->AddRow($instance->ReferenceNumber(), $email, ReservationUserLevel::INVITEE); + foreach ($invitees as $inviteeEmail) { + $this->AddRow($instance->ReferenceNumber(), $inviteeEmail, ReservationUserLevel::INVITEE); } return $this; } diff --git a/tests/fakes/FakeAccessoryRepository.php b/tests/fakes/FakeAccessoryRepository.php index 9992151c3..1e59bc125 100644 --- a/tests/fakes/FakeAccessoryRepository.php +++ b/tests/fakes/FakeAccessoryRepository.php @@ -16,8 +16,7 @@ public function AddAccessory(Accessory $accessory) */ public function LoadById($accessoryId) { - // TODO: Implement LoadById() method. - return null; + throw new LogicException('LoadById() not implemented in FakeAccessoryRepository'); } /** @@ -34,8 +33,8 @@ public function LoadAll() */ public function Add(Accessory $accessory) { - // TODO: Implement Add() method. - return null; + $this->_AllAccessories[] = $accessory; + return count($this->_AllAccessories); } /** diff --git a/tests/fakes/FakeAnnouncements.php b/tests/fakes/FakeAnnouncements.php index 46cbd4bda..d11d8ae07 100644 --- a/tests/fakes/FakeAnnouncements.php +++ b/tests/fakes/FakeAnnouncements.php @@ -67,7 +67,7 @@ public function GetExpectedRows() public function GetAll($sortField = null, $sortDirection = null) { - return null; + return []; } /** @@ -97,6 +97,6 @@ public function Update(Announcement $announcement) */ public function LoadById($announcementId) { - return null; + throw new LogicException('LoadById() not implemented in FakeAnnouncementRepository'); } } diff --git a/tests/fakes/FakeAttributeList.php b/tests/fakes/FakeAttributeList.php index 4cd80d091..0b6024466 100644 --- a/tests/fakes/FakeAttributeList.php +++ b/tests/fakes/FakeAttributeList.php @@ -16,27 +16,25 @@ public function __construct($attributes = []) /** * @return array|string[] */ - public function GetLabels() + public function GetLabels(): array { - // TODO: Implement GetLabels() method. - return null; + return []; } /** * @param null $entityId * @return array|CustomAttribute[] */ - public function GetDefinitions($entityId = null) + public function GetDefinitions($entityId = null): array { - // TODO: Implement GetDefinitions() method. - return null; + return []; } /** * @param $entityId int|null - * @return array|Attribute[] + * @return array|LBAttribute[] */ - public function GetAttributes($entityId = null) + public function GetAttributes($entityId = null): array { if (array_key_exists($entityId, $this->_entityAttributes)) { return $this->_entityAttributes[$entityId]; diff --git a/tests/fakes/FakeAttributeService.php b/tests/fakes/FakeAttributeService.php index 841629436..5675be3ea 100644 --- a/tests/fakes/FakeAttributeService.php +++ b/tests/fakes/FakeAttributeService.php @@ -46,7 +46,7 @@ public function Validate($category, $attributeValues, $entityIds = [], $ignoreEm */ public function GetByCategory($category) { - return $this->_ByCategory[$category]; + return $this->_ByCategory[$category] ?? []; } /** @@ -55,8 +55,7 @@ public function GetByCategory($category) */ public function GetById($attributeId) { - // TODO: Implement GetById() method. - return null; + throw new LogicException('GetById() not implemented in FakeAttributeService'); } /** diff --git a/tests/fakes/FakeBlackoutRepository.php b/tests/fakes/FakeBlackoutRepository.php index d0529f156..0c5a4c22f 100644 --- a/tests/fakes/FakeBlackoutRepository.php +++ b/tests/fakes/FakeBlackoutRepository.php @@ -35,7 +35,7 @@ class FakeBlackoutRepository implements IBlackoutRepository public function Add(BlackoutSeries $blackoutSeries) { $this->_Added = $blackoutSeries; - return null; + return 1; } /** diff --git a/tests/fakes/FakeConfig.php b/tests/fakes/FakeConfig.php index 13f92ec20..db698f4db 100644 --- a/tests/fakes/FakeConfig.php +++ b/tests/fakes/FakeConfig.php @@ -12,7 +12,7 @@ public function Register($configFile, $envFile, $configId, $overwrite = false, $ public function __construct() { - $this->_configs[self::DEFAULT_CONFIG_ID] = new FakeConfigFile(); + $this->SetFile(self::DEFAULT_CONFIG_ID, new FakeConfigFile()); } public function SetFile($configId, $file) @@ -22,7 +22,9 @@ public function SetFile($configId, $file) public function SetKey($configDef, $value) { - $this->File(self::DEFAULT_CONFIG_ID)->SetKey($configDef, $value); + /** @var FakeConfigFile $file */ + $file = $this->_configs[self::DEFAULT_CONFIG_ID]; + $file->SetKey($configDef, $value); } public function SetTimezone($timezone) @@ -39,15 +41,6 @@ public function EnableSubscription() { } - /** - * @param string $configId - * @return FakeConfigFile - */ - - public function File($configId) - { - return $this->_configs[$configId]; - } } class FakeConfigFile extends ConfigurationFile implements IConfigurationFile diff --git a/tests/fakes/FakeDailyLayout.php b/tests/fakes/FakeDailyLayout.php index 6ca73f4d9..afe82e061 100644 --- a/tests/fakes/FakeDailyLayout.php +++ b/tests/fakes/FakeDailyLayout.php @@ -21,8 +21,7 @@ public function GetLayout(Date $date, $resourceId) */ public function IsDateReservable(Date $date) { - // TODO: Implement IsDateReservable() method. - return null; + return true; } /** @@ -31,8 +30,7 @@ public function IsDateReservable(Date $date) */ public function GetLabels(Date $displayDate) { - // TODO: Implement GetLabels() method. - return null; + return []; } /** @@ -51,8 +49,7 @@ public function GetPeriods(Date $displayDate) */ public function GetSummary(Date $date, $resourceId) { - // TODO: Implement GetSummary() method. - return null; + throw new LogicException('GetSummary() not implemented in FakeDailyLayout'); } /** diff --git a/tests/fakes/FakeExistingReservationPage.php b/tests/fakes/FakeExistingReservationPage.php index 69a2b37fe..6c3fa0691 100644 --- a/tests/fakes/FakeExistingReservationPage.php +++ b/tests/fakes/FakeExistingReservationPage.php @@ -7,6 +7,7 @@ class FakeExistingReservationPage extends FakePageBase implements IExistingReser public $_CheckInRequired = false; public $_CheckOutRequired = false; public $_AutoReleaseMinutes = null; + public $_IsUnavailable = false; public function BindViewableResourceReservations($resourceIds) { @@ -241,13 +242,12 @@ public function SetFirstWeekday($weekday) public function MakeUnavailable() { - // TODO: Implement MakeUnavailable() method. + $this->_IsUnavailable = true; } public function IsUnavailable() { - // TODO: Implement IsUnavailable() method. - return null; + return $this->_IsUnavailable; } public function SetTerms($termsOfService) diff --git a/tests/fakes/FakeGroupRepository.php b/tests/fakes/FakeGroupRepository.php index 446e7c3f9..41ff94a77 100644 --- a/tests/fakes/FakeGroupRepository.php +++ b/tests/fakes/FakeGroupRepository.php @@ -50,8 +50,7 @@ public function GetUsersInGroup( $filter = null, $accountStatus = AccountStatus::ALL ) { - // TODO: Implement GetUsersInGroup() method. - return null; + return []; } /** @@ -60,13 +59,11 @@ public function GetUsersInGroup( */ public function GetGroupsByRole($roleLevel) { - // TODO: Implement GetGroupsByRole() method. - return null; + return []; } public function GetPermissionList() { - // TODO: Implement GetPermissionList() method. - return null; + return []; } } diff --git a/tests/fakes/FakePaymentRepository.php b/tests/fakes/FakePaymentRepository.php index 0321cc18e..466287e7b 100644 --- a/tests/fakes/FakePaymentRepository.php +++ b/tests/fakes/FakePaymentRepository.php @@ -7,7 +7,7 @@ class FakePaymentRepository implements IPaymentRepository */ public $_LastCost; /** - * @var CreditCost + * @var array|CreditCost[] */ public $_CreditCost; /** @@ -32,7 +32,7 @@ class FakePaymentRepository implements IPaymentRepository public $_LastSavedPayPalResult; /** - * @var PageablePage + * @var PageableData|null */ public $_TransactionLogs; public $_LastPage; @@ -98,7 +98,7 @@ public function GetList($pageNumber, $pageSize, $userId = -1, $sortField = null, $this->_LastPageSize = $pageSize; $this->_LastUserId = $userId; - return $this->_TransactionLogs; + return $this->_TransactionLogs ?? new PageableData(); } public function GetTransactionLogView($transactionLogId) diff --git a/tests/fakes/FakePermissionService.php b/tests/fakes/FakePermissionService.php index 1fd4f5740..7047c265d 100644 --- a/tests/fakes/FakePermissionService.php +++ b/tests/fakes/FakePermissionService.php @@ -5,7 +5,7 @@ class FakePermissionService implements IPermissionService { /** - * @var array|IResource[] + * @var array|IPermissibleResource[] */ public $Resources; diff --git a/tests/fakes/FakeRegistrationPage.php b/tests/fakes/FakeRegistrationPage.php index c1930f0dd..08b80d755 100644 --- a/tests/fakes/FakeRegistrationPage.php +++ b/tests/fakes/FakeRegistrationPage.php @@ -217,9 +217,9 @@ public function SetAttributes($attributeValues) } /** - * @return array|AttributeValue[] + * @return array|AttributeFormElement[] */ - public function GetAttributes() + public function GetAttributes(): array { return $this->_AttributeValues; } diff --git a/tests/fakes/FakeReport.php b/tests/fakes/FakeReport.php index 49ec5e6df..42abe2d70 100644 --- a/tests/fakes/FakeReport.php +++ b/tests/fakes/FakeReport.php @@ -58,9 +58,9 @@ public function GetAll() } /** - * @return string[] + * @return AttributeReportColumn[] */ - public function GetCustomAttributes() + public function GetCustomAttributes(): array { return []; } diff --git a/tests/fakes/FakeReservationCheckinPage.php b/tests/fakes/FakeReservationCheckinPage.php index 81630f8b6..338499d02 100644 --- a/tests/fakes/FakeReservationCheckinPage.php +++ b/tests/fakes/FakeReservationCheckinPage.php @@ -6,6 +6,7 @@ class FakeReservationCheckinPage implements IReservationCheckinPage { public $_ReferenceNumber; public $_Action; + public $_RetryParameters = []; /** * @param bool $succeeded @@ -52,7 +53,7 @@ public function SetCanBeRetried($canBeRetried) */ public function SetRetryParameters($retryParameters) { - // TODO: Implement SetRetryParameters() method. + $this->_RetryParameters = $retryParameters; } /** @@ -60,8 +61,7 @@ public function SetRetryParameters($retryParameters) */ public function GetRetryParameters() { - // TODO: Implement GetRetryParameters() method. - return null; + return $this->_RetryParameters; } /** diff --git a/tests/fakes/FakeReservationConflictIdentifier.php b/tests/fakes/FakeReservationConflictIdentifier.php index d6f1f4a94..e26c52695 100644 --- a/tests/fakes/FakeReservationConflictIdentifier.php +++ b/tests/fakes/FakeReservationConflictIdentifier.php @@ -8,7 +8,7 @@ class FakeReservationConflictIdentifier implements IReservationConflictIdentifie public $_Conflicts = null; /** - * @var ReservationConflictResult + * @var array|ReservationConflictResult[] */ public $_IndexedConflicts = []; diff --git a/tests/fakes/FakeReservationRepository.php b/tests/fakes/FakeReservationRepository.php index 59c0f27f1..6bc9a10b8 100644 --- a/tests/fakes/FakeReservationRepository.php +++ b/tests/fakes/FakeReservationRepository.php @@ -206,8 +206,7 @@ public function Delete(ExistingReservationSeries $existingReservationSeries) */ public function LoadReservationAttachment($attachmentFileId) { - // TODO: Implement LoadReservationAttachment() method. - return null; + throw new LogicException('LoadReservationAttachment() not implemented in FakeReservationRepository'); } /** @@ -216,8 +215,7 @@ public function LoadReservationAttachment($attachmentFileId) */ public function AddReservationAttachment(ReservationAttachment $attachmentFile) { - // TODO: Implement AddReservationAttachment() method. - return null; + return 1; } /** @@ -225,8 +223,7 @@ public function AddReservationAttachment(ReservationAttachment $attachmentFile) */ public function GetReservationColorRules() { - // TODO: Implement GetReservationColorRules() method. - return null; + return []; } /** @@ -235,8 +232,7 @@ public function GetReservationColorRules() */ public function GetReservationColorRule($ruleId) { - // TODO: Implement GetReservationColorRule() method. - return null; + throw new LogicException('GetReservationColorRule() not implemented in FakeReservationRepository'); } /** @@ -245,8 +241,7 @@ public function GetReservationColorRule($ruleId) */ public function AddReservationColorRule(ReservationColorRule $colorRule) { - // TODO: Implement AddReservationColorRule() method. - return null; + return 1; } /** diff --git a/tests/fakes/FakeReservationService.php b/tests/fakes/FakeReservationService.php index 3a06ed6d2..24db54bda 100644 --- a/tests/fakes/FakeReservationService.php +++ b/tests/fakes/FakeReservationService.php @@ -34,7 +34,7 @@ class FakeReservationService implements IReservationService */ public $_Reservation; /** - * @var ReservationListItem + * @var array|ReservationListItem[] */ public $_ReservationsAndBlackouts = []; diff --git a/tests/fakes/FakeReservationViewRepository.php b/tests/fakes/FakeReservationViewRepository.php index 2a2e12719..74d49ef04 100644 --- a/tests/fakes/FakeReservationViewRepository.php +++ b/tests/fakes/FakeReservationViewRepository.php @@ -53,12 +53,12 @@ public function __construct() public function GetReservationsPendingApproval(Date $startDate, $userIds = ReservationViewRepository::ALL_USERS, $userLevel = ReservationUserLevel::OWNER, $scheduleIds = ReservationViewRepository::ALL_SCHEDULES, $resourceIds = ReservationViewRepository::ALL_RESOURCES, $consolidateByReferenceNumber = false, $participantIds = ReservationViewRepository::ALL_USERS) { - return null; + return []; } public function GetReservationsMissingCheckInCheckOut(?Date $startDate, Date $endDate, $userIds = ReservationViewRepository::ALL_USERS, $userLevel = ReservationUserLevel::OWNER, $scheduleIds = ReservationViewRepository::ALL_SCHEDULES, $resourceIds = ReservationViewRepository::ALL_RESOURCES, $consolidateByReferenceNumber = false, $participantIds = ReservationViewRepository::ALL_USERS) { - return null; + return []; } public function GetReservationForEditing($referenceNumber) @@ -81,7 +81,8 @@ public function GetReservations( $this->_LastRange = new DateRange($startDate, $endDate); if (!empty($this->_ReservationsIteration)) { - return $this->_ReservationsIteration[$this->_Iteration++]; + $nextReservations = $this->_ReservationsIteration[$this->_Iteration++] ?? []; + return is_array($nextReservations) ? $nextReservations : [$nextReservations]; } return $this->_Reservations; diff --git a/tests/fakes/FakeReservationWaitlistRepository.php b/tests/fakes/FakeReservationWaitlistRepository.php index f65e6fac7..0bb3c8593 100644 --- a/tests/fakes/FakeReservationWaitlistRepository.php +++ b/tests/fakes/FakeReservationWaitlistRepository.php @@ -40,8 +40,7 @@ public function GetAll() */ public function LoadById($waitlistId) { - // TODO: Implement LoadById() method. - return null; + throw new LogicException('LoadById() not implemented in FakeReservationWaitlistRepository'); } /** diff --git a/tests/fakes/FakeResourceRepository.php b/tests/fakes/FakeResourceRepository.php index 04d48183b..43e49f5a7 100644 --- a/tests/fakes/FakeResourceRepository.php +++ b/tests/fakes/FakeResourceRepository.php @@ -34,7 +34,7 @@ public function GetResourceIdList(): array public function GetUserResourceList() { - return null; + return []; } public function GetUserResourceIdList(): array @@ -44,7 +44,7 @@ public function GetUserResourceIdList(): array public function GetUserList($resourceIds, $pageNumber, $pageSize, $sortField = null, $sortDirection = null, $filter = null) { - return null; + return []; } public function GetUserResourcePermissions($userId, $resourceIds = []) @@ -88,8 +88,8 @@ public function LoadByName($name) public function Add(BookableResource $resource) { - // TODO: Implement Add() method. - return null; + $this->_ResourceList[] = $resource; + return count($this->_ResourceList); } public function Update(BookableResource $resource) @@ -109,20 +109,17 @@ public function GetResourceList() public function GetList($pageNumber, $pageSize, $sortField = null, $sortDirection = null, $filter = null) { - // TODO: Implement GetList() method. - return null; + return []; } public function GetAccessoryList($sortField = null, $sortDirection = null) { - // TODO: Implement GetAccessoryList() method. - return null; + return []; } public function GetResourceGroups($scheduleId = null, $resourceFilter = null) { - // TODO: Implement GetResourceGroups() method. - return null; + throw new LogicException('GetResourceGroups() not implemented in FakeResourceRepository'); } public function AddResourceToGroup($resourceId, $groupId) @@ -137,20 +134,17 @@ public function RemoveResourceFromGroup($resourceId, $groupId) public function AddResourceGroup(ResourceGroup $group) { - // TODO: Implement AddResourceGroup() method. - return null; + throw new LogicException('AddResourceGroup() not implemented in FakeResourceRepository'); } public function LoadResourceGroup($groupId) { - // TODO: Implement LoadResourceGroup() method. - return null; + throw new LogicException('LoadResourceGroup() not implemented in FakeResourceRepository'); } public function LoadResourceGroupByPublicId($publicResourceGroupId) { - // TODO: Implement LoadResourceGroupByPublicId() method. - return null; + throw new LogicException('LoadResourceGroupByPublicId() not implemented in FakeResourceRepository'); } public function UpdateResourceGroup(ResourceGroup $group) @@ -165,20 +159,17 @@ public function DeleteResourceGroup($groupId) public function GetResourceTypes() { - // TODO: Implement GetResourceTypes() method. - return null; + return []; } public function LoadResourceType($resourceTypeId) { - // TODO: Implement LoadResourceType() method. - return null; + throw new LogicException('LoadResourceType() not implemented in FakeResourceRepository'); } public function AddResourceType(ResourceType $type) { - // TODO: Implement AddResourceType() method. - return null; + return 1; } public function UpdateResourceType(ResourceType $type) @@ -193,14 +184,12 @@ public function RemoveResourceType($id) public function GetStatusReasons() { - // TODO: Implement GetStatusReasons() method. - return null; + return []; } public function AddStatusReason($statusId, $reasonDescription) { - // TODO: Implement AddStatusReason() method. - return null; + return 1; } public function UpdateStatusReason($reasonId, $reasonDescription) @@ -220,20 +209,17 @@ public function GetUsersWithPermission( $filter = null, $accountStatus = AccountStatus::ACTIVE ) { - // TODO: Implement GetUsersWithPermission() method. - return null; + return []; } public function GetGroupsWithPermission($resourceId, $pageNumber = null, $pageSize = null, $filter = null) { - // TODO: Implement GetGroupsWithPermission() method. - return null; + return []; } public function GetUsersWithPermissionsIncludingGroups($resourceId, $pageNumber = null, $pageSize = null, $filter = null, $accountStatus = AccountStatus::ACTIVE) { - // TODO: Implement GetUsersWithPermissionsIncludingGroups() method. - return null; + return []; } public function ChangeResourceGroupPermission($resourceId, $groupId, $type) diff --git a/tests/fakes/FakeResourceService.php b/tests/fakes/FakeResourceService.php index 4acfa27ac..98ebda61b 100644 --- a/tests/fakes/FakeResourceService.php +++ b/tests/fakes/FakeResourceService.php @@ -39,12 +39,11 @@ public function GetAllResources($includeInaccessibleResources, UserSession $user } /** - * @return array|AccessoryDto[] + * @return array|Accessory[] */ - public function GetAccessories() + public function GetAccessories(): array { - // TODO: Implement GetAccessories() method. - return null; + return []; } /** @@ -54,35 +53,31 @@ public function GetAccessories() */ public function GetResourceGroups($scheduleId, UserSession $user) { - // TODO: Implement GetResourceGroups() method. - return null; + throw new LogicException('GetResourceGroups() not implemented in FakeResourceService'); } /** * @return ResourceType[] */ - public function GetResourceTypes() + public function GetResourceTypes(): array { - // TODO: Implement GetResourceTypes() method. - return null; + return []; } /** - * @return Attribute[] + * @return LBAttribute[] */ - public function GetResourceAttributes() + public function GetResourceAttributes(): array { - // TODO: Implement GetResourceAttributes() method. - return null; + return []; } /** - * @return Attribute[] + * @return LBAttribute[] */ - public function GetResourceTypeAttributes() + public function GetResourceTypeAttributes(): array { - // TODO: Implement GetResourceTypeAttributes() method. - return null; + return []; } /** @@ -91,7 +86,6 @@ public function GetResourceTypeAttributes() */ public function GetResource($resourceId) { - // TODO: Implement GetResource() method. - return null; + throw new LogicException('GetResource() not implemented in FakeResourceService'); } } diff --git a/tests/fakes/FakeRestServer.php b/tests/fakes/FakeRestServer.php index b9478ae1f..8a92e322d 100644 --- a/tests/fakes/FakeRestServer.php +++ b/tests/fakes/FakeRestServer.php @@ -53,7 +53,7 @@ public function GetServiceUrl($serviceName, $params = []) if (isset($this->_ServiceUrls[$serviceName])) { return $this->_ServiceUrls[$serviceName]; } - return null; + return ''; } public function SetRequest($request) @@ -68,8 +68,7 @@ public function GetUrl() public function GetFullServiceUrl($serviceName, $params = []) { - // TODO: Implement GetFullServiceUrl() method. - return null; + return $this->GetServiceUrl($serviceName, $params); } public function GetHeader($headerName): ?string diff --git a/tests/fakes/FakeScheduleLayout.php b/tests/fakes/FakeScheduleLayout.php index 112cb77ed..09c433034 100644 --- a/tests/fakes/FakeScheduleLayout.php +++ b/tests/fakes/FakeScheduleLayout.php @@ -53,7 +53,7 @@ public function UsesDailyLayouts() public function GetLayout(Date $layoutDate, $hideBlockedPeriods = false) { if (!empty($this->_DailyLayout)) { - return $this->_DailyLayout[$layoutDate->Timestamp()]; + return $this->_DailyLayout[$layoutDate->Timestamp()] ?? []; } return $this->_Layout; @@ -104,8 +104,7 @@ public function RemovePeakTimes() */ public function FitsToHours() { - // TODO: Implement FitsToHours() method. - return null; + return true; } /** @@ -113,8 +112,7 @@ public function FitsToHours() */ public function UsesCustomLayout() { - // TODO: Implement UsesCustomLayout() method. - return null; + return false; } /** diff --git a/tests/fakes/FakeSchedules.php b/tests/fakes/FakeSchedules.php index 060e68ecb..943831798 100644 --- a/tests/fakes/FakeSchedules.php +++ b/tests/fakes/FakeSchedules.php @@ -189,8 +189,7 @@ public function Delete(Schedule $schedule) */ public function Add(Schedule $schedule, $copyLayoutFromScheduleId) { - // TODO: Implement Add() method. - return null; + return 1; } /** @@ -213,8 +212,7 @@ public function GetLayout($scheduleId, ILayoutFactory $layoutFactory) */ public function GetList($pageNumber, $pageSize, $sortField = null, $sortDirection = null, $filter = null) { - // TODO: Implement GetList() method. - return null; + return []; } /** @@ -248,8 +246,7 @@ public function _AddCustomLayout($date, $periods) */ public function GetCustomLayoutPeriodsInRange(Date $start, Date $end, $scheduleId) { - // TODO: Implement GetCustomLayoutPeriodsInRange() method. - return null; + return []; } /** diff --git a/tests/fakes/FakeServer.php b/tests/fakes/FakeServer.php index 82dda2f8c..f3b483a54 100644 --- a/tests/fakes/FakeServer.php +++ b/tests/fakes/FakeServer.php @@ -37,7 +37,7 @@ public function DeleteCookie(Cookie $cookie) /** * @param string $name - * @return string + * @return string|null */ public function GetCookie($name) { diff --git a/tests/fakes/FakeTermsOfServiceRepository.php b/tests/fakes/FakeTermsOfServiceRepository.php index 8a7aaec3f..754a3f3e2 100644 --- a/tests/fakes/FakeTermsOfServiceRepository.php +++ b/tests/fakes/FakeTermsOfServiceRepository.php @@ -16,8 +16,7 @@ public function __construct() public function Add(TermsOfService $terms) { - // TODO: Implement Add() method. - return null; + return 1; } public function Load() diff --git a/tests/fakes/FakeUserRepository.php b/tests/fakes/FakeUserRepository.php index 25fef0d22..5a400ead5 100644 --- a/tests/fakes/FakeUserRepository.php +++ b/tests/fakes/FakeUserRepository.php @@ -92,7 +92,7 @@ public function Update(User $user) public function Add(User $user) { $this->_AddedUser = $user; - return null; + return 1; } /** @@ -151,8 +151,7 @@ public function GetList( */ public function GetResourceAdmins($resourceId) { - // TODO: Implement GetResourceAdmins() method. - return null; + return []; } /** @@ -160,8 +159,7 @@ public function GetResourceAdmins($resourceId) */ public function GetApplicationAdmins() { - // TODO: Implement GetApplicationAdmins() method. - return null; + return []; } /** @@ -170,8 +168,7 @@ public function GetApplicationAdmins() */ public function GetGroupAdmins($userId) { - // TODO: Implement GetGroupAdmins() method. - return null; + return []; } /** @@ -181,8 +178,7 @@ public function GetGroupAdmins($userId) */ public function LoadGroups($userId, $roleLevels = null) { - // TODO: Implement LoadGroups() method. - return null; + return []; } /** @@ -200,7 +196,6 @@ public function UserExists($emailAddress, $userName) */ public function GetCount() { - // TODO: Implement GetCount() method. - return null; + return 0; } } diff --git a/tests/fakes/FakeWebAuthentication.php b/tests/fakes/FakeWebAuthentication.php index 3825faed5..aafde6a2a 100644 --- a/tests/fakes/FakeWebAuthentication.php +++ b/tests/fakes/FakeWebAuthentication.php @@ -39,8 +39,7 @@ public function Logout(UserSession $user) */ public function AreCredentialsKnown() { - // TODO: Implement AreCredentialsKnown() method. - return null; + return false; } /** @@ -57,8 +56,7 @@ public function HandleLoginFailure(IAuthenticationPage $loginPage) */ public function ShowUsernamePrompt() { - // TODO: Implement ShowUsernamePrompt() method. - return null; + return false; } /** @@ -66,8 +64,7 @@ public function ShowUsernamePrompt() */ public function ShowPasswordPrompt() { - // TODO: Implement ShowPasswordPrompt() method. - return null; + return false; } /** @@ -75,8 +72,7 @@ public function ShowPasswordPrompt() */ public function ShowPersistLoginPrompt() { - // TODO: Implement ShowPersistLoginPrompt() method. - return null; + return false; } /** @@ -84,8 +80,7 @@ public function ShowPersistLoginPrompt() */ public function ShowForgotPasswordPrompt() { - // TODO: Implement ShowForgotPasswordPrompt() method. - return null; + return false; } /** @@ -93,8 +88,7 @@ public function ShowForgotPasswordPrompt() */ public function AllowUsernameChange() { - // TODO: Implement AllowUsernameChange() method. - return null; + return false; } /** @@ -102,8 +96,7 @@ public function AllowUsernameChange() */ public function AllowEmailAddressChange() { - // TODO: Implement AllowEmailAddressChange() method. - return null; + return false; } /** @@ -111,8 +104,7 @@ public function AllowEmailAddressChange() */ public function AllowPasswordChange() { - // TODO: Implement AllowPasswordChange() method. - return null; + return false; } /** @@ -120,8 +112,7 @@ public function AllowPasswordChange() */ public function AllowNameChange() { - // TODO: Implement AllowNameChange() method. - return null; + return false; } /** @@ -129,8 +120,7 @@ public function AllowNameChange() */ public function AllowPhoneChange() { - // TODO: Implement AllowPhoneChange() method. - return null; + return false; } /** @@ -138,8 +128,7 @@ public function AllowPhoneChange() */ public function AllowOrganizationChange() { - // TODO: Implement AllowOrganizationChange() method. - return null; + return false; } /** @@ -147,8 +136,7 @@ public function AllowOrganizationChange() */ public function AllowPositionChange() { - // TODO: Implement AllowPositionChange() method. - return null; + return false; } } diff --git a/tests/fakes/TestReservationItemView.php b/tests/fakes/TestReservationItemView.php index 0a78a4197..2eb66e78e 100644 --- a/tests/fakes/TestReservationItemView.php +++ b/tests/fakes/TestReservationItemView.php @@ -15,7 +15,7 @@ public function __construct($id, Date $startDate, Date $endDate, $resourceId = 1 { parent::__construct(); - $this->ReservationId = $id; + $this->ReservationId = (int)($id ?? 0); $this->StartDate = $startDate; $this->EndDate = $endDate; $this->ResourceId = $resourceId;