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-727-2.phpt,v 1.1 2006/11/20 08:56:24 firman Exp $
4
?>
5
--TEST--
6
Bug #727: Date_Calc::weeksInMonth() wrong result
7
Tests for weeksInMonth, february with 4 weeks
8
Sunday as 1st day of week
9
--FILE--
10
<?php
11
/**
12
 * Test for: Date_Calc
13
 * Parts tested: Date_Calc::weeksInMonth()
14
 */
15
 
16
/**
17
 * Sunday as 1st day of week
18
 */
19
define('DATE_CALC_BEGIN_WEEKDAY', 0);
20
 
21
require_once "Date/Calc.php";
22
 
23
$tests = array(
24
    array(2009, 2), array(2015, 2), array(2026, 2), array(2037, 2),
25
    array(1931, 2), array(1942, 2), array(1801, 2), array(1807, 2),
26
    array(1818, 2), array(1829, 2), array(1835, 2), array(1846, 2),
27
    array(1857, 2), array(1863, 2), array(1874, 2), array(1885, 2),
28
    array(1891, 2), array(1903, 2), array(1914, 2), array(1925, 2)
29
);
30
 
31
foreach ($tests as $date) {
32
    list ($year, $month) = $date;
33
    echo $year . '/' . $month . ' = ' . Date_Calc::weeksInMonth($month, $year) . ' weeks' . "\n";
34
}
35
?>
36
--EXPECT--
37
2009/2 = 4 weeks
38
2015/2 = 4 weeks
39
2026/2 = 4 weeks
40
2037/2 = 4 weeks
41
1931/2 = 4 weeks
42
1942/2 = 4 weeks
43
1801/2 = 4 weeks
44
1807/2 = 4 weeks
45
1818/2 = 4 weeks
46
1829/2 = 4 weeks
47
1835/2 = 4 weeks
48
1846/2 = 4 weeks
49
1857/2 = 4 weeks
50
1863/2 = 4 weeks
51
1874/2 = 4 weeks
52
1885/2 = 4 weeks
53
1891/2 = 4 weeks
54
1903/2 = 4 weeks
55
1914/2 = 4 weeks
56
1925/2 = 4 weeks
57
<?php
58
/*
59
 * Local variables:
60
 * mode: php
61
 * tab-width: 4
62
 * c-basic-offset: 4
63
 * c-hanging-comment-ender-p: nil
64
 * End:
65
 */
66
?>