xref: /php-src/ext/date/tests/68062.phpt (revision b7860cd5)
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::class, ': ', $e->getMessage(), "\n";
14}
15?>
16--EXPECT--
173600
18TypeError: DateTimeZone::getOffset(): Argument #1 ($datetime) must be of type DateTimeInterface, int given
19