Annotation of embedaddon/php/ext/date/tests/DateInterval_format.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: DateInterval::format(), except %a
                      3: --DESCRIPTION--
                      4: %a is covered in a separate test.
                      5: Don't want an XFAIL here to cause confusion if a real bug comes up.
                      6: --CREDITS--
                      7: Daniel Convissor <danielc@php.net>
                      8: # TestFest 2010 BKTK
                      9: --SKIPIF--
                     10: <?php if (!method_exists('DateInterval', 'format')) die("skip: method doesn't exist"); ?>
                     11: --FILE--
                     12: <?php
                     13: date_default_timezone_set('UTC');
                     14: 
                     15: $date1 = new DateTime('2000-01-01 00:00:00');
                     16: $date2 = new DateTime('2001-03-04 04:05:06');
                     17: 
                     18: $interval = $date1->diff($date2);
                     19: 
                     20: echo $interval->format('Y=%Y') . "\n";
                     21: echo $interval->format('M=%M') . "\n";
                     22: echo $interval->format('D=%D') . "\n";
                     23: echo $interval->format('H=%H') . "\n";
                     24: echo $interval->format('I=%I') . "\n";
                     25: echo $interval->format('S=%S') . "\n";
                     26: echo $interval->format('R=%R') . "\n";
                     27: 
                     28: echo $interval->format('y=%y') . "\n";
                     29: echo $interval->format('m=%m') . "\n";
                     30: echo $interval->format('d=%d') . "\n";
                     31: echo $interval->format('h=%h') . "\n";
                     32: echo $interval->format('i=%i') . "\n";
                     33: echo $interval->format('s=%s') . "\n";
                     34: echo $interval->format('r=%r') . "\n";
                     35: 
                     36: echo "\n";
                     37: 
                     38: $interval = $date2->diff($date1);
                     39: 
                     40: echo $interval->format('inverted R=%R') . "\n";
                     41: echo $interval->format('inverted r=%r') . "\n";
                     42: 
                     43: echo "\n";
                     44: 
                     45: echo $interval->format('%=%%') . "\n";
                     46: 
                     47: // Invalid valid format character does not raise warnings.
                     48: echo $interval->format('x=%x') . "\n";
                     49: 
                     50: ?>
                     51: --EXPECT--
                     52: Y=01
                     53: M=02
                     54: D=03
                     55: H=04
                     56: I=05
                     57: S=06
                     58: R=+
                     59: y=1
                     60: m=2
                     61: d=3
                     62: h=4
                     63: i=5
                     64: s=6
                     65: r=
                     66: 
                     67: inverted R=-
                     68: inverted r=-
                     69: 
                     70: %=%
                     71: x=%x

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>