summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2018-03-12 14:23:53 +0100
committerMorris Jobke <hey@morrisjobke.de>2018-03-12 15:16:52 +0100
commit44289ff134e9387bf2bce70f1d716b0e924f2021 (patch)
treed3c62559bb1769b8ff9d1c62cfbf8351c42a0b66 /tests
parentaf89db3407e599ea47d62a851759fa929cdd4713 (diff)
downloadnextcloud-server-44289ff134e9387bf2bce70f1d716b0e924f2021.tar.gz
nextcloud-server-44289ff134e9387bf2bce70f1d716b0e924f2021.zip
Use proper method to format absolute timestamp
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/UtilTest.php64
1 files changed, 0 insertions, 64 deletions
diff --git a/tests/lib/UtilTest.php b/tests/lib/UtilTest.php
index 037736bf00f..18d065c68d6 100644
--- a/tests/lib/UtilTest.php
+++ b/tests/lib/UtilTest.php
@@ -38,70 +38,6 @@ class UtilTest extends \Test\TestCase {
$this->assertTrue(is_string($edition));
}
- /**
- * @group DB
- */
- function testFormatDate() {
- date_default_timezone_set("UTC");
-
- $result = OC_Util::formatDate(1350129205);
- $expected = 'October 13, 2012 at 11:53:25 AM GMT+0';
- $this->assertEquals($expected, $result);
-
- $result = OC_Util::formatDate(1102831200, true);
- $expected = 'December 12, 2004';
- $this->assertEquals($expected, $result);
- }
-
- /**
- * @group DB
- */
- function testFormatDateWithTZ() {
- date_default_timezone_set("UTC");
-
- $result = OC_Util::formatDate(1350129205, false, 'Europe/Berlin');
- $expected = 'October 13, 2012 at 1:53:25 PM GMT+2';
- $this->assertEquals($expected, $result);
- }
-
- /**
- * @expectedException \Exception
- */
- function testFormatDateWithInvalidTZ() {
- OC_Util::formatDate(1350129205, false, 'Mordor/Barad-dûr');
- }
-
- public function formatDateWithTZFromSessionData() {
- return array(
- array(3, 'October 13, 2012 at 2:53:25 PM GMT+3', 'Etc/GMT-3'),
- array(15, 'October 13, 2012 at 11:53:25 AM GMT+0', 'UTC'),
- array(-13, 'October 13, 2012 at 11:53:25 AM GMT+0', 'UTC'),
- array(9.5, 'October 13, 2012 at 9:23:25 PM GMT+9:30', 'Australia/Darwin'),
- array(-4.5, 'October 13, 2012 at 7:23:25 AM GMT-4:30', 'America/Caracas'),
- array(15.5, 'October 13, 2012 at 11:53:25 AM GMT+0', 'UTC'),
- );
- }
-
- /**
- * @dataProvider formatDateWithTZFromSessionData
- * @group DB
- */
- function testFormatDateWithTZFromSession($offset, $expected, $expectedTimeZone) {
- date_default_timezone_set("UTC");
-
- \OC::$server->getSession()->set('timezone', $offset);
-
- $selectedTimeZone = \OC::$server->getDateTimeZone()->getTimeZone(1350129205);
- $this->assertEquals($expectedTimeZone, $selectedTimeZone->getName());
- $newDateTimeFormatter = new \OC\DateTimeFormatter($selectedTimeZone, \OC::$server->getL10N('lib', 'en'));
- $this->overwriteService('DateTimeFormatter', $newDateTimeFormatter);
-
- $result = OC_Util::formatDate(1350129205, false);
- $this->assertEquals($expected, $result);
-
- $this->restoreService('DateTimeFormatter');
- }
-
function testSanitizeHTML() {
$badArray = [
'While it is unusual to pass an array',