Commit d0b4bf2a authored by Roman Büchler's avatar Roman Büchler Committed by Anja Leichsenring
Browse files

[TASK] Strictify UnitTests part 5 - EXT:core

Resolves: #94879
Releases: master
Change-Id: I4b96ad0ed03f6089c391fb3bd3e967878aaa1ea2
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/70593


Tested-by: core-ci's avatarcore-ci <typo3@b13.com>
Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: Anja Leichsenring's avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Anja Leichsenring's avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
parent aea038c9
......@@ -27,7 +27,7 @@ class CompareUserCest
/**
* @param ApplicationTester $I
*/
public function _before(ApplicationTester $I)
public function _before(ApplicationTester $I): void
{
$I->useExistingSession('admin');
......@@ -39,7 +39,7 @@ class CompareUserCest
/**
* @param ApplicationTester $I
*/
public function editingBeUserRecordsFromCompareViewWorks(ApplicationTester $I)
public function editingBeUserRecordsFromCompareViewWorks(ApplicationTester $I): void
{
// put two users into compare list
$I->see('Backend User Listing');
......
......@@ -27,7 +27,7 @@ class ListGroupCest
/**
* @param ApplicationTester $I
*/
public function _before(ApplicationTester $I)
public function _before(ApplicationTester $I): void
{
$I->useExistingSession('admin');
......@@ -43,7 +43,7 @@ class ListGroupCest
/**
* @param ApplicationTester $I
*/
public function canEditBeGroupsFromListView(ApplicationTester $I)
public function canEditBeGroupsFromListView(ApplicationTester $I): void
{
$groupname = $I->grabTextFrom('table.table-striped > tbody > tr:nth-child(1) > td.title > a > b');
......@@ -59,7 +59,7 @@ class ListGroupCest
/**
* @param ApplicationTester $I
*/
public function canEditSubGroupFromListView(ApplicationTester $I)
public function canEditSubGroupFromListView(ApplicationTester $I): void
{
$I->amGoingTo('test the subgroup edit form');
$groupname = $I->grabTextFrom('table.table-striped > tbody > tr:nth-child(2) > td:nth-child(3) > a:nth-child(1)');
......
......@@ -27,7 +27,7 @@ class ListUserCest
/**
* @param ApplicationTester $I
*/
public function _before(ApplicationTester $I)
public function _before(ApplicationTester $I): void
{
$I->useExistingSession('admin');
......@@ -40,7 +40,7 @@ class ListUserCest
/**
* @param ApplicationTester $I
*/
public function showsHeadingAndListsBackendUsers(ApplicationTester $I)
public function showsHeadingAndListsBackendUsers(ApplicationTester $I): void
{
$I->see('Backend User Listing');
......@@ -54,7 +54,7 @@ class ListUserCest
/**
* @param ApplicationTester $I
*/
public function filterUsersByUsername(ApplicationTester $I)
public function filterUsersByUsername(ApplicationTester $I): void
{
$I->wantTo('See the table of users');
$I->waitForElementVisible('#typo3-backend-user-list');
......@@ -83,7 +83,7 @@ class ListUserCest
/**
* @param ApplicationTester $I
*/
public function filterUsersByAdmin(ApplicationTester $I)
public function filterUsersByAdmin(ApplicationTester $I): void
{
$I->wantTo('See the table of users');
$I->waitForElementVisible('#typo3-backend-user-list');
......@@ -112,7 +112,7 @@ class ListUserCest
/**
* @param ApplicationTester $I
*/
public function filterUsersByStatus(ApplicationTester $I)
public function filterUsersByStatus(ApplicationTester $I): void
{
$I->wantTo('See the table of users');
$I->waitForElementVisible('#typo3-backend-user-list');
......@@ -141,7 +141,7 @@ class ListUserCest
/**
* @param ApplicationTester $I
*/
public function filterUsersByLogin(ApplicationTester $I)
public function filterUsersByLogin(ApplicationTester $I): void
{
$I->wantTo('See the table of users');
$I->waitForElementVisible('#typo3-backend-user-list');
......@@ -170,7 +170,7 @@ class ListUserCest
/**
* @param ApplicationTester $I
*/
public function filterUsersByUserGroup(ApplicationTester $I)
public function filterUsersByUserGroup(ApplicationTester $I): void
{
$I->wantTo('See the table of users');
$I->waitForElementVisible('#typo3-backend-user-list');
......@@ -191,7 +191,7 @@ class ListUserCest
/**
* @param ApplicationTester $I
*/
public function canEditUsersFromIndexListView(ApplicationTester $I)
public function canEditUsersFromIndexListView(ApplicationTester $I): void
{
$I->canSee('Backend User Listing', 'h1');
$username = $I->grabTextFrom('#typo3-backend-user-list > tbody > tr:nth-child(1) > td.col-title > a:nth-child(1) > b');
......@@ -213,7 +213,7 @@ class ListUserCest
* @param ApplicationTester $I
* @param int $countOfUsers
*/
private function checkCountOfUsers(ApplicationTester $I, int $countOfUsers)
private function checkCountOfUsers(ApplicationTester $I, int $countOfUsers): void
{
$I->canSeeNumberOfElements('#typo3-backend-user-list tbody tr', $countOfUsers);
$I->wantToTest('If a number of users is shown in the footer row');
......
......@@ -34,7 +34,7 @@ class DashboardModuleCest
/**
* @param ApplicationTester $I
*/
public function _before(ApplicationTester $I)
public function _before(ApplicationTester $I): void
{
$I->useExistingSession('admin');
$I->click('#dashboard');
......@@ -44,7 +44,7 @@ class DashboardModuleCest
/**
* @param ApplicationTester $I
*/
public function seeInitialDashboardAndWidgets(ApplicationTester $I)
public function seeInitialDashboardAndWidgets(ApplicationTester $I): void
{
$I->see(self::$defaultDashboardTitle, self::$dashboardActiveSelector);
$I->see('About TYPO3', self::$widgetTitleSelector);
......@@ -56,7 +56,7 @@ class DashboardModuleCest
* @param ApplicationTester $I
* @param ModalDialog $modalDialog
*/
public function createCustomDashboardAndWidgets(ApplicationTester $I, ModalDialog $modalDialog)
public function createCustomDashboardAndWidgets(ApplicationTester $I, ModalDialog $modalDialog): void
{
// Create Dashboard
$I->click('.dashboard-button-tab-add');
......@@ -81,7 +81,7 @@ class DashboardModuleCest
* @param ApplicationTester $I
* @param ModalDialog $modalDialog
*/
public function deleteDashboardAndWidgets(ApplicationTester $I, ModalDialog $modalDialog)
public function deleteDashboardAndWidgets(ApplicationTester $I, ModalDialog $modalDialog): void
{
// Delete widget
$I->click(self::$customDashboardTitle, '.dashboard-tabs');
......
......@@ -32,7 +32,7 @@ class DbCheckModuleCest
/**
* @param ApplicationTester $I
*/
public function _before(ApplicationTester $I)
public function _before(ApplicationTester $I): void
{
$I->useExistingSession('admin');
$I->click('#system_dbint');
......@@ -42,7 +42,7 @@ class DbCheckModuleCest
/**
* @param ApplicationTester $I
*/
public function seeOverview(ApplicationTester $I)
public function seeOverview(ApplicationTester $I): void
{
$I->see('Database integrity check', 'h1');
$I->see('Records Statistics', 'a');
......@@ -54,7 +54,7 @@ class DbCheckModuleCest
/**
* @param ApplicationTester $I
*/
public function seeRecordStatistics(ApplicationTester $I)
public function seeRecordStatistics(ApplicationTester $I): void
{
$this->goToPageAndSeeHeadline($I, 'Record Statistics', 'Records Statistics');
......@@ -68,7 +68,7 @@ class DbCheckModuleCest
/**
* @param ApplicationTester $I
*/
public function seeDatabaseRelations(ApplicationTester $I)
public function seeDatabaseRelations(ApplicationTester $I): void
{
$this->goToPageAndSeeHeadline($I, 'Database Relations', 'Relations');
$I->see('Select fields', 'h2');
......@@ -78,7 +78,7 @@ class DbCheckModuleCest
/**
* @param ApplicationTester $I
*/
public function seeFullSearch(ApplicationTester $I, ModalDialog $modalDialog)
public function seeFullSearch(ApplicationTester $I, ModalDialog $modalDialog): void
{
$this->goToPageAndSeeHeadline($I, 'Full search', 'Search whole Database');
$I->see('Search options', 'h2');
......@@ -100,7 +100,7 @@ class DbCheckModuleCest
/**
* @param ApplicationTester $I
*/
public function seeManageReferenceIndex(ApplicationTester $I)
public function seeManageReferenceIndex(ApplicationTester $I): void
{
$this->goToPageAndSeeHeadline($I, 'Manage Reference Index', 'Manage Reference Index');
......
......@@ -28,7 +28,7 @@ class GetExtensionsCest
/**
* @param ApplicationTester $I
*/
public function _before(ApplicationTester $I)
public function _before(ApplicationTester $I): void
{
$I->useExistingSession('admin');
......@@ -46,7 +46,7 @@ class GetExtensionsCest
/**
* @param ApplicationTester $I
*/
public function checkRetrievedExtensionsFromTerAreDisplayed(ApplicationTester $I)
public function checkRetrievedExtensionsFromTerAreDisplayed(ApplicationTester $I): void
{
$I->see('superext');
$I->see('neededext');
......@@ -55,7 +55,7 @@ class GetExtensionsCest
/**
* @param ApplicationTester $I
*/
public function checkPageBrowserDisplaysTwoRecords(ApplicationTester $I)
public function checkPageBrowserDisplaysTwoRecords(ApplicationTester $I): void
{
$I->seeElement('.pagination-wrap');
$I->see('Extensions 1 - 2');
......@@ -64,7 +64,7 @@ class GetExtensionsCest
/**
* @param ApplicationTester $I
*/
public function checkSearchFilterListFindsExtensionKey(ApplicationTester $I)
public function checkSearchFilterListFindsExtensionKey(ApplicationTester $I): void
{
$I->fillField('input[name="tx_extensionmanager_tools_extensionmanagerextensionmanager[search]"]', 'superext');
$I->click('Go');
......@@ -89,7 +89,7 @@ class GetExtensionsCest
/**
* @param ApplicationTester $I
*/
public function checkSearchFilterListFindsPartOfExtensionKey(ApplicationTester $I)
public function checkSearchFilterListFindsPartOfExtensionKey(ApplicationTester $I): void
{
$I->fillField('input[name="tx_extensionmanager_tools_extensionmanagerextensionmanager[search]"]', 'ext');
$I->click('Go');
......
......@@ -27,7 +27,7 @@ class InstalledExtensionsCest
/**
* @param ApplicationTester $I
*/
public function _before(ApplicationTester $I)
public function _before(ApplicationTester $I): void
{
$I->useExistingSession('admin');
......@@ -39,7 +39,7 @@ class InstalledExtensionsCest
/**
* @param ApplicationTester $I
*/
public function checkSearchFiltersList(ApplicationTester $I)
public function checkSearchFiltersList(ApplicationTester $I): void
{
$I->seeNumberOfElements('#typo3-extension-list tbody tr[role="row"]', [10, 100]);
......@@ -63,7 +63,7 @@ class InstalledExtensionsCest
/**
* @param ApplicationTester $I
*/
public function checkIfUploadFormAppears(ApplicationTester $I)
public function checkIfUploadFormAppears(ApplicationTester $I): void
{
$I->cantSeeElement('.module-body .extension-upload-form');
$I->click('a[title="Upload Extension .t3x/.zip"]', '.module-docheader');
......@@ -73,7 +73,7 @@ class InstalledExtensionsCest
/**
* @param ApplicationTester $I
*/
public function checkUninstallingAndInstallingAnExtension(ApplicationTester $I)
public function checkUninstallingAndInstallingAnExtension(ApplicationTester $I): void
{
$I->wantTo('Check if uninstalling and installing an extension with backend module removes and adds the module from the module menu.');
$I->amGoingTo('uninstall extension belog');
......
......@@ -30,7 +30,7 @@ abstract class AbstractFileCest
/**
* @param ApplicationTester $I
*/
public function _before(ApplicationTester $I, FileTree $tree)
public function _before(ApplicationTester $I, FileTree $tree): void
{
$I->useExistingSession('admin');
$I->amOnPage('/typo3/module/file/FilelistList');
......
......@@ -31,7 +31,7 @@ class FileClipboardCest extends AbstractFileCest
/**
* @param ApplicationTester $I
*/
public function _before(ApplicationTester $I, FileTree $tree)
public function _before(ApplicationTester $I, FileTree $tree): void
{
parent::_before($I, $tree);
$I->click('#checkClipBoard');
......@@ -40,7 +40,7 @@ class FileClipboardCest extends AbstractFileCest
/**
* @param ApplicationTester $I
*/
public function seeSwitchModes(ApplicationTester $I)
public function seeSwitchModes(ApplicationTester $I): void
{
$I->seeCheckboxIsChecked($this->copyModeMove);
$I->dontSeeCheckboxIsChecked($this->copyModeCopy);
......@@ -52,7 +52,7 @@ class FileClipboardCest extends AbstractFileCest
/**
* @param ApplicationTester $I
*/
public function seeAddRemoveSingleRecord(ApplicationTester $I)
public function seeAddRemoveSingleRecord(ApplicationTester $I): void
{
$fileName = 'bus_lane.jpg';
$I->switchToMainFrame();
......@@ -67,7 +67,7 @@ class FileClipboardCest extends AbstractFileCest
/**
* @param ApplicationTester $I
*/
public function seeAddRemoveMultipleRecords(ApplicationTester $I)
public function seeAddRemoveMultipleRecords(ApplicationTester $I): void
{
$expectedFiles = ['bus_lane.jpg', 'telephone_box.jpg', 'underground.jpg'];
......
......@@ -27,7 +27,7 @@ class FileMetaDataCest
/**
* @param ApplicationTester $I
*/
public function _before(ApplicationTester $I)
public function _before(ApplicationTester $I): void
{
$I->useExistingSession('admin');
}
......@@ -35,7 +35,7 @@ class FileMetaDataCest
/**
* @param ApplicationTester $I
*/
public function metaDataCanBeEdited(ApplicationTester $I)
public function metaDataCanBeEdited(ApplicationTester $I): void
{
$I->wantToTest('Metadata can be edited through search list results');
$I->click('Filelist');
......
......@@ -28,7 +28,7 @@ class FileOperationsCest extends AbstractFileCest
/**
* @param ApplicationTester $I
*/
public function fileCrud(ApplicationTester $I, ModalDialog $modalDialog)
public function fileCrud(ApplicationTester $I, ModalDialog $modalDialog): void
{
$fileTextareaSelector = 'textarea[name="data[editfile][0][data]"]';
$fileName = 'typo3-test.txt';
......@@ -72,7 +72,7 @@ class FileOperationsCest extends AbstractFileCest
* @param ApplicationTester $I
* @throws \Exception
*/
public function seeUploadFile(ApplicationTester $I)
public function seeUploadFile(ApplicationTester $I): void
{
$alertContainer = '#alert-container';
$fileName = 'blue_mountains.jpg';
......
......@@ -28,7 +28,7 @@ class FileStorageTreeFilterCest
protected string $withinTree = '#typo3-filestoragetree .nodes';
protected string $newSubfolder = 'random_subfolder';
public function _before(ApplicationTester $I, FileTree $tree)
public function _before(ApplicationTester $I, FileTree $tree): void
{
$I->useExistingSession('admin');
$I->click('Filelist');
......@@ -39,7 +39,7 @@ class FileStorageTreeFilterCest
$this->createNewFolder($I);
}
public function filterTreeForFolder(ApplicationTester $I)
public function filterTreeForFolder(ApplicationTester $I): void
{
$I->cantSeeElement($this->filterInputFieldClearButton);
......@@ -61,7 +61,7 @@ class FileStorageTreeFilterCest
$I->seeInField($this->filterInputField, 'styleguide');
}
public function clearFilterReloadsTreeWithoutFilterApplied(ApplicationTester $I)
public function clearFilterReloadsTreeWithoutFilterApplied(ApplicationTester $I): void
{
$I->fillField($this->filterInputField, 'styleguide');
$this->waitForAjaxRequestToFinish($I);
......
......@@ -37,7 +37,7 @@ abstract class AbstractElementsBasicCest
* @param Example $testData
* @throws \Exception
*/
protected function runInputFieldTest(ApplicationTester $I, Example $testData)
protected function runInputFieldTest(ApplicationTester $I, Example $testData): void
{
$fieldLabel = $testData['label'];
$initializedInputFieldXpath = '(//label/code[contains(text(),"[' . $fieldLabel . ']")]/..)'
......@@ -87,10 +87,10 @@ abstract class AbstractElementsBasicCest
/**
* Return the visible input field of element in question.
*
* @param $formSection
* @param RemoteWebElement $formSection
* @return RemoteWebElement
*/
protected function getInputField(RemoteWebElement $formSection)
protected function getInputField(RemoteWebElement $formSection): RemoteWebElement
{
return $formSection->findElement(\Facebook\WebDriver\WebDriverBy::xpath('.//*/input[@data-formengine-input-name]'));
}
......@@ -102,7 +102,7 @@ abstract class AbstractElementsBasicCest
* @param RemoteWebElement $inputField
* @return RemoteWebElement
*/
protected function getHiddenField(RemoteWebElement $formSection, RemoteWebElement $inputField)
protected function getHiddenField(RemoteWebElement $formSection, RemoteWebElement $inputField): RemoteWebElement
{
$hiddenFieldXPath = './/*/input[@name="' . $inputField->getAttribute('data-formengine-input-name') . '"]';
return $formSection->findElement(\Facebook\WebDriver\WebDriverBy::xpath($hiddenFieldXPath));
......@@ -115,7 +115,7 @@ abstract class AbstractElementsBasicCest
* @param string $fieldLabel
* @return RemoteWebElement
*/
protected function getFormSectionByFieldLabel(ApplicationTester $I, string $fieldLabel)
protected function getFormSectionByFieldLabel(ApplicationTester $I, string $fieldLabel): RemoteWebElement
{
$I->comment('Get context for field "' . $fieldLabel . '"');
return $I->executeInSelenium(
......@@ -134,7 +134,7 @@ abstract class AbstractElementsBasicCest
* @param string $tabTitle the tab you want to click. If necessary, several attempts are made
* @param string $referenceField one field that is available to receive a click. Will be used to scroll up from there.
*/
protected function ensureTopOfFrameIsUsedAndClickTab(ApplicationTester $I, string $tabTitle, string $referenceField)
protected function ensureTopOfFrameIsUsedAndClickTab(ApplicationTester $I, string $tabTitle, string $referenceField): void
{
try {
$I->click($tabTitle);
......@@ -144,7 +144,7 @@ abstract class AbstractElementsBasicCest
}
}
protected function scrollToTopOfFrame(ApplicationTester $I, string $tabTitle, string $referenceField)
protected function scrollToTopOfFrame(ApplicationTester $I, string $tabTitle, string $referenceField): void
{
$formSection = $this->getFormSectionByFieldLabel($I, $referenceField);
$field = $this->getInputField($formSection);
......
......@@ -27,7 +27,7 @@ class CategoryTreeCest
/**
* @param ApplicationTester $I
*/
public function _before(ApplicationTester $I)
public function _before(ApplicationTester $I): void
{
$I->useExistingSession('admin');
}
......@@ -35,7 +35,7 @@ class CategoryTreeCest
/**
* @param ApplicationTester $I
*/
public function checkIfCategoryListIsAvailable(ApplicationTester $I)
public function checkIfCategoryListIsAvailable(ApplicationTester $I): void
{
// A sub-element of web module is show
$I->waitForElementVisible('#web + .modulemenu-group-container .modulemenu-action');
......@@ -48,7 +48,7 @@ class CategoryTreeCest
/**
* @param ApplicationTester $I
*/
public function editCategoryItem(ApplicationTester $I)
public function editCategoryItem(ApplicationTester $I): void
{
// A sub-element of web module is show
$I->waitForElementVisible('#web + .modulemenu-group-container .modulemenu-action');
......
......@@ -33,7 +33,7 @@ class ElementsBasicInputDateCest extends AbstractElementsBasicCest
* @param PageTree $pageTree
* @throws \Exception
*/
public function _before(ApplicationTester $I, PageTree $pageTree)
public function _before(ApplicationTester $I, PageTree $pageTree): void
{
$I->useExistingSession('admin');
......@@ -59,7 +59,7 @@ class ElementsBasicInputDateCest extends AbstractElementsBasicCest
/**
* dbTypeDateEvalDate data provider
*/
protected function dbTypeDateEvalDateDataProvider()
protected function dbTypeDateEvalDateDataProvider(): array
{
return [
[
......@@ -95,7 +95,7 @@ class ElementsBasicInputDateCest extends AbstractElementsBasicCest
* @param Example $testData
* @throws \Exception
*/
public function dbTypeDateEvalDate(ApplicationTester $I, Example $testData)
public function dbTypeDateEvalDate(ApplicationTester $I, Example $testData): void
{
$this->runInputFieldTest($I, $testData);
}
......@@ -103,7 +103,7 @@ class ElementsBasicInputDateCest extends AbstractElementsBasicCest
/**
* dbType date eval datetime data provider
*/
protected function dbTypeDateEvalDatetimeDataProvider()
protected function dbTypeDateEvalDatetimeDataProvider(): array
{
return [
[
......@@ -139,7 +139,7 @@ class ElementsBasicInputDateCest extends AbstractElementsBasicCest
* @param Example $testData
* @throws \Exception
*/
public function dbTypeDateEvalDatetime(ApplicationTester $I, Example $testData)
public function dbTypeDateEvalDatetime(ApplicationTester $I, Example $testData): void
{
$this->runInputFieldTest($I, $testData);
}
......@@ -147,7 +147,7 @@ class ElementsBasicInputDateCest extends AbstractElementsBasicCest
/**
* db type date eval time data provider
*/
protected function dbTypeDateEvalTimeDataProvider()
protected function dbTypeDateEvalTimeDataProvider(): array
{
return [
[
......@@ -167,7 +167,7 @@ class ElementsBasicInputDateCest extends AbstractElementsBasicCest
* @param Example $testData
* @throws \Exception
*/
public function dbTypeDateEvalTime(ApplicationTester $I, Example $testData)
public function dbTypeDateEvalTime(ApplicationTester $I, Example $testData): void
{
$this->runInputFieldTest($I, $testData);
}
......@@ -175,7 +175,7 @@ class ElementsBasicInputDateCest extends AbstractElementsBasicCest
/**
* db type date eval time data provider
*/
protected function dbTypeDateEvalTimeDataProvider_DbTypeDateTime()
protected function dbTypeDateEvalTimeDataProvider_DbTypeDateTime(): array
{
return [
[
......@@ -211,7 +211,7 @@ class ElementsBasicInputDateCest extends AbstractElementsBasicCest
* @param Example $testData
* @throws \Exception
*/
public function checkThatValidationWorks_EvalDateTime_DbTypeDateTime(ApplicationTester $I, Example $testData)
public function checkThatValidationWorks_EvalDateTime_DbTypeDateTime(ApplicationTester $I, Example $testData): void
{
$this->runInputFieldTest($I, $testData);
}
......
......@@ -32,7 +32,7 @@ class ElementsBasicInputEvalCest extends AbstractElementsBasicCest
* @param ApplicationTester $I
* @param PageTree $pageTree
*/
public function _before(ApplicationTester $I, PageTree $pageTree)
public function _before(ApplicationTester $I, PageTree $pageTree): void
{
$I->useExistingSession('admin');
$I->click('List');
......@@ -54,7 +54,7 @@ class ElementsBasicInputEvalCest extends AbstractElementsBasicCest
/**
* Test various type=input fields having eval
*/
protected function simpleEvalInputFieldsDataProvider()
protected function simpleEvalInputFieldsDataProvider(): array
{
return [
[
......@@ -172,7 +172,7 @@ class ElementsBasicInputEvalCest extends AbstractElementsBasicCest
* @param ApplicationTester $I
* @param Example $testData
*/
public function simpleEvalInputFields(ApplicationTester $I, Example $testData)
public function simpleEvalInputFields(ApplicationTester $I, Example $testData): void
{
$this->runInputFieldTest($I, $testData);