diff options
author | Anna Larch <anna@nextcloud.com> | 2023-11-06 12:09:01 +0100 |
---|---|---|
committer | Anna Larch <anna@nextcloud.com> | 2024-02-13 13:29:06 +0100 |
commit | 6434ce96c946c7fa3d70f8109d88c1181c64ff81 (patch) | |
tree | 02a66f699ea274e0f9b79a286c77b2b4cc7b6581 /tests/lib/AppFramework | |
parent | 25344c2cfcad36576013f1e976ed08dd3e1773cd (diff) | |
download | nextcloud-server-6434ce96c946c7fa3d70f8109d88c1181c64ff81.tar.gz nextcloud-server-6434ce96c946c7fa3d70f8109d88c1181c64ff81.zip |
Add timezone getter to ITimeFactory
Signed-off-by: Anna Larch <anna@nextcloud.com>
Diffstat (limited to 'tests/lib/AppFramework')
-rw-r--r-- | tests/lib/AppFramework/Utility/TimeFactoryTest.php | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/lib/AppFramework/Utility/TimeFactoryTest.php b/tests/lib/AppFramework/Utility/TimeFactoryTest.php index 5811a2cf86a..91740ee6088 100644 --- a/tests/lib/AppFramework/Utility/TimeFactoryTest.php +++ b/tests/lib/AppFramework/Utility/TimeFactoryTest.php @@ -46,4 +46,21 @@ class TimeFactoryTest extends \Test\TestCase { $now = $withTimeZone->now(); self::assertSame('Europe/Berlin', $now->getTimezone()->getName()); } + + public function testGetTimeZone(): void { + $expected = new \DateTimeZone('Europe/Berlin'); + $actual = $this->timeFactory->getTimeZone('Europe/Berlin'); + self::assertEquals($expected, $actual); + } + + public function testGetTimeZoneUTC(): void { + $expected = new \DateTimeZone('UTC'); + $actual = $this->timeFactory->getTimeZone(); + self::assertEquals($expected, $actual); + } + + public function testGetTimeZoneInvalid(): void { + $this->expectException(\Exception::class); + $this->timeFactory->getTimeZone('blubblub'); + } } |