Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Pages/Ajax/ReservationAttributesPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ interface IReservationAttributesPage
public function GetRequestedUserId();

/**
* @return int
* @return string
*/
public function GetRequestedReferenceNumber();

Expand Down
2 changes: 1 addition & 1 deletion Pages/Ajax/ReservationAttributesPrintPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ interface IReservationAttributesPrintPage
public function GetRequestedUserId();

/**
* @return int
* @return string
*/
public function GetRequestedReferenceNumber();

Expand Down
1 change: 0 additions & 1 deletion phpstan_next.neon
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,5 @@ parameters:
- Presenters/
- WebServices/
- lib/
- tests/Presenters/
bootstrapFiles:
- vendor/autoload.php
6 changes: 2 additions & 4 deletions tests/Presenters/Admin/ManageConfigurationPresenterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,7 @@ public function SetConfigFileOptions($configFiles)
*/
public function GetConfigFileToEdit()
{
// TODO: Implement GetConfigFileToEdit() method.
return null;
return '';
}

/**
Expand Down Expand Up @@ -362,7 +361,6 @@ public function SetExportPluginValues($values)
*/
public function GetHomePageId()
{
// TODO: Implement GetHomePageId() method.
return null;
return 0;
}
}
7 changes: 4 additions & 3 deletions tests/Presenters/Admin/ManagePaymentsPresenterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ public function setUp(): void
public function testPageLoadSetsCurrentCreditValues()
{
$creditCost = new CreditCost(44.4, 'USD');
$this->paymentRepository->_CreditCost = $creditCost;
$this->paymentRepository->_CreditCost = [$creditCost];

$this->presenter->PageLoad();

$this->assertEquals($creditCost->Cost(), $this->page->_CreditCost->Cost());
$this->assertEquals($creditCost->Currency(), $this->page->_CreditCost->Currency());
$this->assertEquals($creditCost->Cost(), $this->page->_CreditCost[0]->Cost());
$this->assertEquals($creditCost->Currency(), $this->page->_CreditCost[0]->Currency());
}

public function testPageLoadSetsGatewayValues()
Expand Down Expand Up @@ -120,6 +120,7 @@ public function testIssuesPayPalRefund()
$this->page->_RefundAmount = 100;
$this->paymentRepository->_TransactionLogView = $this->GetTransactionLogView();

/** @var FakePayPalGateway $gateway */
$gateway = $this->paymentRepository->_PayPal;
$gateway->_Refund->state = 'completed';

Expand Down
27 changes: 13 additions & 14 deletions tests/Presenters/Admin/ManageUsersPresenterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -659,20 +659,17 @@ public function BindGroups($groups)

public function GetReservationColor()
{
// TODO: Implement GetReservationColor() method.
return null;
return '';
}

public function GetValue()
{
// TODO: Implement GetValue() method.
return null;
return '';
}

public function GetName()
{
// TODO: Implement GetName() method.
return null;
return '';
}

public function ShowTemplateCSV($attributes)
Expand All @@ -682,8 +679,13 @@ public function ShowTemplateCSV($attributes)

public function GetImportFile()
{
// TODO: Implement GetImportFile() method.
return null;
return new UploadedFile([
'name' => 'users.csv',
'tmp_name' => __FILE__,
'type' => 'text/csv',
'size' => filesize(__FILE__),
'error' => UPLOAD_ERR_OK,
]);
}

public function SetImportResult($importResult)
Expand All @@ -693,8 +695,7 @@ public function SetImportResult($importResult)

public function GetInvitedEmails()
{
// TODO: Implement GetInvitedEmails() method.
return null;
return '';
}

public function ShowExportCsv()
Expand All @@ -714,14 +715,12 @@ public function GetDeletedUserIds()

public function SendEmailNotification()
{
// TODO: Implement SendEmailNotification() method.
return null;
return false;
}

public function GetUpdateOnImport()
{
// TODO: Implement GetUpdateOnImport() method.
return null;
return false;
}

public function ShowUserUpdate(User $user, $attributes)
Expand Down
3 changes: 1 addition & 2 deletions tests/Presenters/CalendarSubscriptionPresenterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,7 @@ public function GetResourceGroupId()

public function GetAccessoryIds()
{
// TODO: Implement GetAccessoryIds() method.
return null;
return 0;
}

public function GetPastNumberOfDays()
Expand Down
3 changes: 1 addition & 2 deletions tests/Presenters/EmbeddedCalendarPresenterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,7 @@ public function GetDisplayType()
*/
public function GetTitleFormat()
{
// TODO: Implement GetTitleFormat() method.
return null;
return '';
}

/**
Expand Down
9 changes: 3 additions & 6 deletions tests/Presenters/LoginPresenterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,13 @@ public function setUp(): void

$this->fakeServer->SetSession(SessionKeys::USER_SESSION, new UserSession(1));

$this->presenter = new LoginPresenter($this->page, $this->auth, $this->captchaService, $this->announcementRepository);
$loginPage = $this->page;
$this->presenter = new LoginPresenter($loginPage, $this->auth, $this->captchaService, $this->announcementRepository);
}

public function teardown(): void
{
parent::teardown();

$this->auth = null;
$this->page = null;
}

public function testLoginCallsAuthValidate()
Expand Down Expand Up @@ -423,8 +421,7 @@ public function SetPasswordResetUrl($url)

public function GetCaptcha()
{
// TODO: Implement GetCaptcha() method.
return null;
return '';
}

public function SetAnnouncements($announcements)
Expand Down
4 changes: 0 additions & 4 deletions tests/Presenters/RegisterPresenterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,6 @@ public function setUp(): void
public function teardown(): void
{
parent::teardown();

$this->page = null;
$this->fakeReg = null;
$this->fakeAuth = null;
}

public function testSetsSelectedTimezoneToServerDefault()
Expand Down
10 changes: 5 additions & 5 deletions tests/Presenters/Reports/GenerateReportPresenterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ class FakeGenerateReportPage extends GenerateReportPage
*/
public $_BoundReport;
/**
* @var Report_Usage
* @var string|Report_Usage
*/
public $_Usage;

