xref: /PHP-8.0/ext/date/tests/68062.phpt (revision d6264b09)
1--TEST--
2DateTimeZone::getOffset() accepts a DateTimeInterface object
3--FILE--
4<?php
5
6$tz = new DateTimeZone('Europe/London');
7$dt = new DateTimeImmutable('2014-09-20', $tz);
8
9echo $tz->getOffset($dt), "\n";
10try {
11    echo $tz->getOffset(1);
12} catch (TypeError $e) {
13    echo $e->getMessage(), "\n";
14}
15?>
16--EXPECT--
173600
18DateTimeZone::getOffset(): Argument #1 ($datetime) must be of type DateTimeInterface, int given
19