Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?php
2
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */
3
// CVS: $Id: bug-9414.phpt,v 1.1 2006/11/22 00:19:58 firman Exp $
4
?>
5
--TEST--
6
Bug #9414: Date::addSeconds() fails to work properly with negative numbers
7
--FILE--
8
<?php
9
/**
10
 * Test for: Date
11
 * Parts tested: Date::addSeconds()
12
 */
13
 
14
require_once 'Date.php';
15
 
16
$date = new Date('2006-11-21');
17
 
18
print "Date is now: " . $date->format("%Y-%m-%d %H:%M") . "\n";
19
 
20
$date->addSeconds(-1 * 86400 * 7); # subtract 1 week (negative value)
21
print 'After subtracting a week\'s worth of seconds, date is: ' . $date->format("%Y-%m-%d %H:%M") . "\n";
22
 
23
$date->subtractSeconds(-1 * 86400 * 7); # add 1 week (negative value)
24
print 'After subtracting a week\'s worth of seconds, date is: ' . $date->format("%Y-%m-%d %H:%M") . "\n";
25
 
26
?>
27
--EXPECT--
28
Date is now: 2006-11-21 00:00
29
After subtracting a week's worth of seconds, date is: 2006-11-14 00:00
30
After subtracting a week's worth of seconds, date is: 2006-11-21 00:00
31
<?php
32
/*
33
 * Local variables:
34
 * mode: php
35
 * tab-width: 4
36
 * c-basic-offset: 4
37
 * c-hanging-comment-ender-p: nil
38
 * End:
39
 */
40
?>