Annotation of embedaddon/php/ext/date/tests/DateTimeZone_compare_basic1.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test of compare object handler for DateTime objects
3: --FILE--
4: <?php
5:
6: // NB: DateTimeZone class does not define a customized compare class handler so standard object handler will be used
7:
8: echo "Simple test for DateTimeZone compare object handler\n";
9:
10: //Set the default time zone
11: date_default_timezone_set("Europe/London");
12:
13: class DateTimeZoneExt1 extends DateTimeZone {
14: }
15:
16: class DateTimeZoneExt2 extends DateTimeZone{
17: public $foo = "Hello";
18: private $bar = 99;
19: }
20:
21: class DateTimeZoneExt3 extends DateTimeZoneExt2 {
22: }
23:
24: $obj1 = new DateTimeZone("Europe/London");
25: $obj2 = new DateTimeZoneExt1("Europe/London");
26: $obj3 = new DateTimeZoneExt2("Europe/London");
27: $obj4 = new DateTimeZoneExt3("Europe/London");
28:
29: echo "\n-- All the following tests should compare equal --\n";
30: var_dump($obj1 == $obj1);
31: echo "\n-- All the following tests should compare NOT equal --\n";
32: var_dump($obj1 == $obj2);
33: var_dump($obj1 == $obj3);
34: var_dump($obj1 == $obj4);
35: var_dump($obj2 == $obj3);
36: var_dump($obj2 == $obj4);
37: var_dump($obj3 == $obj4);
38:
39: ?>
40: ===DONE===
41: --EXPECT--
42: Simple test for DateTimeZone compare object handler
43:
44: -- All the following tests should compare equal --
45: bool(true)
46:
47: -- All the following tests should compare NOT equal --
48: bool(false)
49: bool(false)
50: bool(false)
51: bool(false)
52: bool(false)
53: bool(false)
54: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>