Commit ccaa33a2 authored by Anja Leichsenring's avatar Anja Leichsenring Committed by Andreas Fernandez
Browse files

[TASK] Prepare core tests for phpunit v8

Resolves: #88335
Releases: master, 9.5
Change-Id: I40569702c9cec50aa9150c666488c7a71c28b47b
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/60732

Tested-by: Frank Nägler's avatarFrank Naegler <frank.naegler@typo3.org>
Tested-by: default avatarTYPO3com <noreply@typo3.com>
Tested-by: Andreas Fernandez's avatarAndreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Frank Nägler's avatarFrank Naegler <frank.naegler@typo3.org>
Reviewed-by: Andreas Fernandez's avatarAndreas Fernandez <a.fernandez@scripting-base.de>
parent 1c46278f
......@@ -24,7 +24,7 @@ class PreviewModuleTest extends UnitTestCase
(new \DateTime('2018-01-01 12:00:00 UTC'))->getTimestamp(),
],
'timestamp' => [
(new \DateTime('2018-01-01 12:00:15 UTC'))->getTimestamp(),
(string)(new \DateTime('2018-01-01 12:00:15 UTC'))->getTimestamp(),
(int)(new \DateTime('2018-01-01 12:00:15 UTC'))->getTimestamp(),
(int)(new \DateTime('2018-01-01 12:00:00 UTC'))->getTimestamp(),
],
......
......@@ -18,7 +18,7 @@ class ConfigurationServiceTest extends UnitTestCase
*/
protected $beUserProphecy;
public function setUp()
public function setUp(): void
{
parent::setUp();
$this->beUserProphecy = $this->prophesize(BackendUserAuthentication::class);
......
......@@ -41,7 +41,7 @@ class FormInlineAjaxControllerTest extends FunctionalTestCase
/**
* Sets up this test case.
*/
protected function setUp()
protected function setUp(): void
{
parent::setUp();
......
......@@ -34,8 +34,8 @@ class EditRecordViewHelperTest extends FunctionalTestCase
$view->setTemplatePathAndFilename('EXT:backend/Tests/Functional/ViewHelpers/Fixtures/Link/EditRecordViewHelper/WithUidAndTable.html');
$result = urldecode($view->render());
$this->assertContains('route=/record/edit', $result);
$this->assertContains('edit[a_table][42]=edit', $result);
$this->assertStringContainsString('route=/record/edit', $result);
$this->assertStringContainsString('edit[a_table][42]=edit', $result);
}
/**
......@@ -47,8 +47,8 @@ class EditRecordViewHelperTest extends FunctionalTestCase
$view->setTemplatePathAndFilename('EXT:backend/Tests/Functional/ViewHelpers/Fixtures/Link/EditRecordViewHelper/InlineWithUidAndTable.html');
$result = urldecode($view->render());
$this->assertContains('route=/record/edit', $result);
$this->assertContains('edit[b_table][21]=edit', $result);
$this->assertStringContainsString('route=/record/edit', $result);
$this->assertStringContainsString('edit[b_table][21]=edit', $result);
}
/**
......@@ -60,9 +60,9 @@ class EditRecordViewHelperTest extends FunctionalTestCase
$view->setTemplatePathAndFilename('EXT:backend/Tests/Functional/ViewHelpers/Fixtures/Link/EditRecordViewHelper/WithUidTableAndReturnUrl.html');
$result = urldecode($view->render());
$this->assertContains('route=/record/edit', $result);
$this->assertContains('edit[c_table][43]=edit', $result);
$this->assertContains('returnUrl=foo/bar', $result);
$this->assertStringContainsString('route=/record/edit', $result);
$this->assertStringContainsString('edit[c_table][43]=edit', $result);
$this->assertStringContainsString('returnUrl=foo/bar', $result);
}
/**
......
......@@ -34,8 +34,8 @@ class NewRecordViewHelperTest extends FunctionalTestCase
$view->setTemplatePathAndFilename('EXT:backend/Tests/Functional/ViewHelpers/Fixtures/Link/NewRecordViewHelper/WithPidAndTable.html');
$result = urldecode($view->render());
$this->assertContains('route=/record/edit', $result);
$this->assertContains('edit[a_table][17]=new', $result);
$this->assertStringContainsString('route=/record/edit', $result);
$this->assertStringContainsString('edit[a_table][17]=new', $result);
}
/**
......@@ -47,8 +47,8 @@ class NewRecordViewHelperTest extends FunctionalTestCase
$view->setTemplatePathAndFilename('EXT:backend/Tests/Functional/ViewHelpers/Fixtures/Link/NewRecordViewHelper/WithTable.html');
$result = urldecode($view->render());
$this->assertContains('route=/record/edit', $result);
$this->assertContains('edit[a_table][0]=new', $result);
$this->assertStringContainsString('route=/record/edit', $result);
$this->assertStringContainsString('edit[a_table][0]=new', $result);
}
/**
......@@ -60,8 +60,8 @@ class NewRecordViewHelperTest extends FunctionalTestCase
$view->setTemplatePathAndFilename('EXT:backend/Tests/Functional/ViewHelpers/Fixtures/Link/NewRecordViewHelper/InlineWithPidAndTable.html');
$result = urldecode($view->render());
$this->assertContains('route=/record/edit', $result);
$this->assertContains('edit[b_table][17]=new', $result);
$this->assertStringContainsString('route=/record/edit', $result);
$this->assertStringContainsString('edit[b_table][17]=new', $result);
}
/**
......@@ -73,9 +73,9 @@ class NewRecordViewHelperTest extends FunctionalTestCase
$view->setTemplatePathAndFilename('EXT:backend/Tests/Functional/ViewHelpers/Fixtures/Link/NewRecordViewHelper/WithPidTableAndReturnUrl.html');
$result = urldecode($view->render());
$this->assertContains('route=/record/edit', $result);
$this->assertContains('edit[c_table][17]=new', $result);
$this->assertContains('returnUrl=foo/bar', $result);
$this->assertStringContainsString('route=/record/edit', $result);
$this->assertStringContainsString('edit[c_table][17]=new', $result);
$this->assertStringContainsString('returnUrl=foo/bar', $result);
}
/**
......@@ -87,8 +87,8 @@ class NewRecordViewHelperTest extends FunctionalTestCase
$view->setTemplatePathAndFilename('EXT:backend/Tests/Functional/ViewHelpers/Fixtures/Link/NewRecordViewHelper/WithNegativeUid.html');
$result = urldecode($view->render());
$this->assertContains('route=/record/edit', $result);
$this->assertContains('edit[c_table][-11]=new', $result);
$this->assertStringContainsString('route=/record/edit', $result);
$this->assertStringContainsString('edit[c_table][-11]=new', $result);
}
/**
......
......@@ -34,8 +34,8 @@ class EditRecordViewHelperTest extends FunctionalTestCase
$view->setTemplatePathAndFilename('EXT:backend/Tests/Functional/ViewHelpers/Fixtures/Uri/EditRecordViewHelper/WithUidAndTable.html');
$result = urldecode($view->render());
$this->assertContains('route=/record/edit', $result);
$this->assertContains('edit[a_table][42]=edit', $result);
$this->assertStringContainsString('route=/record/edit', $result);
$this->assertStringContainsString('edit[a_table][42]=edit', $result);
}
/**
......@@ -47,8 +47,8 @@ class EditRecordViewHelperTest extends FunctionalTestCase
$view->setTemplatePathAndFilename('EXT:backend/Tests/Functional/ViewHelpers/Fixtures/Uri/EditRecordViewHelper/InlineWithUidAndTable.html');
$result = urldecode($view->render());
$this->assertContains('route=/record/edit', $result);
$this->assertContains('edit[b_table][21]=edit', $result);
$this->assertStringContainsString('route=/record/edit', $result);
$this->assertStringContainsString('edit[b_table][21]=edit', $result);
}
/**
......@@ -60,9 +60,9 @@ class EditRecordViewHelperTest extends FunctionalTestCase
$view->setTemplatePathAndFilename('EXT:backend/Tests/Functional/ViewHelpers/Fixtures/Uri/EditRecordViewHelper/WithUidTableAndReturnUrl.html');
$result = urldecode($view->render());
$this->assertContains('route=/record/edit', $result);
$this->assertContains('edit[c_table][43]=edit', $result);
$this->assertContains('returnUrl=foo/bar', $result);
$this->assertStringContainsString('route=/record/edit', $result);
$this->assertStringContainsString('edit[c_table][43]=edit', $result);
$this->assertStringContainsString('returnUrl=foo/bar', $result);
}
/**
......
......@@ -34,8 +34,8 @@ class NewRecordViewHelperTest extends FunctionalTestCase
$view->setTemplatePathAndFilename('EXT:backend/Tests/Functional/ViewHelpers/Fixtures/Uri/NewRecordViewHelper/WithPidAndTable.html');
$result = urldecode($view->render());
$this->assertContains('route=/record/edit', $result);
$this->assertContains('edit[a_table][17]=new', $result);
$this->assertStringContainsString('route=/record/edit', $result);
$this->assertStringContainsString('edit[a_table][17]=new', $result);
}
/**
......@@ -47,8 +47,8 @@ class NewRecordViewHelperTest extends FunctionalTestCase
$view->setTemplatePathAndFilename('EXT:backend/Tests/Functional/ViewHelpers/Fixtures/Uri/NewRecordViewHelper/WithTable.html');
$result = urldecode($view->render());
$this->assertContains('route=/record/edit', $result);
$this->assertContains('edit[a_table][0]=new', $result);
$this->assertStringContainsString('route=/record/edit', $result);
$this->assertStringContainsString('edit[a_table][0]=new', $result);
}
/**
......@@ -60,8 +60,8 @@ class NewRecordViewHelperTest extends FunctionalTestCase
$view->setTemplatePathAndFilename('EXT:backend/Tests/Functional/ViewHelpers/Fixtures/Uri/NewRecordViewHelper/InlineWithPidAndTable.html');
$result = urldecode($view->render());
$this->assertContains('route=/record/edit', $result);
$this->assertContains('edit[b_table][17]=new', $result);
$this->assertStringContainsString('route=/record/edit', $result);
$this->assertStringContainsString('edit[b_table][17]=new', $result);
}
/**
......@@ -73,9 +73,9 @@ class NewRecordViewHelperTest extends FunctionalTestCase
$view->setTemplatePathAndFilename('EXT:backend/Tests/Functional/ViewHelpers/Fixtures/Uri/NewRecordViewHelper/WithPidTableAndReturnUrl.html');
$result = urldecode($view->render());
$this->assertContains('route=/record/edit', $result);
$this->assertContains('edit[c_table][17]=new', $result);
$this->assertContains('returnUrl=foo/bar', $result);
$this->assertStringContainsString('route=/record/edit', $result);
$this->assertStringContainsString('edit[c_table][17]=new', $result);
$this->assertStringContainsString('returnUrl=foo/bar', $result);
}
/**
......@@ -87,8 +87,8 @@ class NewRecordViewHelperTest extends FunctionalTestCase
$view->setTemplatePathAndFilename('EXT:backend/Tests/Functional/ViewHelpers/Fixtures/Uri/NewRecordViewHelper/WithNegativeUid.html');
$result = urldecode($view->render());
$this->assertContains('route=/record/edit', $result);
$this->assertContains('edit[c_table][-11]=new', $result);
$this->assertStringContainsString('route=/record/edit', $result);
$this->assertStringContainsString('edit[c_table][-11]=new', $result);
}
/**
......
......@@ -37,7 +37,7 @@ class BackendUserConfigurationTest extends UnitTestCase
/**
* Set up this testcase
*/
protected function setUp()
protected function setUp(): void
{
/** @var BackendUserAuthentication|\Prophecy\Prophecy\ObjectProphecy */
$this->backendUser = $this->prophesize(BackendUserAuthentication::class);
......
......@@ -57,7 +57,7 @@ class FileControllerTest extends UnitTestCase
/**
* Sets up this test case.
*/
protected function setUp()
protected function setUp(): void
{
$this->fileResourceMock = $this->getMockBuilder(\TYPO3\CMS\Core\Resource\File::class)
->setMethods(['toArray', 'getModificationTime', 'getExtension'])
......
......@@ -41,7 +41,7 @@ class ThumbnailControllerTest extends UnitTestCase
],
];
protected function setUp()
protected function setUp(): void
{
$GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey']
= '4408d27a916d51e624b69af3554f516dbab61037a9f7b9fd6f81b4d3bedeccb6';
......
......@@ -52,7 +52,7 @@ class LoginControllerTest extends UnitTestCase
/**
* @throws \InvalidArgumentException
*/
protected function setUp()
protected function setUp(): void
{
$this->loginControllerMock = $this->getAccessibleMock(LoginController::class, ['dummy'], [], '', false);
}
......
......@@ -82,7 +82,7 @@ class PaletteAndSingleContainerTest extends UnitTestCase
$nodeFactoryProphecy->create($expectedChildDataArray)->willReturn($singleFieldContainerProphecy->reveal());
$containerResult = (new PaletteAndSingleContainer($nodeFactoryProphecy->reveal(), $input))->render();
// Expect label is in answer HTML
$this->assertContains($labelReference, $containerResult['html']);
$this->assertStringContainsString($labelReference, $containerResult['html']);
}
/**
......@@ -140,7 +140,7 @@ class PaletteAndSingleContainerTest extends UnitTestCase
$nodeFactoryProphecy->create($expectedChildDataArray)->willReturn($singleFieldContainerProphecy->reveal());
$containerResult = (new PaletteAndSingleContainer($nodeFactoryProphecy->reveal(), $input))->render();
// Expect label is in answer HTML
$this->assertContains($labelReference, $containerResult['html']);
$this->assertStringContainsString($labelReference, $containerResult['html']);
}
/**
......@@ -199,6 +199,6 @@ class PaletteAndSingleContainerTest extends UnitTestCase
$nodeFactoryProphecy->create($expectedChildDataArray)->willReturn($singleFieldContainerProphecy->reveal());
$containerResult = (new PaletteAndSingleContainer($nodeFactoryProphecy->reveal(), $input))->render();
// Expect label is in answer HTML
$this->assertContains($labelReferenceFieldArray, $containerResult['html']);
$this->assertStringContainsString($labelReferenceFieldArray, $containerResult['html']);
}
}
......@@ -41,7 +41,7 @@ class InputDateTimeElementTest extends UnitTestCase
* current timezone setting, set it to UTC explicitly and reconstitute it
* again in tearDown()
*/
protected function setUp()
protected function setUp(): void
{
$this->timezoneBackup = date_default_timezone_get();
}
......@@ -49,7 +49,7 @@ class InputDateTimeElementTest extends UnitTestCase
/**
* Tear down
*/
protected function tearDown()
protected function tearDown(): void
{
date_default_timezone_set($this->timezoneBackup);
parent::tearDown();
......@@ -133,6 +133,6 @@ class InputDateTimeElementTest extends UnitTestCase
$GLOBALS['LANG'] = $languageService->reveal();
$subject = new InputDateTimeElement($nodeFactoryProphecy->reveal(), $data);
$result = $subject->render();
$this->assertContains('<input type="hidden" name="myItemFormElName" value="' . $expectedOutput . '" />', $result['html']);
$this->assertStringContainsString('<input type="hidden" name="myItemFormElName" value="' . $expectedOutput . '" />', $result['html']);
}
}
......@@ -37,8 +37,8 @@ class InputHiddenElementTest extends UnitTestCase
$subject->_set('data', $data);
$result = $subject->render();
$additionalHiddenFieldsResult = array_pop($result['additionalHiddenFields']);
$this->assertContains('name="foo"', $additionalHiddenFieldsResult);
$this->assertContains('value="bar"', $additionalHiddenFieldsResult);
$this->assertContains('type="hidden"', $additionalHiddenFieldsResult);
$this->assertStringContainsString('name="foo"', $additionalHiddenFieldsResult);
$this->assertStringContainsString('value="bar"', $additionalHiddenFieldsResult);
$this->assertStringContainsString('type="hidden"', $additionalHiddenFieldsResult);
}
}
......@@ -35,7 +35,7 @@ class FormDataCompilerTest extends UnitTestCase
*/
protected $formDataGroupProphecy;
protected function setUp()
protected function setUp(): void
{
$this->formDataGroupProphecy = $this->prophesize(FormDataGroupInterface::class);
$this->subject = new FormDataCompiler($this->formDataGroupProphecy->reveal());
......
......@@ -32,7 +32,7 @@ class FlexFormSegmentTest extends UnitTestCase
*/
protected $subject;
protected function setUp()
protected function setUp(): void
{
$this->subject = new FlexFormSegment();
}
......
......@@ -31,7 +31,7 @@ class OnTheFlyTest extends UnitTestCase
*/
protected $subject;
protected function setUp()
protected function setUp(): void
{
$this->subject = new OnTheFly();
}
......
......@@ -34,7 +34,7 @@ class SiteConfigurationTest extends UnitTestCase
*/
protected $subject;
protected function setUp()
protected function setUp(): void
{
$this->subject = new SiteConfigurationDataGroup();
}
......
......@@ -32,7 +32,7 @@ class TcaDatabaseRecordTest extends UnitTestCase
*/
protected $subject;
protected function setUp()
protected function setUp(): void
{
$this->subject = new TcaDatabaseRecord();
}
......
......@@ -32,7 +32,7 @@ class TcaInputPlaceholderRecordTest extends UnitTestCase
*/
protected $subject;
protected function setUp()
protected function setUp(): void
{
$this->subject = new TcaInputPlaceholderRecord();
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment