Skip to content

Commit

Permalink
[TASK] Drop two unit tests that heavily rely on environment
Browse files Browse the repository at this point in the history
* The file permission related LocalDriverTest basically test
  getPermissions() that is a set of native PHP methods that
  are hard to mock properly and don't need to be tested in
  our application.

* The DateViewHelperTest relies on a working locale which
  fails on some environments and gives no error output if
  it fails.

Resolves: #93400
Releases: master, 10.4, 9.5
Change-Id: I9521e8275d6a6461a902f07caee0444a73da8927
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/67616
Tested-by: TYPO3com <[email protected]>
Tested-by: Andreas Fernandez <[email protected]>
Reviewed-by: Andreas Fernandez <[email protected]>
  • Loading branch information
lolli42 authored and andreaskienast committed Feb 1, 2021
1 parent cf0f106 commit 2c9eb33
Showing 1 changed file with 0 additions and 49 deletions.
49 changes: 0 additions & 49 deletions Tests/Unit/ViewHelpers/Format/DateViewHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -432,53 +432,4 @@ public function viewHelperRespectsDefaultTimezoneForStringTimestamp($timeZone, $
$actualResult = $this->viewHelper->initializeArgumentsAndRender();
$this->assertEquals($expected, $actualResult);
}

/**
* Data provider for dateViewHelperFormatsDateLocalizedDataProvider
*
* @return array
*/
public function dateViewHelperFormatsDateLocalizedDataProvider()
{
return [
'de_DE.UTF-8' => [
'de_DE.UTF-8',
'03. Februar 2013'
],
'en_ZW.utf8' => [
'en_ZW.utf8',
'03. February 2013'
]
];
}

/**
* @dataProvider dateViewHelperFormatsDateLocalizedDataProvider
*
* @test
*/
public function dateViewHelperFormatsDateLocalized($locale, $expected)
{
$format = '%d. %B %Y';
// 2013-02-03 11:40 UTC
$timestamp = '@1359891658';

try {
$this->setLocale(LC_COLLATE, $locale);
$this->setLocale(LC_CTYPE, $locale);
$this->setLocale(LC_MONETARY, $locale);
$this->setLocale(LC_TIME, $locale);
} catch (\PHPUnit\Framework\Exception $e) {
$this->markTestSkipped('Locale ' . $locale . ' is not available.');
}
$this->setArgumentsUnderTest(
$this->viewHelper,
[
'date' => $timestamp,
'format' => $format
]
);
$actualResult = $this->viewHelper->initializeArgumentsAndRender();
$this->assertEquals($expected, $actualResult);
}
}

0 comments on commit 2c9eb33

Please sign in to comment.