Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ext/date/tests/DatePeriod_by_ref_iterator.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ $d = DatePeriod::__set_state( $properties );
try {
foreach( $d as &$item )
{
echo $item->format(DateTime::ISO8601), "\n";
echo $item->format(DateTime::ATOM), "\n";
}
echo "OK\n";
} catch (\Error $e) {
Expand Down
38 changes: 19 additions & 19 deletions ext/date/tests/DatePeriod_serialize-002.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var_dump($d->__serialize());
echo "\n\nIterate of unserialised object:\n";
foreach ( $e as $d )
{
echo $d->format(DateTime::ISO8601), "\n";
echo $d->format(DateTime::ATOM), "\n";
}
?>
--EXPECTF--
Expand Down Expand Up @@ -196,21 +196,21 @@ array(%d) {


Iterate of unserialised object:
1978-12-22T09:15:00+0100
1981-06-22T09:15:00+0200
1983-12-22T09:15:00+0100
1986-06-22T09:15:00+0200
1988-12-22T09:15:00+0100
1991-06-22T09:15:00+0200
1993-12-22T09:15:00+0100
1996-06-22T09:15:00+0200
1998-12-22T09:15:00+0100
2001-06-22T09:15:00+0200
2003-12-22T09:15:00+0100
2006-06-22T09:15:00+0200
2008-12-22T09:15:00+0100
2011-06-22T09:15:00+0200
2013-12-22T09:15:00+0100
2016-06-22T09:15:00+0200
2018-12-22T09:15:00+0100
2021-06-22T09:15:00+0200
1978-12-22T09:15:00+01:00
1981-06-22T09:15:00+02:00
1983-12-22T09:15:00+01:00
1986-06-22T09:15:00+02:00
1988-12-22T09:15:00+01:00
1991-06-22T09:15:00+02:00
1993-12-22T09:15:00+01:00
1996-06-22T09:15:00+02:00
1998-12-22T09:15:00+01:00
2001-06-22T09:15:00+02:00
2003-12-22T09:15:00+01:00
2006-06-22T09:15:00+02:00
2008-12-22T09:15:00+01:00
2011-06-22T09:15:00+02:00
2013-12-22T09:15:00+01:00
2016-06-22T09:15:00+02:00
2018-12-22T09:15:00+01:00
2021-06-22T09:15:00+02:00
36 changes: 18 additions & 18 deletions ext/date/tests/DatePeriod_serialize-003.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var_dump($d->__serialize());
echo "\n\nIterate of unserialised object:\n";
foreach ( $e as $d )
{
echo $d->format(DateTime::ISO8601), "\n";
echo $d->format(DateTime::ATOM), "\n";
}
?>
--EXPECTF--
Expand Down Expand Up @@ -196,20 +196,20 @@ array(%d) {


Iterate of unserialised object:
1981-06-22T09:15:00+0200
1983-12-22T09:15:00+0100
1986-06-22T09:15:00+0200
1988-12-22T09:15:00+0100
1991-06-22T09:15:00+0200
1993-12-22T09:15:00+0100
1996-06-22T09:15:00+0200
1998-12-22T09:15:00+0100
2001-06-22T09:15:00+0200
2003-12-22T09:15:00+0100
2006-06-22T09:15:00+0200
2008-12-22T09:15:00+0100
2011-06-22T09:15:00+0200
2013-12-22T09:15:00+0100
2016-06-22T09:15:00+0200
2018-12-22T09:15:00+0100
2021-06-22T09:15:00+0200
1981-06-22T09:15:00+02:00
1983-12-22T09:15:00+01:00
1986-06-22T09:15:00+02:00
1988-12-22T09:15:00+01:00
1991-06-22T09:15:00+02:00
1993-12-22T09:15:00+01:00
1996-06-22T09:15:00+02:00
1998-12-22T09:15:00+01:00
2001-06-22T09:15:00+02:00
2003-12-22T09:15:00+01:00
2006-06-22T09:15:00+02:00
2008-12-22T09:15:00+01:00
2011-06-22T09:15:00+02:00
2013-12-22T09:15:00+01:00
2016-06-22T09:15:00+02:00
2018-12-22T09:15:00+01:00
2021-06-22T09:15:00+02:00
32 changes: 16 additions & 16 deletions ext/date/tests/DatePeriod_serialize-004.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ var_dump($p);
echo "\n\nIterate of object:\n";
foreach ( $p as $d )
{
echo $d->format(DateTime::ISO8601), "\n";
echo $d->format(DateTime::ATOM), "\n";
}

echo "\n\nSerialised object:\n";
Expand All @@ -30,7 +30,7 @@ var_dump($p->__serialize());
echo "\n\nIterate of unserialised object:\n";
foreach ( $p as $d )
{
echo $d->format(DateTime::ISO8601), "\n";
echo $d->format(DateTime::ATOM), "\n";
}
?>
--EXPECTF--
Expand Down Expand Up @@ -82,13 +82,13 @@ object(DatePeriod)#%d (%d) {


Iterate of object:
1979-01-01T09:15:00+0100
1979-02-05T09:15:00+0100
1979-03-05T09:15:00+0100
1979-04-02T09:15:00+0200
1979-05-07T09:15:00+0200
1979-06-04T09:15:00+0200
1979-07-02T09:15:00+0200
1979-01-01T09:15:00+01:00
1979-02-05T09:15:00+01:00
1979-03-05T09:15:00+01:00
1979-04-02T09:15:00+02:00
1979-05-07T09:15:00+02:00
1979-06-04T09:15:00+02:00
1979-07-02T09:15:00+02:00


Serialised object:
Expand Down Expand Up @@ -204,10 +204,10 @@ array(%d) {


Iterate of unserialised object:
1979-01-01T09:15:00+0100
1979-02-05T09:15:00+0100
1979-03-05T09:15:00+0100
1979-04-02T09:15:00+0200
1979-05-07T09:15:00+0200
1979-06-04T09:15:00+0200
1979-07-02T09:15:00+0200
1979-01-01T09:15:00+01:00
1979-02-05T09:15:00+01:00
1979-03-05T09:15:00+01:00
1979-04-02T09:15:00+02:00
1979-05-07T09:15:00+02:00
1979-06-04T09:15:00+02:00
1979-07-02T09:15:00+02:00
28 changes: 17 additions & 11 deletions ext/date/tests/DateTimeImmutable_constants.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,20 @@ DateTimeImmutable constants
<?php

var_dump(
DATE_ATOM === DateTimeImmutable::ATOM,
DATE_COOKIE === DateTimeImmutable::COOKIE,
DATE_ISO8601 === DateTimeImmutable::ISO8601,
DATE_RFC822 === DateTimeImmutable::RFC822,
DATE_RFC850 === DateTimeImmutable::RFC850,
DATE_RFC1036 === DateTimeImmutable::RFC1036,
DATE_RFC1123 === DateTimeImmutable::RFC1123,
DATE_RFC2822 === DateTimeImmutable::RFC2822,
DATE_RFC3339 === DateTimeImmutable::RFC3339,
DATE_RSS === DateTimeImmutable::RSS,
DATE_W3C === DateTimeImmutable::W3C
DATE_ATOM === DateTimeImmutable::ATOM,
DATE_COOKIE === DateTimeImmutable::COOKIE,
DATE_ISO8601 === DateTimeImmutable::ISO8601,
DATE_ISO8601_EXPANDED === DateTimeImmutable::ISO8601_EXPANDED,
DATE_RFC822 === DateTimeImmutable::RFC822,
DATE_RFC850 === DateTimeImmutable::RFC850,
DATE_RFC1036 === DateTimeImmutable::RFC1036,
DATE_RFC1123 === DateTimeImmutable::RFC1123,
DATE_RFC7231 === DateTimeImmutable::RFC7231,
DATE_RFC2822 === DateTimeImmutable::RFC2822,
DATE_RFC3339 === DateTimeImmutable::RFC3339,
DATE_RFC3339_EXTENDED === DateTimeImmutable::RFC3339_EXTENDED,
DATE_RSS === DateTimeImmutable::RSS,
DATE_W3C === DateTimeImmutable::W3C
);

?>
Expand All @@ -30,3 +33,6 @@ bool(true)
bool(true)
bool(true)
bool(true)
bool(true)
bool(true)
bool(true)
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ $dtz = new DateTimeZone("Europe/Kyiv");
check(fn() => DateTimeImmutable::createFromInterface($mdti));
check(fn() => DateTime::createFromImmutable($mdti));
check(fn() => serialize($mdti));
check(fn() => date_format($mdti, DateTime::ISO8601));
check(fn() => $mdti->format(DateTime::ISO8601));
check(fn() => date_format($mdti, DateTime::ATOM));
check(fn() => $mdti->format(DateTime::ATOM));
check(fn() => $mdti->modify("+1 day"));
check(fn() => $mdti->add($di));
check(fn() => $mdti->sub($di));
Expand Down
28 changes: 17 additions & 11 deletions ext/date/tests/DateTimeInterface_constants.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,20 @@ DateTimeInterface constants
<?php

var_dump(
DATE_ATOM === DateTimeInterface::ATOM,
DATE_COOKIE === DateTimeInterface::COOKIE,
DATE_ISO8601 === DateTimeInterface::ISO8601,
DATE_RFC822 === DateTimeInterface::RFC822,
DATE_RFC850 === DateTimeInterface::RFC850,
DATE_RFC1036 === DateTimeInterface::RFC1036,
DATE_RFC1123 === DateTimeInterface::RFC1123,
DATE_RFC2822 === DateTimeInterface::RFC2822,
DATE_RFC3339 === DateTimeInterface::RFC3339,
DATE_RSS === DateTimeInterface::RSS,
DATE_W3C === DateTimeInterface::W3C
DATE_ATOM === DateTimeInterface::ATOM,
DATE_COOKIE === DateTimeInterface::COOKIE,
DATE_ISO8601 === DateTimeInterface::ISO8601,
DATE_ISO8601_EXPANDED === DateTimeInterface::ISO8601_EXPANDED,
DATE_RFC822 === DateTimeInterface::RFC822,
DATE_RFC850 === DateTimeInterface::RFC850,
DATE_RFC1036 === DateTimeInterface::RFC1036,
DATE_RFC1123 === DateTimeInterface::RFC1123,
DATE_RFC7231 === DateTimeImmutable::RFC7231,
DATE_RFC2822 === DateTimeInterface::RFC2822,
DATE_RFC3339 === DateTimeInterface::RFC3339,
DATE_RFC3339_EXTENDED === DateTimeInterface::RFC3339_EXTENDED,
DATE_RSS === DateTimeInterface::RSS,
DATE_W3C === DateTimeInterface::W3C
);

?>
Expand All @@ -30,3 +33,6 @@ bool(true)
bool(true)
bool(true)
bool(true)
bool(true)
bool(true)
bool(true)
28 changes: 17 additions & 11 deletions ext/date/tests/DateTime_constants.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,20 @@ DateTime constants
<?php

var_dump(
DATE_ATOM === DateTime::ATOM,
DATE_COOKIE === DateTime::COOKIE,
DATE_ISO8601 === DateTime::ISO8601,
DATE_RFC822 === DateTime::RFC822,
DATE_RFC850 === DateTime::RFC850,
DATE_RFC1036 === DateTime::RFC1036,
DATE_RFC1123 === DateTime::RFC1123,
DATE_RFC2822 === DateTime::RFC2822,
DATE_RFC3339 === DateTime::RFC3339,
DATE_RSS === DateTime::RSS,
DATE_W3C === DateTime::W3C
DATE_ATOM === DateTime::ATOM,
DATE_COOKIE === DateTime::COOKIE,
DATE_ISO8601 === DateTime::ISO8601,
DATE_ISO8601_EXPANDED === DateTime::ISO8601_EXPANDED,
DATE_RFC822 === DateTime::RFC822,
DATE_RFC850 === DateTime::RFC850,
DATE_RFC1036 === DateTime::RFC1036,
DATE_RFC1123 === DateTime::RFC1123,
DATE_RFC7231 === DateTime::RFC7231,
DATE_RFC2822 === DateTime::RFC2822,
DATE_RFC3339 === DateTime::RFC3339,
DATE_RFC3339_EXTENDED === DateTime::RFC3339_EXTENDED,
DATE_RSS === DateTime::RSS,
DATE_W3C === DateTime::W3C
);

?>
Expand All @@ -30,3 +33,6 @@ bool(true)
bool(true)
bool(true)
bool(true)
bool(true)
bool(true)
bool(true)
12 changes: 9 additions & 3 deletions ext/date/tests/DateTime_format_basic2.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,38 @@ Test date_format() function : basic functionality
//Set the default time zone
date_default_timezone_set("Europe/London");

echo "*** Testing date_format() : basic functionality - formatting coinstants ***\n";
echo "*** Testing date_format() : basic functionality - formatting constants ***\n";
$date = new DateTime("2005-07-14 22:30:41");

var_dump( $date->format( DateTime::ATOM) ) ;
var_dump( $date->format( DateTime::COOKIE) ) ;
var_dump( $date->format( DateTime::ISO8601) ) ;
var_dump( $date->format( DateTime::ISO8601_EXPANDED) ) ;
var_dump( $date->format( DateTime::RFC822) ) ;
var_dump( $date->format( DateTime::RFC850) ) ;
var_dump( $date->format( DateTime::RFC1036) ) ;
var_dump( $date->format( DateTime::RFC1123) ) ;
var_dump( $date->format( DateTime:: RFC2822) ) ;
var_dump( $date->format( DateTime::RFC7231) ) ;
var_dump( $date->format( DateTime::RFC2822) ) ;
var_dump( $date->format( DateTime::RFC3339) ) ;
var_dump( $date->format( DateTime::RFC3339_EXTENDED) ) ;
var_dump( $date->format( DateTime::RSS) ) ;
var_dump( $date->format( DateTime::W3C) ) ;

?>
--EXPECT--
*** Testing date_format() : basic functionality - formatting coinstants ***
*** Testing date_format() : basic functionality - formatting constants ***
string(25) "2005-07-14T22:30:41+01:00"
string(34) "Thursday, 14-Jul-2005 22:30:41 BST"
string(24) "2005-07-14T22:30:41+0100"
string(26) "+2005-07-14T22:30:41+01:00"
string(29) "Thu, 14 Jul 05 22:30:41 +0100"
string(32) "Thursday, 14-Jul-05 22:30:41 BST"
string(29) "Thu, 14 Jul 05 22:30:41 +0100"
string(31) "Thu, 14 Jul 2005 22:30:41 +0100"
string(29) "Thu, 14 Jul 2005 22:30:41 GMT"
string(31) "Thu, 14 Jul 2005 22:30:41 +0100"
string(25) "2005-07-14T22:30:41+01:00"
string(29) "2005-07-14T22:30:41.000+01:00"
string(31) "Thu, 14 Jul 2005 22:30:41 +0100"
string(25) "2005-07-14T22:30:41+01:00"
4 changes: 2 additions & 2 deletions ext/date/tests/DateTime_uninitialised_exceptions.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ $dtz = new DateTimeZone("Europe/Kyiv");
check(fn() => DateTime::createFromInterface($mdt));
check(fn() => DateTimeImmutable::createFromMutable($mdt));
check(fn() => serialize($mdt));
check(fn() => date_format($mdt, DateTime::ISO8601));
check(fn() => $mdt->format(DateTime::ISO8601));
check(fn() => date_format($mdt, DateTime::ATOM));
check(fn() => $mdt->format(DateTime::ATOM));
check(fn() => date_modify($mdt, "+1 day"));
check(fn() => $mdt->modify("+1 day"));
check(fn() => $mdt->add($di));
Expand Down
24 changes: 12 additions & 12 deletions ext/date/tests/bug33869.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@ Bug #33869 (strtotime() doesn't parse "+1days" format)
<?php
date_default_timezone_set("UTC");
$tm = strtotime("2005-01-01 01:01:01");
echo date(DATE_ISO8601, strtotime('+5days', $tm));
echo date(DATE_ATOM, strtotime('+5days', $tm));
echo "\n";
echo date(DATE_ISO8601, strtotime('+1month', $tm));
echo date(DATE_ATOM, strtotime('+1month', $tm));
echo "\n";
echo date(DATE_ISO8601, strtotime('+1year', $tm));
echo date(DATE_ATOM, strtotime('+1year', $tm));
echo "\n";
echo date(DATE_ISO8601, strtotime('+5 days', $tm));
echo date(DATE_ATOM, strtotime('+5 days', $tm));
echo "\n";
echo date(DATE_ISO8601, strtotime('+1 month', $tm));
echo date(DATE_ATOM, strtotime('+1 month', $tm));
echo "\n";
echo date(DATE_ISO8601, strtotime('+1 year', $tm));
echo date(DATE_ATOM, strtotime('+1 year', $tm));
echo "\n";
?>
--EXPECT--
2005-01-06T01:01:01+0000
2005-02-01T01:01:01+0000
2006-01-01T01:01:01+0000
2005-01-06T01:01:01+0000
2005-02-01T01:01:01+0000
2006-01-01T01:01:01+0000
2005-01-06T01:01:01+00:00
2005-02-01T01:01:01+00:00
2006-01-01T01:01:01+00:00
2005-01-06T01:01:01+00:00
2005-02-01T01:01:01+00:00
2006-01-01T01:01:01+00:00
Loading