@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | /** |
49 | 49 | * Load Calendar base class |
50 | 50 | */ |
51 | -require_once CALENDAR_ROOT.'Calendar.php'; |
|
51 | +require_once CALENDAR_ROOT . 'Calendar.php'; |
|
52 | 52 | |
53 | 53 | /** |
54 | 54 | * Contains a factory method to return a Singleton instance of a class |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | $firstDay = defined('CALENDAR_FIRST_DAY_OF_WEEK') ? CALENDAR_FIRST_DAY_OF_WEEK : 1; |
97 | 97 | switch ($type) { |
98 | 98 | case 'Day': |
99 | - include_once CALENDAR_ROOT.'Day.php'; |
|
99 | + include_once CALENDAR_ROOT . 'Day.php'; |
|
100 | 100 | |
101 | 101 | return new Calendar_Day($y, $m, $d); |
102 | 102 | case 'Month': |
@@ -106,44 +106,44 @@ discard block |
||
106 | 106 | } |
107 | 107 | switch (CALENDAR_MONTH_STATE) { |
108 | 108 | case CALENDAR_USE_MONTH_WEEKDAYS: |
109 | - include_once CALENDAR_ROOT.'Month/Weekdays.php'; |
|
109 | + include_once CALENDAR_ROOT . 'Month/Weekdays.php'; |
|
110 | 110 | $class = 'Calendar_Month_Weekdays'; |
111 | 111 | break; |
112 | 112 | case CALENDAR_USE_MONTH_WEEKS: |
113 | - include_once CALENDAR_ROOT.'Month/Weeks.php'; |
|
113 | + include_once CALENDAR_ROOT . 'Month/Weeks.php'; |
|
114 | 114 | $class = 'Calendar_Month_Weeks'; |
115 | 115 | break; |
116 | 116 | case CALENDAR_USE_MONTH: |
117 | 117 | default: |
118 | - include_once CALENDAR_ROOT.'Month.php'; |
|
118 | + include_once CALENDAR_ROOT . 'Month.php'; |
|
119 | 119 | $class = 'Calendar_Month'; |
120 | 120 | break; |
121 | 121 | } |
122 | 122 | |
123 | 123 | return new $class($y, $m, $firstDay); |
124 | 124 | case 'Week': |
125 | - include_once CALENDAR_ROOT.'Week.php'; |
|
125 | + include_once CALENDAR_ROOT . 'Week.php'; |
|
126 | 126 | |
127 | 127 | return new Calendar_Week($y, $m, $d, $firstDay); |
128 | 128 | case 'Hour': |
129 | - include_once CALENDAR_ROOT.'Hour.php'; |
|
129 | + include_once CALENDAR_ROOT . 'Hour.php'; |
|
130 | 130 | |
131 | 131 | return new Calendar_Hour($y, $m, $d, $h); |
132 | 132 | case 'Minute': |
133 | - include_once CALENDAR_ROOT.'Minute.php'; |
|
133 | + include_once CALENDAR_ROOT . 'Minute.php'; |
|
134 | 134 | |
135 | 135 | return new Calendar_Minute($y, $m, $d, $h, $i); |
136 | 136 | case 'Second': |
137 | - include_once CALENDAR_ROOT.'Second.php'; |
|
137 | + include_once CALENDAR_ROOT . 'Second.php'; |
|
138 | 138 | |
139 | 139 | return new Calendar_Second($y, $m, $d, $h, $i, $s); |
140 | 140 | case 'Year': |
141 | - include_once CALENDAR_ROOT.'Year.php'; |
|
141 | + include_once CALENDAR_ROOT . 'Year.php'; |
|
142 | 142 | |
143 | 143 | return new Calendar_Year($y); |
144 | 144 | default: |
145 | 145 | include_once 'PEAR.php'; |
146 | - PEAR::raiseError('Calendar_Factory::create() unrecognised type: '.$type, |
|
146 | + PEAR::raiseError('Calendar_Factory::create() unrecognised type: ' . $type, |
|
147 | 147 | null, PEAR_ERROR_TRIGGER, E_USER_NOTICE, 'Calendar_Factory::create()'); |
148 | 148 | |
149 | 149 | return false; |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | * @return void |
241 | 241 | * @access private |
242 | 242 | */ |
243 | - function setEmpty ($state = true) |
|
243 | + function setEmpty($state = true) |
|
244 | 244 | { |
245 | 245 | if (method_exists($this->calendar, 'setEmpty')) { |
246 | 246 | $this->calendar->setEmpty($state); |
@@ -437,12 +437,12 @@ discard block |
||
437 | 437 | */ |
438 | 438 | function prevWeek($format = 'n_in_month') |
439 | 439 | { |
440 | - if ( method_exists($this->calendar, 'prevWeek')) { |
|
440 | + if (method_exists($this->calendar, 'prevWeek')) { |
|
441 | 441 | return $this->calendar->prevWeek($format); |
442 | 442 | } else { |
443 | 443 | include_once 'PEAR.php'; |
444 | 444 | PEAR::raiseError( |
445 | - 'Cannot call prevWeek on Calendar object of type: '. |
|
445 | + 'Cannot call prevWeek on Calendar object of type: ' . |
|
446 | 446 | get_class($this->calendar), 133, PEAR_ERROR_TRIGGER, |
447 | 447 | E_USER_NOTICE, 'Calendar_Decorator::prevWeek()'); |
448 | 448 | |
@@ -460,12 +460,12 @@ discard block |
||
460 | 460 | */ |
461 | 461 | function thisWeek($format = 'n_in_month') |
462 | 462 | { |
463 | - if ( method_exists($this->calendar, 'thisWeek')) { |
|
463 | + if (method_exists($this->calendar, 'thisWeek')) { |
|
464 | 464 | return $this->calendar->thisWeek($format); |
465 | 465 | } else { |
466 | 466 | include_once 'PEAR.php'; |
467 | 467 | PEAR::raiseError( |
468 | - 'Cannot call thisWeek on Calendar object of type: '. |
|
468 | + 'Cannot call thisWeek on Calendar object of type: ' . |
|
469 | 469 | get_class($this->calendar), 133, PEAR_ERROR_TRIGGER, |
470 | 470 | E_USER_NOTICE, 'Calendar_Decorator::thisWeek()'); |
471 | 471 | |
@@ -483,12 +483,12 @@ discard block |
||
483 | 483 | */ |
484 | 484 | function nextWeek($format = 'n_in_month') |
485 | 485 | { |
486 | - if ( method_exists($this->calendar, 'nextWeek')) { |
|
486 | + if (method_exists($this->calendar, 'nextWeek')) { |
|
487 | 487 | return $this->calendar->nextWeek($format); |
488 | 488 | } else { |
489 | 489 | include_once 'PEAR.php'; |
490 | 490 | PEAR::raiseError( |
491 | - 'Cannot call thisWeek on Calendar object of type: '. |
|
491 | + 'Cannot call thisWeek on Calendar object of type: ' . |
|
492 | 492 | get_class($this->calendar), 133, PEAR_ERROR_TRIGGER, |
493 | 493 | E_USER_NOTICE, 'Calendar_Decorator::nextWeek()'); |
494 | 494 |
@@ -47,7 +47,7 @@ |
||
47 | 47 | /** |
48 | 48 | * Load Calendar base class |
49 | 49 | */ |
50 | -require_once CALENDAR_ROOT.'Calendar.php'; |
|
50 | +require_once CALENDAR_ROOT . 'Calendar.php'; |
|
51 | 51 | |
52 | 52 | /** |
53 | 53 | * Represents a Second<br /> |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | * |
115 | 115 | * @access protected |
116 | 116 | */ |
117 | - function Calendar_Table_Helper(& $calendar, $firstDay=null) |
|
117 | + function Calendar_Table_Helper(& $calendar, $firstDay = null) |
|
118 | 118 | { |
119 | 119 | $this->calendar = & $calendar; |
120 | 120 | $this->cE = & $calendar->getEngine(); |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | $this->calendar->thisYear(), $this->calendar->thisMonth()); |
173 | 173 | $firstDayInMonth = $this->cE->getFirstDayInMonth( |
174 | 174 | $this->calendar->thisYear(), $this->calendar->thisMonth()); |
175 | - $this->emptyBefore=0; |
|
175 | + $this->emptyBefore = 0; |
|
176 | 176 | foreach ($this->daysOfMonth as $dayOfWeek) { |
177 | 177 | if ($firstDayInMonth == $dayOfWeek) { |
178 | 178 | break; |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | $this->calendar->thisDay() |
189 | 189 | ) |
190 | 190 | ); |
191 | - for ($i=1; $i < $this->numWeeks; ++$i) { |
|
191 | + for ($i = 1; $i < $this->numWeeks; ++$i) { |
|
192 | 192 | $this->daysOfMonth = |
193 | 193 | array_merge($this->daysOfMonth, $this->daysOfWeek); |
194 | 194 | } |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | $this->calendar->thisYear(), |
285 | 285 | $this->calendar->thisMonth(), |
286 | 286 | $this->calendar->thisDay() |
287 | - ) * ($this->numWeeks-1)); |
|
287 | + ) * ($this->numWeeks - 1)); |
|
288 | 288 | } |
289 | 289 | |
290 | 290 | /** |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | * |
298 | 298 | * @return int timestamp |
299 | 299 | */ |
300 | - function getWeekStart($y, $m, $d, $firstDay=1) |
|
300 | + function getWeekStart($y, $m, $d, $firstDay = 1) |
|
301 | 301 | { |
302 | 302 | $dow = $this->cE->getDayOfWeek($y, $m, $d); |
303 | 303 | if ($dow > $firstDay) { |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | 11=>'November', |
33 | 33 | 12=>'December', |
34 | 34 | ); |
35 | - $this->assertEqual($monthNames,$Textual->monthNames()); |
|
35 | + $this->assertEqual($monthNames, $Textual->monthNames()); |
|
36 | 36 | } |
37 | 37 | function testMonthNamesShort() |
38 | 38 | { |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | 11=>'Nov', |
52 | 52 | 12=>'Dec', |
53 | 53 | ); |
54 | - $this->assertEqual($monthNames,$Textual->monthNames('short')); |
|
54 | + $this->assertEqual($monthNames, $Textual->monthNames('short')); |
|
55 | 55 | } |
56 | 56 | function testMonthNamesTwo() |
57 | 57 | { |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | 11=>'No', |
71 | 71 | 12=>'De', |
72 | 72 | ); |
73 | - $this->assertEqual($monthNames,$Textual->monthNames('two')); |
|
73 | + $this->assertEqual($monthNames, $Textual->monthNames('two')); |
|
74 | 74 | } |
75 | 75 | function testMonthNamesOne() |
76 | 76 | { |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | 11=>'N', |
90 | 90 | 12=>'D', |
91 | 91 | ); |
92 | - $this->assertEqual($monthNames,$Textual->monthNames('one')); |
|
92 | + $this->assertEqual($monthNames, $Textual->monthNames('one')); |
|
93 | 93 | } |
94 | 94 | function testWeekdayNamesLong() |
95 | 95 | { |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | 5=>'Friday', |
104 | 104 | 6=>'Saturday', |
105 | 105 | ); |
106 | - $this->assertEqual($weekdayNames,$Textual->weekdayNames()); |
|
106 | + $this->assertEqual($weekdayNames, $Textual->weekdayNames()); |
|
107 | 107 | } |
108 | 108 | function testWeekdayNamesShort() |
109 | 109 | { |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | 5=>'Fri', |
118 | 118 | 6=>'Sat', |
119 | 119 | ); |
120 | - $this->assertEqual($weekdayNames,$Textual->weekdayNames('short')); |
|
120 | + $this->assertEqual($weekdayNames, $Textual->weekdayNames('short')); |
|
121 | 121 | } |
122 | 122 | function testWeekdayNamesTwo() |
123 | 123 | { |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | 5=>'Fr', |
132 | 132 | 6=>'Sa', |
133 | 133 | ); |
134 | - $this->assertEqual($weekdayNames,$Textual->weekdayNames('two')); |
|
134 | + $this->assertEqual($weekdayNames, $Textual->weekdayNames('two')); |
|
135 | 135 | } |
136 | 136 | function testWeekdayNamesOne() |
137 | 137 | { |
@@ -145,27 +145,27 @@ discard block |
||
145 | 145 | 5=>'F', |
146 | 146 | 6=>'S', |
147 | 147 | ); |
148 | - $this->assertEqual($weekdayNames,$Textual->weekdayNames('one')); |
|
148 | + $this->assertEqual($weekdayNames, $Textual->weekdayNames('one')); |
|
149 | 149 | } |
150 | 150 | function testPrevMonthNameShort() |
151 | 151 | { |
152 | 152 | $Textual = new Calendar_Decorator_Textual($this->mockcal); |
153 | - $this->assertEqual('Sep',$Textual->prevMonthName('short')); |
|
153 | + $this->assertEqual('Sep', $Textual->prevMonthName('short')); |
|
154 | 154 | } |
155 | 155 | function testThisMonthNameShort() |
156 | 156 | { |
157 | 157 | $Textual = new Calendar_Decorator_Textual($this->mockcal); |
158 | - $this->assertEqual('Oct',$Textual->thisMonthName('short')); |
|
158 | + $this->assertEqual('Oct', $Textual->thisMonthName('short')); |
|
159 | 159 | } |
160 | 160 | function testNextMonthNameShort() |
161 | 161 | { |
162 | 162 | $Textual = new Calendar_Decorator_Textual($this->mockcal); |
163 | - $this->assertEqual('Nov',$Textual->nextMonthName('short')); |
|
163 | + $this->assertEqual('Nov', $Textual->nextMonthName('short')); |
|
164 | 164 | } |
165 | 165 | function testThisDayNameShort() |
166 | 166 | { |
167 | 167 | $Textual = new Calendar_Decorator_Textual($this->mockcal); |
168 | - $this->assertEqual('Wed',$Textual->thisDayName('short')); |
|
168 | + $this->assertEqual('Wed', $Textual->thisDayName('short')); |
|
169 | 169 | } |
170 | 170 | function testOrderedWeekdaysShort() |
171 | 171 | { |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | array_push($weekdayNames, $day); |
185 | 185 | } |
186 | 186 | $Textual = new Calendar_Decorator_Textual($this->mockcal); |
187 | - $this->assertEqual($weekdayNames,$Textual->orderedWeekdays('short')); |
|
187 | + $this->assertEqual($weekdayNames, $Textual->orderedWeekdays('short')); |
|
188 | 188 | } |
189 | 189 | |
190 | 190 | } |
@@ -16,23 +16,23 @@ |
||
16 | 16 | } |
17 | 17 | function setUp() |
18 | 18 | { |
19 | - $this->vError = new Calendar_Validation_Error('foo',20,'bar'); |
|
19 | + $this->vError = new Calendar_Validation_Error('foo', 20, 'bar'); |
|
20 | 20 | } |
21 | 21 | function testGetUnit() |
22 | 22 | { |
23 | - $this->assertEqual($this->vError->getUnit(),'foo'); |
|
23 | + $this->assertEqual($this->vError->getUnit(), 'foo'); |
|
24 | 24 | } |
25 | 25 | function testGetValue() |
26 | 26 | { |
27 | - $this->assertEqual($this->vError->getValue(),20); |
|
27 | + $this->assertEqual($this->vError->getValue(), 20); |
|
28 | 28 | } |
29 | 29 | function testGetMessage() |
30 | 30 | { |
31 | - $this->assertEqual($this->vError->getMessage(),'bar'); |
|
31 | + $this->assertEqual($this->vError->getMessage(), 'bar'); |
|
32 | 32 | } |
33 | 33 | function testToString() |
34 | 34 | { |
35 | - $this->assertEqual($this->vError->toString(),'foo = 20 [bar]'); |
|
35 | + $this->assertEqual($this->vError->toString(), 'foo = 20 [bar]'); |
|
36 | 36 | } |
37 | 37 | } |
38 | 38 |
@@ -4,10 +4,10 @@ discard block |
||
4 | 4 | require_once 'simple_include.php'; |
5 | 5 | require_once 'calendar_include.php'; |
6 | 6 | |
7 | -Mock::generate('Calendar_Engine_Interface','Mock_Calendar_Engine'); |
|
8 | -Mock::generate('Calendar_Second','Mock_Calendar_Second'); |
|
9 | -Mock::generate('Calendar_Week','Mock_Calendar_Week'); |
|
10 | -Mock::generate('Calendar_Day','Mock_Calendar_Day'); |
|
7 | +Mock::generate('Calendar_Engine_Interface', 'Mock_Calendar_Engine'); |
|
8 | +Mock::generate('Calendar_Second', 'Mock_Calendar_Second'); |
|
9 | +Mock::generate('Calendar_Week', 'Mock_Calendar_Week'); |
|
10 | +Mock::generate('Calendar_Day', 'Mock_Calendar_Day'); |
|
11 | 11 | |
12 | 12 | /** |
13 | 13 | * Class TestOfDecorator |
@@ -25,290 +25,290 @@ discard block |
||
25 | 25 | { |
26 | 26 | $this->mockengine = new Mock_Calendar_Engine($this); |
27 | 27 | $this->mockcal = new Mock_Calendar_Second($this); |
28 | - $this->mockcal->setReturnValue('prevYear',2002); |
|
29 | - $this->mockcal->setReturnValue('thisYear',2003); |
|
30 | - $this->mockcal->setReturnValue('nextYear',2004); |
|
31 | - $this->mockcal->setReturnValue('prevMonth',9); |
|
32 | - $this->mockcal->setReturnValue('thisMonth',10); |
|
33 | - $this->mockcal->setReturnValue('nextMonth',11); |
|
34 | - $this->mockcal->setReturnValue('prevDay',14); |
|
35 | - $this->mockcal->setReturnValue('thisDay',15); |
|
36 | - $this->mockcal->setReturnValue('nextDay',16); |
|
37 | - $this->mockcal->setReturnValue('prevHour',12); |
|
38 | - $this->mockcal->setReturnValue('thisHour',13); |
|
39 | - $this->mockcal->setReturnValue('nextHour',14); |
|
40 | - $this->mockcal->setReturnValue('prevMinute',29); |
|
41 | - $this->mockcal->setReturnValue('thisMinute',30); |
|
42 | - $this->mockcal->setReturnValue('nextMinute',31); |
|
43 | - $this->mockcal->setReturnValue('prevSecond',44); |
|
44 | - $this->mockcal->setReturnValue('thisSecond',45); |
|
45 | - $this->mockcal->setReturnValue('nextSecond',46); |
|
46 | - $this->mockcal->setReturnValue('getEngine',$this->mockengine); |
|
47 | - $this->mockcal->setReturnValue('getTimestamp',12345); |
|
28 | + $this->mockcal->setReturnValue('prevYear', 2002); |
|
29 | + $this->mockcal->setReturnValue('thisYear', 2003); |
|
30 | + $this->mockcal->setReturnValue('nextYear', 2004); |
|
31 | + $this->mockcal->setReturnValue('prevMonth', 9); |
|
32 | + $this->mockcal->setReturnValue('thisMonth', 10); |
|
33 | + $this->mockcal->setReturnValue('nextMonth', 11); |
|
34 | + $this->mockcal->setReturnValue('prevDay', 14); |
|
35 | + $this->mockcal->setReturnValue('thisDay', 15); |
|
36 | + $this->mockcal->setReturnValue('nextDay', 16); |
|
37 | + $this->mockcal->setReturnValue('prevHour', 12); |
|
38 | + $this->mockcal->setReturnValue('thisHour', 13); |
|
39 | + $this->mockcal->setReturnValue('nextHour', 14); |
|
40 | + $this->mockcal->setReturnValue('prevMinute', 29); |
|
41 | + $this->mockcal->setReturnValue('thisMinute', 30); |
|
42 | + $this->mockcal->setReturnValue('nextMinute', 31); |
|
43 | + $this->mockcal->setReturnValue('prevSecond', 44); |
|
44 | + $this->mockcal->setReturnValue('thisSecond', 45); |
|
45 | + $this->mockcal->setReturnValue('nextSecond', 46); |
|
46 | + $this->mockcal->setReturnValue('getEngine', $this->mockengine); |
|
47 | + $this->mockcal->setReturnValue('getTimestamp', 12345); |
|
48 | 48 | |
49 | 49 | } |
50 | 50 | function tearDown() |
51 | 51 | { |
52 | - unset ( $this->engine ); |
|
53 | - unset ( $this->mockcal ); |
|
52 | + unset ($this->engine); |
|
53 | + unset ($this->mockcal); |
|
54 | 54 | } |
55 | 55 | function testPrevYear() |
56 | 56 | { |
57 | - $this->mockcal->expectOnce('prevYear',array('int')); |
|
57 | + $this->mockcal->expectOnce('prevYear', array('int')); |
|
58 | 58 | $Decorator = new Calendar_Decorator($this->mockcal); |
59 | - $this->assertEqual(2002,$Decorator->prevYear()); |
|
59 | + $this->assertEqual(2002, $Decorator->prevYear()); |
|
60 | 60 | } |
61 | 61 | function testThisYear() |
62 | 62 | { |
63 | - $this->mockcal->expectOnce('thisYear',array('int')); |
|
63 | + $this->mockcal->expectOnce('thisYear', array('int')); |
|
64 | 64 | $Decorator = new Calendar_Decorator($this->mockcal); |
65 | - $this->assertEqual(2003,$Decorator->thisYear()); |
|
65 | + $this->assertEqual(2003, $Decorator->thisYear()); |
|
66 | 66 | } |
67 | 67 | function testNextYear() |
68 | 68 | { |
69 | - $this->mockcal->expectOnce('nextYear',array('int')); |
|
69 | + $this->mockcal->expectOnce('nextYear', array('int')); |
|
70 | 70 | $Decorator = new Calendar_Decorator($this->mockcal); |
71 | - $this->assertEqual(2004,$Decorator->nextYear()); |
|
71 | + $this->assertEqual(2004, $Decorator->nextYear()); |
|
72 | 72 | } |
73 | 73 | function testPrevMonth() |
74 | 74 | { |
75 | - $this->mockcal->expectOnce('prevMonth',array('int')); |
|
75 | + $this->mockcal->expectOnce('prevMonth', array('int')); |
|
76 | 76 | $Decorator = new Calendar_Decorator($this->mockcal); |
77 | - $this->assertEqual(9,$Decorator->prevMonth()); |
|
77 | + $this->assertEqual(9, $Decorator->prevMonth()); |
|
78 | 78 | } |
79 | 79 | function testThisMonth() |
80 | 80 | { |
81 | - $this->mockcal->expectOnce('thisMonth',array('int')); |
|
81 | + $this->mockcal->expectOnce('thisMonth', array('int')); |
|
82 | 82 | $Decorator = new Calendar_Decorator($this->mockcal); |
83 | - $this->assertEqual(10,$Decorator->thisMonth()); |
|
83 | + $this->assertEqual(10, $Decorator->thisMonth()); |
|
84 | 84 | } |
85 | 85 | function testNextMonth() |
86 | 86 | { |
87 | - $this->mockcal->expectOnce('nextMonth',array('int')); |
|
87 | + $this->mockcal->expectOnce('nextMonth', array('int')); |
|
88 | 88 | $Decorator = new Calendar_Decorator($this->mockcal); |
89 | - $this->assertEqual(11,$Decorator->nextMonth()); |
|
89 | + $this->assertEqual(11, $Decorator->nextMonth()); |
|
90 | 90 | } |
91 | 91 | function testPrevWeek() |
92 | 92 | { |
93 | 93 | $mockweek = new Mock_Calendar_Week($this); |
94 | - $mockweek->setReturnValue('prevWeek',1); |
|
95 | - $mockweek->expectOnce('prevWeek',array('n_in_month')); |
|
94 | + $mockweek->setReturnValue('prevWeek', 1); |
|
95 | + $mockweek->expectOnce('prevWeek', array('n_in_month')); |
|
96 | 96 | $Decorator = new Calendar_Decorator($mockweek); |
97 | - $this->assertEqual(1,$Decorator->prevWeek()); |
|
97 | + $this->assertEqual(1, $Decorator->prevWeek()); |
|
98 | 98 | } |
99 | 99 | function testThisWeek() |
100 | 100 | { |
101 | 101 | $mockweek = new Mock_Calendar_Week($this); |
102 | - $mockweek->setReturnValue('thisWeek',2); |
|
103 | - $mockweek->expectOnce('thisWeek',array('n_in_month')); |
|
102 | + $mockweek->setReturnValue('thisWeek', 2); |
|
103 | + $mockweek->expectOnce('thisWeek', array('n_in_month')); |
|
104 | 104 | $Decorator = new Calendar_Decorator($mockweek); |
105 | - $this->assertEqual(2,$Decorator->thisWeek()); |
|
105 | + $this->assertEqual(2, $Decorator->thisWeek()); |
|
106 | 106 | } |
107 | 107 | function testNextWeek() |
108 | 108 | { |
109 | 109 | $mockweek = new Mock_Calendar_Week($this); |
110 | - $mockweek->setReturnValue('nextWeek',3); |
|
111 | - $mockweek->expectOnce('nextWeek',array('n_in_month')); |
|
110 | + $mockweek->setReturnValue('nextWeek', 3); |
|
111 | + $mockweek->expectOnce('nextWeek', array('n_in_month')); |
|
112 | 112 | $Decorator = new Calendar_Decorator($mockweek); |
113 | - $this->assertEqual(3,$Decorator->nextWeek()); |
|
113 | + $this->assertEqual(3, $Decorator->nextWeek()); |
|
114 | 114 | } |
115 | 115 | function testPrevDay() |
116 | 116 | { |
117 | - $this->mockcal->expectOnce('prevDay',array('int')); |
|
117 | + $this->mockcal->expectOnce('prevDay', array('int')); |
|
118 | 118 | $Decorator = new Calendar_Decorator($this->mockcal); |
119 | - $this->assertEqual(14,$Decorator->prevDay()); |
|
119 | + $this->assertEqual(14, $Decorator->prevDay()); |
|
120 | 120 | } |
121 | 121 | function testThisDay() |
122 | 122 | { |
123 | - $this->mockcal->expectOnce('thisDay',array('int')); |
|
123 | + $this->mockcal->expectOnce('thisDay', array('int')); |
|
124 | 124 | $Decorator = new Calendar_Decorator($this->mockcal); |
125 | - $this->assertEqual(15,$Decorator->thisDay()); |
|
125 | + $this->assertEqual(15, $Decorator->thisDay()); |
|
126 | 126 | } |
127 | 127 | function testNextDay() |
128 | 128 | { |
129 | - $this->mockcal->expectOnce('nextDay',array('int')); |
|
129 | + $this->mockcal->expectOnce('nextDay', array('int')); |
|
130 | 130 | $Decorator = new Calendar_Decorator($this->mockcal); |
131 | - $this->assertEqual(16,$Decorator->nextDay()); |
|
131 | + $this->assertEqual(16, $Decorator->nextDay()); |
|
132 | 132 | } |
133 | 133 | function testPrevHour() |
134 | 134 | { |
135 | - $this->mockcal->expectOnce('prevHour',array('int')); |
|
135 | + $this->mockcal->expectOnce('prevHour', array('int')); |
|
136 | 136 | $Decorator = new Calendar_Decorator($this->mockcal); |
137 | - $this->assertEqual(12,$Decorator->prevHour()); |
|
137 | + $this->assertEqual(12, $Decorator->prevHour()); |
|
138 | 138 | } |
139 | 139 | function testThisHour() |
140 | 140 | { |
141 | - $this->mockcal->expectOnce('thisHour',array('int')); |
|
141 | + $this->mockcal->expectOnce('thisHour', array('int')); |
|
142 | 142 | $Decorator = new Calendar_Decorator($this->mockcal); |
143 | - $this->assertEqual(13,$Decorator->thisHour()); |
|
143 | + $this->assertEqual(13, $Decorator->thisHour()); |
|
144 | 144 | } |
145 | 145 | function testNextHour() |
146 | 146 | { |
147 | - $this->mockcal->expectOnce('nextHour',array('int')); |
|
147 | + $this->mockcal->expectOnce('nextHour', array('int')); |
|
148 | 148 | $Decorator = new Calendar_Decorator($this->mockcal); |
149 | - $this->assertEqual(14,$Decorator->nextHour()); |
|
149 | + $this->assertEqual(14, $Decorator->nextHour()); |
|
150 | 150 | } |
151 | 151 | function testPrevMinute() |
152 | 152 | { |
153 | - $this->mockcal->expectOnce('prevMinute',array('int')); |
|
153 | + $this->mockcal->expectOnce('prevMinute', array('int')); |
|
154 | 154 | $Decorator = new Calendar_Decorator($this->mockcal); |
155 | - $this->assertEqual(29,$Decorator->prevMinute()); |
|
155 | + $this->assertEqual(29, $Decorator->prevMinute()); |
|
156 | 156 | } |
157 | 157 | function testThisMinute() |
158 | 158 | { |
159 | - $this->mockcal->expectOnce('thisMinute',array('int')); |
|
159 | + $this->mockcal->expectOnce('thisMinute', array('int')); |
|
160 | 160 | $Decorator = new Calendar_Decorator($this->mockcal); |
161 | - $this->assertEqual(30,$Decorator->thisMinute()); |
|
161 | + $this->assertEqual(30, $Decorator->thisMinute()); |
|
162 | 162 | } |
163 | 163 | function testNextMinute() |
164 | 164 | { |
165 | - $this->mockcal->expectOnce('nextMinute',array('int')); |
|
165 | + $this->mockcal->expectOnce('nextMinute', array('int')); |
|
166 | 166 | $Decorator = new Calendar_Decorator($this->mockcal); |
167 | - $this->assertEqual(31,$Decorator->nextMinute()); |
|
167 | + $this->assertEqual(31, $Decorator->nextMinute()); |
|
168 | 168 | } |
169 | 169 | function testPrevSecond() |
170 | 170 | { |
171 | - $this->mockcal->expectOnce('prevSecond',array('int')); |
|
171 | + $this->mockcal->expectOnce('prevSecond', array('int')); |
|
172 | 172 | $Decorator = new Calendar_Decorator($this->mockcal); |
173 | - $this->assertEqual(44,$Decorator->prevSecond()); |
|
173 | + $this->assertEqual(44, $Decorator->prevSecond()); |
|
174 | 174 | } |
175 | 175 | function testThisSecond() |
176 | 176 | { |
177 | - $this->mockcal->expectOnce('thisSecond',array('int')); |
|
177 | + $this->mockcal->expectOnce('thisSecond', array('int')); |
|
178 | 178 | $Decorator = new Calendar_Decorator($this->mockcal); |
179 | - $this->assertEqual(45,$Decorator->thisSecond()); |
|
179 | + $this->assertEqual(45, $Decorator->thisSecond()); |
|
180 | 180 | } |
181 | 181 | function testNextSecond() |
182 | 182 | { |
183 | - $this->mockcal->expectOnce('nextSecond',array('int')); |
|
183 | + $this->mockcal->expectOnce('nextSecond', array('int')); |
|
184 | 184 | $Decorator = new Calendar_Decorator($this->mockcal); |
185 | - $this->assertEqual(46,$Decorator->nextSecond()); |
|
185 | + $this->assertEqual(46, $Decorator->nextSecond()); |
|
186 | 186 | } |
187 | 187 | function testGetEngine() |
188 | 188 | { |
189 | 189 | $Decorator = new Calendar_Decorator($this->mockcal); |
190 | - $this->assertIsA($Decorator->getEngine(),'Mock_Calendar_Engine'); |
|
190 | + $this->assertIsA($Decorator->getEngine(), 'Mock_Calendar_Engine'); |
|
191 | 191 | } |
192 | 192 | function testSetTimestamp() |
193 | 193 | { |
194 | - $this->mockcal->expectOnce('setTimestamp',array('12345')); |
|
194 | + $this->mockcal->expectOnce('setTimestamp', array('12345')); |
|
195 | 195 | $Decorator = new Calendar_Decorator($this->mockcal); |
196 | 196 | $Decorator->setTimestamp('12345'); |
197 | 197 | } |
198 | 198 | function testGetTimestamp() |
199 | 199 | { |
200 | 200 | $Decorator = new Calendar_Decorator($this->mockcal); |
201 | - $this->assertEqual(12345,$Decorator->getTimestamp()); |
|
201 | + $this->assertEqual(12345, $Decorator->getTimestamp()); |
|
202 | 202 | } |
203 | 203 | function testSetSelected() |
204 | 204 | { |
205 | - $this->mockcal->expectOnce('setSelected',array(true)); |
|
205 | + $this->mockcal->expectOnce('setSelected', array(true)); |
|
206 | 206 | $Decorator = new Calendar_Decorator($this->mockcal); |
207 | 207 | $Decorator->setSelected(); |
208 | 208 | } |
209 | 209 | function testIsSelected() |
210 | 210 | { |
211 | - $this->mockcal->setReturnValue('isSelected',true); |
|
211 | + $this->mockcal->setReturnValue('isSelected', true); |
|
212 | 212 | $Decorator = new Calendar_Decorator($this->mockcal); |
213 | 213 | $this->assertTrue($Decorator->isSelected()); |
214 | 214 | } |
215 | 215 | function testAdjust() |
216 | 216 | { |
217 | - $this->mockcal->expectOnce('adjust',array()); |
|
217 | + $this->mockcal->expectOnce('adjust', array()); |
|
218 | 218 | $Decorator = new Calendar_Decorator($this->mockcal); |
219 | 219 | $Decorator->adjust(); |
220 | 220 | } |
221 | 221 | function testToArray() |
222 | 222 | { |
223 | - $this->mockcal->expectOnce('toArray',array(12345)); |
|
223 | + $this->mockcal->expectOnce('toArray', array(12345)); |
|
224 | 224 | $testArray = array('foo'=>'bar'); |
225 | - $this->mockcal->setReturnValue('toArray',$testArray); |
|
225 | + $this->mockcal->setReturnValue('toArray', $testArray); |
|
226 | 226 | $Decorator = new Calendar_Decorator($this->mockcal); |
227 | - $this->assertEqual($testArray,$Decorator->toArray(12345)); |
|
227 | + $this->assertEqual($testArray, $Decorator->toArray(12345)); |
|
228 | 228 | } |
229 | 229 | function testReturnValue() |
230 | 230 | { |
231 | - $this->mockcal->expectOnce('returnValue',array('a','b','c','d')); |
|
232 | - $this->mockcal->setReturnValue('returnValue','foo'); |
|
231 | + $this->mockcal->expectOnce('returnValue', array('a', 'b', 'c', 'd')); |
|
232 | + $this->mockcal->setReturnValue('returnValue', 'foo'); |
|
233 | 233 | $Decorator = new Calendar_Decorator($this->mockcal); |
234 | - $this->assertEqual('foo',$Decorator->returnValue('a','b','c','d')); |
|
234 | + $this->assertEqual('foo', $Decorator->returnValue('a', 'b', 'c', 'd')); |
|
235 | 235 | } |
236 | 236 | function testSetFirst() |
237 | 237 | { |
238 | 238 | $mockday = new Mock_Calendar_Day($this); |
239 | - $mockday->expectOnce('setFirst',array(true)); |
|
239 | + $mockday->expectOnce('setFirst', array(true)); |
|
240 | 240 | $Decorator = new Calendar_Decorator($mockday); |
241 | 241 | $Decorator->setFirst(); |
242 | 242 | } |
243 | 243 | function testSetLast() |
244 | 244 | { |
245 | 245 | $mockday = new Mock_Calendar_Day($this); |
246 | - $mockday->expectOnce('setLast',array(true)); |
|
246 | + $mockday->expectOnce('setLast', array(true)); |
|
247 | 247 | $Decorator = new Calendar_Decorator($mockday); |
248 | 248 | $Decorator->setLast(); |
249 | 249 | } |
250 | 250 | function testIsFirst() |
251 | 251 | { |
252 | 252 | $mockday = new Mock_Calendar_Day($this); |
253 | - $mockday->setReturnValue('isFirst',TRUE); |
|
253 | + $mockday->setReturnValue('isFirst', TRUE); |
|
254 | 254 | $Decorator = new Calendar_Decorator($mockday); |
255 | 255 | $this->assertTrue($Decorator->isFirst()); |
256 | 256 | } |
257 | 257 | function testIsLast() |
258 | 258 | { |
259 | 259 | $mockday = new Mock_Calendar_Day($this); |
260 | - $mockday->setReturnValue('isLast',TRUE); |
|
260 | + $mockday->setReturnValue('isLast', TRUE); |
|
261 | 261 | $Decorator = new Calendar_Decorator($mockday); |
262 | 262 | $this->assertTrue($Decorator->isLast()); |
263 | 263 | } |
264 | 264 | function testSetEmpty() |
265 | 265 | { |
266 | 266 | $mockday = new Mock_Calendar_Day($this); |
267 | - $mockday->expectOnce('setEmpty',array(true)); |
|
267 | + $mockday->expectOnce('setEmpty', array(true)); |
|
268 | 268 | $Decorator = new Calendar_Decorator($mockday); |
269 | 269 | $Decorator->setEmpty(); |
270 | 270 | } |
271 | 271 | function testIsEmpty() |
272 | 272 | { |
273 | 273 | $mockday = new Mock_Calendar_Day($this); |
274 | - $mockday->setReturnValue('isEmpty',TRUE); |
|
274 | + $mockday->setReturnValue('isEmpty', TRUE); |
|
275 | 275 | $Decorator = new Calendar_Decorator($mockday); |
276 | 276 | $this->assertTrue($Decorator->isEmpty()); |
277 | 277 | } |
278 | 278 | function testBuild() |
279 | 279 | { |
280 | - $testArray=array('foo'=>'bar'); |
|
281 | - $this->mockcal->expectOnce('build',array($testArray)); |
|
280 | + $testArray = array('foo'=>'bar'); |
|
281 | + $this->mockcal->expectOnce('build', array($testArray)); |
|
282 | 282 | $Decorator = new Calendar_Decorator($this->mockcal); |
283 | 283 | $Decorator->build($testArray); |
284 | 284 | } |
285 | 285 | function testFetch() |
286 | 286 | { |
287 | - $this->mockcal->expectOnce('fetch',array()); |
|
287 | + $this->mockcal->expectOnce('fetch', array()); |
|
288 | 288 | $Decorator = new Calendar_Decorator($this->mockcal); |
289 | 289 | $Decorator->fetch(); |
290 | 290 | } |
291 | 291 | function testFetchAll() |
292 | 292 | { |
293 | - $this->mockcal->expectOnce('fetchAll',array()); |
|
293 | + $this->mockcal->expectOnce('fetchAll', array()); |
|
294 | 294 | $Decorator = new Calendar_Decorator($this->mockcal); |
295 | 295 | $Decorator->fetchAll(); |
296 | 296 | } |
297 | 297 | function testSize() |
298 | 298 | { |
299 | - $this->mockcal->expectOnce('size',array()); |
|
299 | + $this->mockcal->expectOnce('size', array()); |
|
300 | 300 | $Decorator = new Calendar_Decorator($this->mockcal); |
301 | 301 | $Decorator->size(); |
302 | 302 | } |
303 | 303 | function testIsValid() |
304 | 304 | { |
305 | - $this->mockcal->expectOnce('isValid',array()); |
|
305 | + $this->mockcal->expectOnce('isValid', array()); |
|
306 | 306 | $Decorator = new Calendar_Decorator($this->mockcal); |
307 | 307 | $Decorator->isValid(); |
308 | 308 | } |
309 | 309 | function testGetValidator() |
310 | 310 | { |
311 | - $this->mockcal->expectOnce('getValidator',array()); |
|
311 | + $this->mockcal->expectOnce('getValidator', array()); |
|
312 | 312 | $Decorator = new Calendar_Decorator($this->mockcal); |
313 | 313 | $Decorator->getValidator(); |
314 | 314 | } |
@@ -1,7 +1,7 @@ |
||
1 | 1 | <?php |
2 | 2 | // $Id: calendar_include.php 1511 2011-09-01 20:56:07Z jjdai $ |
3 | 3 | if (!@include 'Calendar/Calendar.php') { |
4 | - @define('CALENDAR_ROOT','../'); |
|
4 | + @define('CALENDAR_ROOT', '../'); |
|
5 | 5 | } |
6 | 6 | require_once(CALENDAR_ROOT . 'Year.php'); |
7 | 7 | require_once(CALENDAR_ROOT . 'Month.php'); |
@@ -17,9 +17,9 @@ discard block |
||
17 | 17 | } |
18 | 18 | function setUp() |
19 | 19 | { |
20 | - $this->cal = new Calendar_Day(2003,10,25); |
|
20 | + $this->cal = new Calendar_Day(2003, 10, 25); |
|
21 | 21 | } |
22 | - function testPrevDay_Array () |
|
22 | + function testPrevDay_Array() |
|
23 | 23 | { |
24 | 24 | $this->assertEqual( |
25 | 25 | array( |
@@ -31,46 +31,46 @@ discard block |
||
31 | 31 | 'second' => 0), |
32 | 32 | $this->cal->prevDay('array')); |
33 | 33 | } |
34 | - function testPrevHour () |
|
34 | + function testPrevHour() |
|
35 | 35 | { |
36 | - $this->assertEqual(23,$this->cal->prevHour()); |
|
36 | + $this->assertEqual(23, $this->cal->prevHour()); |
|
37 | 37 | } |
38 | - function testThisHour () |
|
38 | + function testThisHour() |
|
39 | 39 | { |
40 | - $this->assertEqual(0,$this->cal->thisHour()); |
|
40 | + $this->assertEqual(0, $this->cal->thisHour()); |
|
41 | 41 | } |
42 | - function testNextHour () |
|
42 | + function testNextHour() |
|
43 | 43 | { |
44 | - $this->assertEqual(1,$this->cal->nextHour()); |
|
44 | + $this->assertEqual(1, $this->cal->nextHour()); |
|
45 | 45 | } |
46 | - function testPrevMinute () |
|
46 | + function testPrevMinute() |
|
47 | 47 | { |
48 | - $this->assertEqual(59,$this->cal->prevMinute()); |
|
48 | + $this->assertEqual(59, $this->cal->prevMinute()); |
|
49 | 49 | } |
50 | - function testThisMinute () |
|
50 | + function testThisMinute() |
|
51 | 51 | { |
52 | - $this->assertEqual(0,$this->cal->thisMinute()); |
|
52 | + $this->assertEqual(0, $this->cal->thisMinute()); |
|
53 | 53 | } |
54 | - function testNextMinute () |
|
54 | + function testNextMinute() |
|
55 | 55 | { |
56 | - $this->assertEqual(1,$this->cal->nextMinute()); |
|
56 | + $this->assertEqual(1, $this->cal->nextMinute()); |
|
57 | 57 | } |
58 | - function testPrevSecond () |
|
58 | + function testPrevSecond() |
|
59 | 59 | { |
60 | - $this->assertEqual(59,$this->cal->prevSecond()); |
|
60 | + $this->assertEqual(59, $this->cal->prevSecond()); |
|
61 | 61 | } |
62 | - function testThisSecond () |
|
62 | + function testThisSecond() |
|
63 | 63 | { |
64 | - $this->assertEqual(0,$this->cal->thisSecond()); |
|
64 | + $this->assertEqual(0, $this->cal->thisSecond()); |
|
65 | 65 | } |
66 | - function testNextSecond () |
|
66 | + function testNextSecond() |
|
67 | 67 | { |
68 | - $this->assertEqual(1,$this->cal->nextSecond()); |
|
68 | + $this->assertEqual(1, $this->cal->nextSecond()); |
|
69 | 69 | } |
70 | 70 | function testGetTimeStamp() |
71 | 71 | { |
72 | - $stamp = mktime(0,0,0,10,25,2003); |
|
73 | - $this->assertEqual($stamp,$this->cal->getTimeStamp()); |
|
72 | + $stamp = mktime(0, 0, 0, 10, 25, 2003); |
|
73 | + $this->assertEqual($stamp, $this->cal->getTimeStamp()); |
|
74 | 74 | } |
75 | 75 | } |
76 | 76 | |
@@ -86,36 +86,36 @@ discard block |
||
86 | 86 | function testSize() |
87 | 87 | { |
88 | 88 | $this->cal->build(); |
89 | - $this->assertEqual(24,$this->cal->size()); |
|
89 | + $this->assertEqual(24, $this->cal->size()); |
|
90 | 90 | } |
91 | 91 | function testFetch() |
92 | 92 | { |
93 | 93 | $this->cal->build(); |
94 | - $i=0; |
|
95 | - while ( $Child = $this->cal->fetch() ) { |
|
94 | + $i = 0; |
|
95 | + while ($Child = $this->cal->fetch()) { |
|
96 | 96 | ++$i; |
97 | 97 | } |
98 | - $this->assertEqual(24,$i); |
|
98 | + $this->assertEqual(24, $i); |
|
99 | 99 | } |
100 | 100 | function testFetchAll() |
101 | 101 | { |
102 | 102 | $this->cal->build(); |
103 | 103 | $children = array(); |
104 | 104 | $i = 0; |
105 | - while ( $Child = $this->cal->fetch() ) { |
|
106 | - $children[$i]=$Child; |
|
105 | + while ($Child = $this->cal->fetch()) { |
|
106 | + $children[$i] = $Child; |
|
107 | 107 | ++$i; |
108 | 108 | } |
109 | - $this->assertEqual($children,$this->cal->fetchAll()); |
|
109 | + $this->assertEqual($children, $this->cal->fetchAll()); |
|
110 | 110 | } |
111 | 111 | function testSelection() |
112 | 112 | { |
113 | 113 | require_once(CALENDAR_ROOT . 'Hour.php'); |
114 | - $selection = array(new Calendar_Hour(2003,10,25,13)); |
|
114 | + $selection = array(new Calendar_Hour(2003, 10, 25, 13)); |
|
115 | 115 | $this->cal->build($selection); |
116 | 116 | $i = 0; |
117 | - while ( $Child = $this->cal->fetch() ) { |
|
118 | - if ( $i == 13 ) |
|
117 | + while ($Child = $this->cal->fetch()) { |
|
118 | + if ($i == 13) |
|
119 | 119 | break; |
120 | 120 | ++$i; |
121 | 121 | } |