Expand Down Expand Up @@ -273,7 +273,7 @@ public function GetEnd()

public function GetResourceIds()
{
return $this->_ResourceId;
return is_array($this->_ResourceId) ? $this->_ResourceId : [$this->_ResourceId];
}

public function GetResourceTypeIds()
Expand All @@ -283,7 +283,7 @@ public function GetResourceTypeIds()

public function GetScheduleIds()
{
return $this->_ScheduleId;
return is_array($this->_ScheduleId) ? $this->_ScheduleId : [$this->_ScheduleId];
}

public function GetUserId()
Expand All @@ -298,7 +298,7 @@ public function GetParticipantId()

public function GetGroupIds()
{
return $this->_GroupId;
return is_array($this->_GroupId) ? $this->_GroupId : [$this->_GroupId];
}

public function BindReport(IReport $report, IReportDefinition $definition, $selectedColumns)
Expand All @@ -314,7 +314,7 @@ public function GetUsage()

public function GetAccessoryIds()
{
return $this->_AccessoryId;
return is_array($this->_AccessoryId) ? $this->_AccessoryId : [$this->_AccessoryId];
}

public function GetReportName()
Expand Down
2 changes: 1 addition & 1 deletion tests/Presenters/Reports/SavedReportsPresenterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ class FakeSavedReportsPage extends SavedReportsPage
*/
public $_BoundReport;
/**
* @var ReportDefinition
* @var IReportDefinition
*/
public $_BoundDefinition;
/**
Expand Down
12 changes: 4 additions & 8 deletions tests/Presenters/Reservation/GuestReservationPresenterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,20 +146,17 @@ public function GetRequestedScheduleId()

public function GetReservationDate()
{
// TODO: Implement GetReservationDate() method.
return null;
return Date::Now();
}

public function GetStartDate()
{
// TODO: Implement GetStartDate() method.
return null;
return Date::Now();
}

public function GetEndDate()
{
// TODO: Implement GetEndDate() method.
return null;
return Date::Now();
}

public function BindPeriods($startPeriods, $endPeriods, $lockPeriods)
Expand Down Expand Up @@ -281,8 +278,7 @@ public function MakeUnavailable()

public function IsUnavailable()
{
// TODO: Implement IsUnavailable() method.
return null;
return false;
}

public function SetTermsAccepted($accepted)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ class FakeReservationAttributesPage implements IReservationAttributesPage
public $_RequestedUserId;

/**
* @var int
* @var string
*/
public $_RequestedReferenceNumber;

Expand All @@ -233,15 +233,16 @@ public function GetRequestedUserId()
}

/**
* @param LBAttribute[] $attributes
* @param Attribute[] $attributes
*/
public function SetAttributes($attributes)
{
/** @var LBAttribute[] $attributes */
$this->_Attributes = $attributes;
}

/**
* @return int
* @return string
*/
public function GetRequestedReferenceNumber()
{
Expand All @@ -253,7 +254,6 @@ public function GetRequestedReferenceNumber()
*/
public function GetRequestedResourceIds()
{
// TODO: Implement GetRequestedResourceIds() method.
return null;
return [];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class ReservationInitializationTest extends TestBase
private $page;

/**
* @var NewReservationInitializer|PHPUnit\Framework\MockObject\MockObject
* @var NewReservationInitializer
*/
private $initializer;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,7 @@ public function SetRetryParameters($retryParameters)
*/
public function GetRetryParameters()
{
// TODO: Implement GetRetryParameters() method.
return null;
return [];
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,7 @@ public function SetRetryParameters($retryParameters)
*/
public function GetRetryParameters()
{
// TODO: Implement GetRetryParameters() method.
return null;
return [];
}

/**
Expand All @@ -156,17 +155,15 @@ public function SetCanJoinWaitList($canJoinWaitlist)
*/
public function GetReferenceNumber()
{
// TODO: Implement GetReferenceNumber() method.
return null;
return '';
}

/**
* @return string
*/
public function GetAction()
{
// TODO: Implement GetAction() method.
return null;
return '';
}

/**
Expand Down
6 changes: 2 additions & 4 deletions tests/Presenters/ResourceDisplayPresenterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -433,8 +433,7 @@ public function GetDataRequest()

public function GetResourceId()
{
// TODO: Implement GetResourceId() method.
return null;
return '';
}

public function DisplayLogin()
Expand Down Expand Up @@ -575,8 +574,7 @@ public function SetTerms($termsOfService)
*/
public function GetTermsOfServiceAcknowledgement()
{
// TODO: Implement GetTermsOfServiceAcknowledgement() method.
return null;
return false;
}

public function DisplayInstructions()
Expand Down
Loading