summaryrefslogtreecommitdiffstats
path: root/tests/lib/UtilTest.php
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2016-10-20 15:11:01 +0200
committerJoas Schilling <coding@schilljs.com>2016-10-20 15:19:41 +0200
commit122edcd0c1b652f25c36c52cc7541eb62695bf37 (patch)
treeb9fa6b1f1a4229aa63ea33bda790747a1933eb02 /tests/lib/UtilTest.php
parentb946e3ecfb2478f7aaca82c11367a2be8455a2d0 (diff)
downloadnextcloud-server-122edcd0c1b652f25c36c52cc7541eb62695bf37.tar.gz
nextcloud-server-122edcd0c1b652f25c36c52cc7541eb62695bf37.zip
Make sure all tests use the TestCase method to overwrite services
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'tests/lib/UtilTest.php')
-rw-r--r--tests/lib/UtilTest.php11
1 files changed, 2 insertions, 9 deletions
diff --git a/tests/lib/UtilTest.php b/tests/lib/UtilTest.php
index 619963a2abf..a1671191ab8 100644
--- a/tests/lib/UtilTest.php
+++ b/tests/lib/UtilTest.php
@@ -87,24 +87,17 @@ class UtilTest extends \Test\TestCase {
function testFormatDateWithTZFromSession($offset, $expected, $expectedTimeZone) {
date_default_timezone_set("UTC");
- $oldDateTimeFormatter = \OC::$server->query('DateTimeFormatter');
\OC::$server->getSession()->set('timezone', $offset);
$selectedTimeZone = \OC::$server->getDateTimeZone()->getTimeZone(1350129205);
$this->assertEquals($expectedTimeZone, $selectedTimeZone->getName());
$newDateTimeFormatter = new \OC\DateTimeFormatter($selectedTimeZone, new \OC_L10N('lib', 'en'));
- $this->setDateFormatter($newDateTimeFormatter);
+ $this->overwriteService('DateTimeFormatter', $newDateTimeFormatter);
$result = OC_Util::formatDate(1350129205, false);
$this->assertEquals($expected, $result);
- $this->setDateFormatter($oldDateTimeFormatter);
- }
-
- protected function setDateFormatter($formatter) {
- \OC::$server->registerService('DateTimeFormatter', function ($c) use ($formatter) {
- return $formatter;
- });
+ $this->restoreService('DateTimeFormatter');
}
function testSanitizeHTML() {