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-1.phpt,v 1.1 2006/11/20 08:54:51 firman Exp $
4
?>
5
--TEST--
6
Bug #727: Date_Calc::weeksInMonth() wrong result
7
Tests for weeksInMonth, february with 4 weeks
8
Monday 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
 * Monday as 1st day of week
18
 */
19
define('DATE_CALC_BEGIN_WEEKDAY', 1);
20
 
21
require_once "Date/Calc.php";
22
 
23
$tests = array(
24
    array(1999, 2), array(2010, 2), array(2021, 2), array(2027, 2),
25
    array(1937, 2), array(1943, 2), array(1802, 2), array(1813, 2),
26
    array(1819, 2), array(1830, 2), array(1841, 2), array(1847, 2),
27
    array(1858, 2), array(1869, 2), array(1875, 2), array(1886, 2),
28
    array(1897, 2), array(1909, 2), array(1915, 2), array(1926, 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
1999/2 = 4 weeks
38
2010/2 = 4 weeks
39
2021/2 = 4 weeks
40
2027/2 = 4 weeks
41
1937/2 = 4 weeks
42
1943/2 = 4 weeks
43
1802/2 = 4 weeks
44
1813/2 = 4 weeks
45
1819/2 = 4 weeks
46
1830/2 = 4 weeks
47
1841/2 = 4 weeks
48
1847/2 = 4 weeks
49
1858/2 = 4 weeks
50
1869/2 = 4 weeks
51
1875/2 = 4 weeks
52
1886/2 = 4 weeks
53
1897/2 = 4 weeks
54
1909/2 = 4 weeks
55
1915/2 = 4 weeks
56
1926/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
?>