Skip to content

Commit

Permalink
[TASK] Be more strict in tests
Browse files Browse the repository at this point in the history
Refs #1088

Signed-off-by: Torben Hansen <derhansen@gmail.com>
  • Loading branch information
derhansen committed Apr 6, 2023
1 parent 3ddcc92 commit 719452b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Tests/Unit/Controller/AdministrationControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ protected function setUp(): void
{
$this->subject = $this->getAccessibleMock(
AdministrationController::class,
['redirect', 'forward', 'addFlashMessage', 'redirectToUri', 'getLanguageService', 'initModuleTemplateAndReturnResponse'],
['redirect', 'addFlashMessage', 'redirectToUri', 'getLanguageService', 'initModuleTemplateAndReturnResponse'],
[],
'',
false
Expand Down
17 changes: 8 additions & 9 deletions Tests/Unit/Controller/EventControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ protected function setUp(): void
EventController::class,
[
'redirect',
'forward',
'addFlashMessage',
'overwriteEventDemandObject',
'getSysLanguageUid',
Expand Down Expand Up @@ -111,7 +110,7 @@ public function overwriteDemandObjectIgnoresIgnoredProperties()

$mockController = $this->getAccessibleMock(
EventController::class,
['redirect', 'forward', 'addFlashMessage'],
['redirect', 'addFlashMessage'],
[],
'',
false
Expand All @@ -132,7 +131,7 @@ public function overwriteDemandObjectSetsCategoryProperty()

$mockController = $this->getAccessibleMock(
EventController::class,
['redirect', 'forward', 'addFlashMessage'],
['redirect', 'addFlashMessage'],
[],
'',
false
Expand Down Expand Up @@ -2126,7 +2125,7 @@ public function handleEventNotFoundShows404Page()

$this->expectExceptionCode(1631261423);
$this->expectException(PropagateResponseException::class);
$mock = $this->getAccessibleMock(EventController::class, ['dummy']);
$mock = $this->getAccessibleMock(EventController::class, null);
$mock->_set('request', $request);
$mock->_call('handleEventNotFoundError', $settings);
}
Expand Down Expand Up @@ -2182,7 +2181,7 @@ public function changeEventDemandToFullMonthDateRangeAppliesExpectedDatesAndUnse

$mockController = $this->getAccessibleMock(
EventController::class,
['redirect', 'forward', 'addFlashMessage'],
['redirect', 'addFlashMessage'],
[],
'',
false
Expand All @@ -2207,7 +2206,7 @@ public function changeEventDemandToFullMonthDateRangeAppliesExpectedDatesAndUnse
*/
public function checkPidOfEventRecordWorks()
{
$mockedController = $this->getAccessibleMock(EventController::class, ['dummy']);
$mockedController = $this->getAccessibleMock(EventController::class, null);

$event = new Event();

Expand Down Expand Up @@ -2241,7 +2240,7 @@ public function checkPidOfEventRecordWorks()
*/
public function evaluateSingleEventSettingIsWorking()
{
$mockedController = $this->getAccessibleMock(EventController::class, ['dummy']);
$mockedController = $this->getAccessibleMock(EventController::class, null);
// singleEvent setting not configured not configured
$mockedController->_set('settings', ['singleEvent' => null]);
self::assertNull($mockedController->_call('evaluateSingleEventSetting', null));
Expand All @@ -2266,7 +2265,7 @@ public function evaluateSingleEventSettingIsWorking()
*/
public function evaluateIsShortcutSettingIsWorking()
{
$mockedController = $this->getAccessibleMock(EventController::class, ['dummy']);
$mockedController = $this->getAccessibleMock(EventController::class, null);

// isShortcut not configured
$mockedController->_set('settings', ['detail' => ['isShortcut' => 0]]);
Expand All @@ -2275,7 +2274,7 @@ public function evaluateIsShortcutSettingIsWorking()
// isShortcut is configured
$mockEvent = $this->getMockBuilder(Event::class)->getMock();

$mockContentObjectRenderer = $this->getAccessibleMock(ContentObjectRenderer::class, ['dummy']);
$mockContentObjectRenderer = $this->getAccessibleMock(ContentObjectRenderer::class, null);
$mockContentObjectRenderer->_set('data', ['uid' => 123]);

$mockConfigurationManager = $this->getMockBuilder(ConfigurationManager::class)
Expand Down
2 changes: 1 addition & 1 deletion Tests/Unit/Service/EventPlausabilityServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function isStartDateBeforeEndDateDataProvider(): array
*/
public function isStartDateBeforeEndDateReturnsExpectedResults(int $startdate, int $enddate, bool $expected): void
{
$service = $this->getAccessibleMock(EventPlausabilityService::class, ['dummy'], [], '', false);
$service = $this->getAccessibleMock(EventPlausabilityService::class, null, [], '', false);
self::assertEquals($expected, $service->_call('isStartDateBeforeEndDate', $startdate, $enddate));
}

Expand Down
4 changes: 2 additions & 2 deletions Tests/Unit/Service/SpamCheckServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public function maxSpamScoreIsSetInConstructor(): void
];
$arguments = [];

$service = $this->getAccessibleMock(SpamCheckService::class, ['dummy'], [$registration, $settings, $arguments]);
$service = $this->getAccessibleMock(SpamCheckService::class, null, [$registration, $settings, $arguments]);
self::assertEquals(20, $service->_get('maxSpamScore'));
}

Expand All @@ -111,7 +111,7 @@ public function emptyCheckArrayIsInitializedInConstructor(): void
];
$arguments = [];

$service = $this->getAccessibleMock(SpamCheckService::class, ['dummy'], [$registration, $settings, $arguments]);
$service = $this->getAccessibleMock(SpamCheckService::class, null, [$registration, $settings, $arguments]);
self::assertEquals([], $service->_get('settings')['checks']);
}

Expand Down

0 comments on commit 719452b

Please sign in to comment.