@@ -1,9 +1,10 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if (!defined('T_ML_COMMENT')) |
|
| 3 | +if (!defined('T_ML_COMMENT')) { |
|
| 4 | 4 | define('T_ML_COMMENT', T_COMMENT); |
| 5 | -else |
|
| 5 | +} else { |
|
| 6 | 6 | define('T_DOC_COMMENT', T_ML_COMMENT); |
| 7 | +} |
|
| 7 | 8 | |
| 8 | 9 | class HtmlReporterWithCoverage extends HtmlReporter |
| 9 | 10 | { |
@@ -32,8 +33,9 @@ discard block |
||
| 32 | 33 | print "<h1>$test_name</h1>\n"; |
| 33 | 34 | flush(); |
| 34 | 35 | |
| 35 | - if (extension_loaded('xdebug')) |
|
| 36 | - xdebug_start_code_coverage(XDEBUG_CC_UNUSED); |
|
| 36 | + if (extension_loaded('xdebug')) { |
|
| 37 | + xdebug_start_code_coverage(XDEBUG_CC_UNUSED); |
|
| 38 | + } |
|
| 37 | 39 | |
| 38 | 40 | } |
| 39 | 41 | |
@@ -91,8 +93,9 @@ discard block |
||
| 91 | 93 | function paintCoverage() |
| 92 | 94 | { |
| 93 | 95 | $dir = dirname(__FILE__); |
| 94 | - if(count($this->coverage) > 0) |
|
| 95 | - print '<h2>Code Coverage</h2>'; |
|
| 96 | + if(count($this->coverage) > 0) { |
|
| 97 | + print '<h2>Code Coverage</h2>'; |
|
| 98 | + } |
|
| 96 | 99 | |
| 97 | 100 | |
| 98 | 101 | ksort($this->coverage); |
@@ -175,10 +178,11 @@ discard block |
||
| 175 | 178 | $line = htmlspecialchars($line); |
| 176 | 179 | $line = str_replace(' ',' ',$line); |
| 177 | 180 | $line = str_replace("\t",' ',$line); |
| 178 | - if(in_array($count+1, $this->lines)) |
|
| 179 | - echo "<div class=\"highlight\"><tt>$num $line</tt></div>\n"; |
|
| 180 | - else |
|
| 181 | - echo "<tt>$num $line</tt><br />\n"; |
|
| 181 | + if(in_array($count+1, $this->lines)) { |
|
| 182 | + echo "<div class=\"highlight\"><tt>$num $line</tt></div>\n"; |
|
| 183 | + } else { |
|
| 184 | + echo "<tt>$num $line</tt><br />\n"; |
|
| 185 | + } |
|
| 182 | 186 | } |
| 183 | 187 | |
| 184 | 188 | $this->paintFooter(); |
@@ -224,8 +228,7 @@ discard block |
||
| 224 | 228 | { |
| 225 | 229 | // simple 1-character token |
| 226 | 230 | $lines .= $token; |
| 227 | - } |
|
| 228 | - else |
|
| 231 | + } else |
|
| 229 | 232 | { |
| 230 | 233 | // token array |
| 231 | 234 | list($id, $text) = $token; |
@@ -256,8 +259,9 @@ discard block |
||
| 256 | 259 | $pattern = '/'.implode('|', $patterns).'/'; |
| 257 | 260 | foreach($codelines as $line) |
| 258 | 261 | { |
| 259 | - if(!preg_match($pattern, $line)) |
|
| 260 | - $count++; |
|
| 262 | + if(!preg_match($pattern, $line)) { |
|
| 263 | + $count++; |
|
| 264 | + } |
|
| 261 | 265 | } |
| 262 | 266 | return $count; |
| 263 | 267 | //var_dump($codelines); |
@@ -163,13 +163,15 @@ |
||
| 163 | 163 | { |
| 164 | 164 | $this->keys(PHPUnit_Extensions_Selenium2TestCase_Keys::END); |
| 165 | 165 | // the number 100 is purely empiric |
| 166 | - for($i=0;$i<100;$i++) |
|
| 167 | - $this->keys(PHPUnit_Extensions_Selenium2TestCase_Keys::BACKSPACE); |
|
| 166 | + for($i=0;$i<100;$i++) { |
|
| 167 | + $this->keys(PHPUnit_Extensions_Selenium2TestCase_Keys::BACKSPACE); |
|
| 168 | + } |
|
| 168 | 169 | |
| 169 | 170 | $this->keys(PHPUnit_Extensions_Selenium2TestCase_Keys::HOME); |
| 170 | 171 | // the number 100 is purely empiric |
| 171 | - for($i=0;$i<100;$i++) |
|
| 172 | - $this->keys(PHPUnit_Extensions_Selenium2TestCase_Keys::DELETE); |
|
| 172 | + for($i=0;$i<100;$i++) { |
|
| 173 | + $this->keys(PHPUnit_Extensions_Selenium2TestCase_Keys::DELETE); |
|
| 174 | + } |
|
| 173 | 175 | } |
| 174 | 176 | |
| 175 | 177 | $element->value($txt); |
@@ -95,7 +95,9 @@ discard block |
||
| 95 | 95 | return $this->_callorder; |
| 96 | 96 | } |
| 97 | 97 | public function __dycall($method, $args) { |
| 98 | - if(strncasecmp($method,'fx',2)!==0) return; |
|
| 98 | + if(strncasecmp($method,'fx',2)!==0) { |
|
| 99 | + return; |
|
| 100 | + } |
|
| 99 | 101 | $this->_callorder[] = 'fxcall'; |
| 100 | 102 | } |
| 101 | 103 | public function fxGlobalListener($sender,$param,$name) { |
@@ -176,14 +178,18 @@ discard block |
||
| 176 | 178 | } |
| 177 | 179 | class DynamicCallComponent extends NewComponent implements IDynamicMethods { |
| 178 | 180 | public function __dycall($method, $args) { |
| 179 | - if($method === 'dyPowerFunction') |
|
| 180 | - return pow($args[0], $args[1]); |
|
| 181 | - if($method === 'dyDivisionFunction') |
|
| 182 | - return $args[0] / $args[1]; |
|
| 183 | - if($method === 'fxPowerFunction') |
|
| 184 | - return 2*pow($args[0], $args[1]); |
|
| 185 | - if($method === 'fxDivisionFunction') |
|
| 186 | - return 2*$args[0] / $args[1]; |
|
| 181 | + if($method === 'dyPowerFunction') { |
|
| 182 | + return pow($args[0], $args[1]); |
|
| 183 | + } |
|
| 184 | + if($method === 'dyDivisionFunction') { |
|
| 185 | + return $args[0] / $args[1]; |
|
| 186 | + } |
|
| 187 | + if($method === 'fxPowerFunction') { |
|
| 188 | + return 2*pow($args[0], $args[1]); |
|
| 189 | + } |
|
| 190 | + if($method === 'fxDivisionFunction') { |
|
| 191 | + return 2*$args[0] / $args[1]; |
|
| 192 | + } |
|
| 187 | 193 | } |
| 188 | 194 | } |
| 189 | 195 | |
@@ -370,8 +376,9 @@ discard block |
||
| 370 | 376 | } |
| 371 | 377 | public function __dycall($method, $args) { |
| 372 | 378 | $this->_dyMethod = $method; |
| 373 | - if($method == 'dyTestDynamicBehaviorMethod') |
|
| 374 | - return $args[0] / $args[1]; |
|
| 379 | + if($method == 'dyTestDynamicBehaviorMethod') { |
|
| 380 | + return $args[0] / $args[1]; |
|
| 381 | + } |
|
| 375 | 382 | } |
| 376 | 383 | public function dyTestIntraEvent($param1, $param2, $chain) { |
| 377 | 384 | return $chain->dyTestIntraEvent($param1*2*$param2, $param2); |
@@ -391,8 +398,9 @@ discard block |
||
| 391 | 398 | public function __dycall($method, $args) { |
| 392 | 399 | $this->_dyMethod = $method; |
| 393 | 400 | $object = array_shift($args); |
| 394 | - if($method == 'dyTestDynamicClassBehaviorMethod') |
|
| 395 | - return $args[0] / $args[1]; |
|
| 401 | + if($method == 'dyTestDynamicClassBehaviorMethod') { |
|
| 402 | + return $args[0] / $args[1]; |
|
| 403 | + } |
|
| 396 | 404 | } |
| 397 | 405 | public function dyTestIntraEvent($object, $param1, $param2, $chain) { |
| 398 | 406 | return $chain->dyTestIntraEvent($param1*2*$param2, $param2); |
@@ -420,8 +428,9 @@ discard block |
||
| 420 | 428 | public function tearDown() { |
| 421 | 429 | // PHP version 5.3.6 doesn't call the __destruct method when unsetting variables; |
| 422 | 430 | // Thus any object that listens must be explicitly call unlisten in this version of PHP. |
| 423 | - if($this->component) |
|
| 424 | - $this->component->unlisten(); |
|
| 431 | + if($this->component) { |
|
| 432 | + $this->component->unlisten(); |
|
| 433 | + } |
|
| 425 | 434 | $this->component = null; |
| 426 | 435 | } |
| 427 | 436 | |
@@ -117,8 +117,7 @@ discard block |
||
| 117 | 117 | try { |
| 118 | 118 | $list->add(1); |
| 119 | 119 | self::fail('An expected TInvalidOperationException was not raised'); |
| 120 | - } |
|
| 121 | - catch (TInvalidOperationException $e) { |
|
| 120 | + } catch (TInvalidOperationException $e) { |
|
| 122 | 121 | } |
| 123 | 122 | } |
| 124 | 123 | |
@@ -132,8 +131,7 @@ discard block |
||
| 132 | 131 | try { |
| 133 | 132 | $this->list->insertAt(4, $this->item3); |
| 134 | 133 | $this->fail('exception not raised when adding item at an out-of-range index'); |
| 135 | - } |
|
| 136 | - catch (TInvalidDataValueException $e) { |
|
| 134 | + } catch (TInvalidDataValueException $e) { |
|
| 137 | 135 | } |
| 138 | 136 | } |
| 139 | 137 | |
@@ -143,14 +141,12 @@ discard block |
||
| 143 | 141 | try { |
| 144 | 142 | $list->insertAt(1, 2); |
| 145 | 143 | self::fail('An expected TInvalidOperationException was not raised'); |
| 146 | - } |
|
| 147 | - catch (TInvalidOperationException $e) { |
|
| 144 | + } catch (TInvalidOperationException $e) { |
|
| 148 | 145 | } |
| 149 | 146 | try { |
| 150 | 147 | $list->insertAt(0, 2); |
| 151 | 148 | self::fail('An expected TInvalidOperationException was not raised'); |
| 152 | - } |
|
| 153 | - catch (TInvalidOperationException $e) { |
|
| 149 | + } catch (TInvalidOperationException $e) { |
|
| 154 | 150 | } |
| 155 | 151 | } |
| 156 | 152 | |
@@ -159,8 +155,7 @@ discard block |
||
| 159 | 155 | try { |
| 160 | 156 | $this->list->insertBefore($this->item4, $this->item3); |
| 161 | 157 | $this->fail('exception not raised when adding item before a non-existant base item'); |
| 162 | - } |
|
| 163 | - catch (TInvalidDataValueException $e) { |
|
| 158 | + } catch (TInvalidDataValueException $e) { |
|
| 164 | 159 | } |
| 165 | 160 | $this->assertEquals(2, $this->list->getCount()); |
| 166 | 161 | $this->assertEquals(0, $this->list->insertBefore($this->item1, $this->item3)); |
@@ -178,14 +173,12 @@ discard block |
||
| 178 | 173 | try { |
| 179 | 174 | $list->insertBefore(5, 6); |
| 180 | 175 | self::fail('An expected TInvalidOperationException was not raised'); |
| 181 | - } |
|
| 182 | - catch (TInvalidOperationException $e) { |
|
| 176 | + } catch (TInvalidOperationException $e) { |
|
| 183 | 177 | } |
| 184 | 178 | try { |
| 185 | 179 | $list->insertBefore(8, 6); |
| 186 | 180 | self::fail('An expected TInvalidOperationException was not raised'); |
| 187 | - } |
|
| 188 | - catch (TInvalidOperationException $e) { |
|
| 181 | + } catch (TInvalidOperationException $e) { |
|
| 189 | 182 | } |
| 190 | 183 | } |
| 191 | 184 | |
@@ -194,8 +187,7 @@ discard block |
||
| 194 | 187 | try { |
| 195 | 188 | $this->list->insertAfter($this->item4, $this->item3); |
| 196 | 189 | $this->fail('exception not raised when adding item after a non-existant base item'); |
| 197 | - } |
|
| 198 | - catch (TInvalidDataValueException $e) { |
|
| 190 | + } catch (TInvalidDataValueException $e) { |
|
| 199 | 191 | } |
| 200 | 192 | $this->assertEquals(2, $this->list->getCount()); |
| 201 | 193 | $this->assertEquals(2, $this->list->insertAfter($this->item2, $this->item3)); |
@@ -213,14 +205,12 @@ discard block |
||
| 213 | 205 | try { |
| 214 | 206 | $list->insertAfter(5, 6); |
| 215 | 207 | self::fail('An expected TInvalidOperationException was not raised'); |
| 216 | - } |
|
| 217 | - catch (TInvalidOperationException $e) { |
|
| 208 | + } catch (TInvalidOperationException $e) { |
|
| 218 | 209 | } |
| 219 | 210 | try { |
| 220 | 211 | $list->insertAfter(8, 6); |
| 221 | 212 | self::fail('An expected TInvalidOperationException was not raised'); |
| 222 | - } |
|
| 223 | - catch (TInvalidOperationException $e) { |
|
| 213 | + } catch (TInvalidOperationException $e) { |
|
| 224 | 214 | } |
| 225 | 215 | } |
| 226 | 216 | |
@@ -233,8 +223,7 @@ discard block |
||
| 233 | 223 | try { |
| 234 | 224 | $this->list->remove($this->item1); |
| 235 | 225 | $this->fail('exception not raised when removing nonexisting item'); |
| 236 | - } |
|
| 237 | - catch (Exception $e) { |
|
| 226 | + } catch (Exception $e) { |
|
| 238 | 227 | } |
| 239 | 228 | } |
| 240 | 229 | |
@@ -246,8 +235,7 @@ discard block |
||
| 246 | 235 | try { |
| 247 | 236 | $list->remove(2); |
| 248 | 237 | self::fail('An expected TInvalidOperationException was not raised'); |
| 249 | - } |
|
| 250 | - catch (TInvalidOperationException $e) { |
|
| 238 | + } catch (TInvalidOperationException $e) { |
|
| 251 | 239 | } |
| 252 | 240 | |
| 253 | 241 | $list = new TPriorityList(array( |
@@ -256,8 +244,7 @@ discard block |
||
| 256 | 244 | try { |
| 257 | 245 | $list->remove(10); |
| 258 | 246 | self::fail('An expected TInvalidOperationException was not raised'); |
| 259 | - } |
|
| 260 | - catch (TInvalidOperationException $e) { |
|
| 247 | + } catch (TInvalidOperationException $e) { |
|
| 261 | 248 | } |
| 262 | 249 | } |
| 263 | 250 | |
@@ -271,8 +258,7 @@ discard block |
||
| 271 | 258 | try { |
| 272 | 259 | $this->list->removeAt(2); |
| 273 | 260 | $this->fail('exception not raised when removing item with invalid index'); |
| 274 | - } |
|
| 275 | - catch (TInvalidDataValueException $e) { |
|
| 261 | + } catch (TInvalidDataValueException $e) { |
|
| 276 | 262 | } |
| 277 | 263 | } |
| 278 | 264 | |
@@ -284,8 +270,7 @@ discard block |
||
| 284 | 270 | try { |
| 285 | 271 | $list->removeAt(2); |
| 286 | 272 | self::fail('An expected TInvalidOperationException was not raised'); |
| 287 | - } |
|
| 288 | - catch (TInvalidOperationException $e) { |
|
| 273 | + } catch (TInvalidOperationException $e) { |
|
| 289 | 274 | } |
| 290 | 275 | |
| 291 | 276 | $list = new TPriorityList(array( |
@@ -294,8 +279,7 @@ discard block |
||
| 294 | 279 | try { |
| 295 | 280 | $list->removeAt(10); |
| 296 | 281 | self::fail('An expected TInvalidOperationException was not raised'); |
| 297 | - } |
|
| 298 | - catch (TInvalidOperationException $e) { |
|
| 282 | + } catch (TInvalidOperationException $e) { |
|
| 299 | 283 | } |
| 300 | 284 | } |
| 301 | 285 | |
@@ -314,8 +298,7 @@ discard block |
||
| 314 | 298 | ), true); |
| 315 | 299 | try { |
| 316 | 300 | $list->clear(); |
| 317 | - } |
|
| 318 | - catch (TInvalidOperationException $e) { |
|
| 301 | + } catch (TInvalidOperationException $e) { |
|
| 319 | 302 | return; |
| 320 | 303 | } |
| 321 | 304 | self::fail('An expected TInvalidOperationException was not raised'); |
@@ -345,8 +328,7 @@ discard block |
||
| 345 | 328 | try { |
| 346 | 329 | $this->list->copyFrom($this); |
| 347 | 330 | $this->fail('exception not raised when copying from non-traversable object'); |
| 348 | - } |
|
| 349 | - catch (TInvalidDataTypeException $e) { |
|
| 331 | + } catch (TInvalidDataTypeException $e) { |
|
| 350 | 332 | } |
| 351 | 333 | } |
| 352 | 334 | |
@@ -360,8 +342,7 @@ discard block |
||
| 360 | 342 | try { |
| 361 | 343 | $this->list->mergeWith($this); |
| 362 | 344 | $this->fail('exception not raised when copying from non-traversable object'); |
| 363 | - } |
|
| 364 | - catch (TInvalidDataTypeException $e) { |
|
| 345 | + } catch (TInvalidDataTypeException $e) { |
|
| 365 | 346 | } |
| 366 | 347 | } |
| 367 | 348 | |
@@ -378,8 +359,7 @@ discard block |
||
| 378 | 359 | try { |
| 379 | 360 | $a = $this->list[2]; |
| 380 | 361 | $this->fail('exception not raised when accessing item with out-of-range index'); |
| 381 | - } |
|
| 382 | - catch (TInvalidDataValueException $e) { |
|
| 362 | + } catch (TInvalidDataValueException $e) { |
|
| 383 | 363 | } |
| 384 | 364 | } |
| 385 | 365 | |
@@ -390,10 +370,12 @@ discard block |
||
| 390 | 370 | foreach ($this->list as $index => $item) { |
| 391 | 371 | foreach ($this->list as $a => $b); // test of iterator |
| 392 | 372 | $n++; |
| 393 | - if ($index === 0 && $item === $this->item1) |
|
| 394 | - $found++; |
|
| 395 | - if ($index === 1 && $item === $this->item2) |
|
| 396 | - $found++; |
|
| 373 | + if ($index === 0 && $item === $this->item1) { |
|
| 374 | + $found++; |
|
| 375 | + } |
|
| 376 | + if ($index === 1 && $item === $this->item2) { |
|
| 377 | + $found++; |
|
| 378 | + } |
|
| 397 | 379 | } |
| 398 | 380 | $this->assertTrue($n == 2 && $found == 2); |
| 399 | 381 | } |
@@ -552,8 +534,7 @@ discard block |
||
| 552 | 534 | try { |
| 553 | 535 | $plist->insertAt(5, $this->pitem3); |
| 554 | 536 | $this->fail('exception not raised when adding item at an out-of-range index'); |
| 555 | - } |
|
| 556 | - catch (TInvalidDataValueException $e) { |
|
| 537 | + } catch (TInvalidDataValueException $e) { |
|
| 557 | 538 | } |
| 558 | 539 | $this->assertEquals(100, $plist->priorityAt(4)); |
| 559 | 540 | } |
@@ -588,22 +569,19 @@ discard block |
||
| 588 | 569 | try { |
| 589 | 570 | $plist->remove($this->pitem5); |
| 590 | 571 | $this->fail('Exception not raised: TInvalidDataValueException: The item cannot be found in the list'); |
| 591 | - } |
|
| 592 | - catch (TInvalidDataValueException $v) { |
|
| 572 | + } catch (TInvalidDataValueException $v) { |
|
| 593 | 573 | } |
| 594 | 574 | |
| 595 | 575 | try { |
| 596 | 576 | $plist->remove($this->pitem3, null); |
| 597 | 577 | $this->fail('Exception not raised: TInvalidDataValueException: The item cannot be found in the list'); |
| 598 | - } |
|
| 599 | - catch (TInvalidDataValueException $v) { |
|
| 578 | + } catch (TInvalidDataValueException $v) { |
|
| 600 | 579 | } |
| 601 | 580 | |
| 602 | 581 | try { |
| 603 | 582 | $plist->remove($this->pitem1, 100); |
| 604 | 583 | $this->fail('Exception not raised: TInvalidDataValueException: The item cannot be found in the list'); |
| 605 | - } |
|
| 606 | - catch (TInvalidDataValueException $v) { |
|
| 584 | + } catch (TInvalidDataValueException $v) { |
|
| 607 | 585 | } |
| 608 | 586 | |
| 609 | 587 | $plist->insertBefore($this->pitem3, $this->pitem4); |
@@ -621,8 +599,7 @@ discard block |
||
| 621 | 599 | try { |
| 622 | 600 | $plist->removeAt(3); |
| 623 | 601 | $this->fail('exception not raised when removing item with invalid index'); |
| 624 | - } |
|
| 625 | - catch (TInvalidDataValueException $e) { |
|
| 602 | + } catch (TInvalidDataValueException $e) { |
|
| 626 | 603 | } |
| 627 | 604 | } |
| 628 | 605 | |
@@ -773,8 +750,7 @@ discard block |
||
| 773 | 750 | try { |
| 774 | 751 | $list->insertAtIndexInPriority(1); |
| 775 | 752 | self::fail('An expected TInvalidOperationException was not raised'); |
| 776 | - } |
|
| 777 | - catch (TInvalidOperationException $e) { |
|
| 753 | + } catch (TInvalidOperationException $e) { |
|
| 778 | 754 | } |
| 779 | 755 | } |
| 780 | 756 | |
@@ -785,8 +761,7 @@ discard block |
||
| 785 | 761 | try { |
| 786 | 762 | $plist->removeAtIndexInPriority(1, 100); |
| 787 | 763 | $this->fail('TInvalidDataValueException not raised when accessing item with out-of-range index'); |
| 788 | - } |
|
| 789 | - catch (TInvalidDataValueException $e) { |
|
| 764 | + } catch (TInvalidDataValueException $e) { |
|
| 790 | 765 | } |
| 791 | 766 | $this->assertEquals($this->pitem2, $plist->removeAtIndexInPriority(1)); |
| 792 | 767 | $this->assertEquals($this->pitem3, $plist->removeAtIndexInPriority(0, 100)); |
@@ -794,8 +769,7 @@ discard block |
||
| 794 | 769 | try { |
| 795 | 770 | $plist->removeAtIndexInPriority(0, 200); |
| 796 | 771 | $this->fail('TInvalidDataValueException not raised when accessing item with out-of-range index'); |
| 797 | - } |
|
| 798 | - catch (TInvalidDataValueException $e) { |
|
| 772 | + } catch (TInvalidDataValueException $e) { |
|
| 799 | 773 | } |
| 800 | 774 | $this->assertEquals($this->pfirst, $plist->removeAtIndexInPriority(0, -10000000)); |
| 801 | 775 | $this->assertEquals(0, $plist->getCount()); |
@@ -808,8 +782,7 @@ discard block |
||
| 808 | 782 | try { |
| 809 | 783 | $plist->removeAtIndexInPriority(0); |
| 810 | 784 | self::fail('An expected TInvalidOperationException was not raised'); |
| 811 | - } |
|
| 812 | - catch (TInvalidOperationException $e) { |
|
| 785 | + } catch (TInvalidOperationException $e) { |
|
| 813 | 786 | } |
| 814 | 787 | } |
| 815 | 788 | |
@@ -1043,8 +1016,7 @@ discard block |
||
| 1043 | 1016 | try { |
| 1044 | 1017 | $a = $this->plist[4]; |
| 1045 | 1018 | $this->fail('exception not raised when accessing item with out-of-range index'); |
| 1046 | - } |
|
| 1047 | - catch (TInvalidDataValueException $e) { |
|
| 1019 | + } catch (TInvalidDataValueException $e) { |
|
| 1048 | 1020 | } |
| 1049 | 1021 | } |
| 1050 | 1022 | |
@@ -1057,14 +1029,18 @@ discard block |
||
| 1057 | 1029 | |
| 1058 | 1030 | foreach ($this->plist as $index => $item) { |
| 1059 | 1031 | $n++; |
| 1060 | - if ($index === 0 && $item === $this->pfirst) |
|
| 1061 | - $found++; |
|
| 1062 | - if ($index === 1 && $item === $this->pitem1) |
|
| 1063 | - $found++; |
|
| 1064 | - if ($index === 2 && $item === $this->pitem2) |
|
| 1065 | - $found++; |
|
| 1066 | - if ($index === 3 && $item === $this->pitem3) |
|
| 1067 | - $found++; |
|
| 1032 | + if ($index === 0 && $item === $this->pfirst) { |
|
| 1033 | + $found++; |
|
| 1034 | + } |
|
| 1035 | + if ($index === 1 && $item === $this->pitem1) { |
|
| 1036 | + $found++; |
|
| 1037 | + } |
|
| 1038 | + if ($index === 2 && $item === $this->pitem2) { |
|
| 1039 | + $found++; |
|
| 1040 | + } |
|
| 1041 | + if ($index === 3 && $item === $this->pitem3) { |
|
| 1042 | + $found++; |
|
| 1043 | + } |
|
| 1068 | 1044 | } |
| 1069 | 1045 | $this->assertTrue($n == 4 && $found == 4); |
| 1070 | 1046 | } |
@@ -288,10 +288,12 @@ |
||
| 288 | 288 | foreach($this->list as $index=>$item) { |
| 289 | 289 | foreach($this->list as $a=>$b); // test of iterator |
| 290 | 290 | $n++; |
| 291 | - if($index===0 && $item===$this->item1) |
|
| 292 | - $found++; |
|
| 293 | - if($index===1 && $item===$this->item2) |
|
| 294 | - $found++; |
|
| 291 | + if($index===0 && $item===$this->item1) { |
|
| 292 | + $found++; |
|
| 293 | + } |
|
| 294 | + if($index===1 && $item===$this->item2) { |
|
| 295 | + $found++; |
|
| 296 | + } |
|
| 295 | 297 | } |
| 296 | 298 | $this->assertTrue($n==2 && $found==2); |
| 297 | 299 | } |
@@ -127,8 +127,7 @@ discard block |
||
| 127 | 127 | { |
| 128 | 128 | $this->map->copyFrom($this); |
| 129 | 129 | $this->fail('no exception raised when copying a non-traversable object'); |
| 130 | - } |
|
| 131 | - catch(TInvalidDataTypeException $e) |
|
| 130 | + } catch(TInvalidDataTypeException $e) |
|
| 132 | 131 | { |
| 133 | 132 | |
| 134 | 133 | } |
@@ -145,8 +144,7 @@ discard block |
||
| 145 | 144 | { |
| 146 | 145 | $this->map->mergeWith($this); |
| 147 | 146 | $this->fail('no exception raised when copying a non-traversable object'); |
| 148 | - } |
|
| 149 | - catch(TInvalidDataTypeException $e) |
|
| 147 | + } catch(TInvalidDataTypeException $e) |
|
| 150 | 148 | { |
| 151 | 149 | |
| 152 | 150 | } |
@@ -174,8 +172,7 @@ discard block |
||
| 174 | 172 | { |
| 175 | 173 | unset($this->map['unknown key']); |
| 176 | 174 | |
| 177 | - } |
|
| 178 | - catch(Exception $e) |
|
| 175 | + } catch(Exception $e) |
|
| 179 | 176 | { |
| 180 | 177 | $this->fail('exception raised when unsetting element with unknown key'); |
| 181 | 178 | } |
@@ -188,10 +185,12 @@ discard block |
||
| 188 | 185 | foreach($this->map as $index=>$item) |
| 189 | 186 | { |
| 190 | 187 | $n++; |
| 191 | - if($index==='key1' && $item===$this->item1) |
|
| 192 | - $found++; |
|
| 193 | - if($index==='key2' && $item===$this->item2) |
|
| 194 | - $found++; |
|
| 188 | + if($index==='key1' && $item===$this->item1) { |
|
| 189 | + $found++; |
|
| 190 | + } |
|
| 191 | + if($index==='key2' && $item===$this->item2) { |
|
| 192 | + $found++; |
|
| 193 | + } |
|
| 195 | 194 | } |
| 196 | 195 | $this->assertTrue($n==2 && $found==2); |
| 197 | 196 | } |
@@ -55,8 +55,9 @@ discard block |
||
| 55 | 55 | 'pliko\'w' => array(5,6,7,11,12,15,17,20,21,25,26,30)); |
| 56 | 56 | foreach($wants as $want => $numbers) |
| 57 | 57 | { |
| 58 | - foreach($numbers as $n) |
|
| 59 | - $this->assertEquals($want, $choice->format($string, $n)); |
|
| 58 | + foreach($numbers as $n) { |
|
| 59 | + $this->assertEquals($want, $choice->format($string, $n)); |
|
| 60 | + } |
|
| 60 | 61 | } |
| 61 | 62 | } |
| 62 | 63 | |
@@ -74,8 +75,9 @@ discard block |
||
| 74 | 75 | ); |
| 75 | 76 | foreach($wants as $want => $numbers) |
| 76 | 77 | { |
| 77 | - foreach($numbers as $n) |
|
| 78 | - $this->assertEquals($want, $choice->format($string, $n)); |
|
| 78 | + foreach($numbers as $n) { |
|
| 79 | + $this->assertEquals($want, $choice->format($string, $n)); |
|
| 80 | + } |
|
| 79 | 81 | } |
| 80 | 82 | } |
| 81 | 83 | |
@@ -92,8 +94,9 @@ discard block |
||
| 92 | 94 | ); |
| 93 | 95 | foreach($wants as $want => $numbers) |
| 94 | 96 | { |
| 95 | - foreach($numbers as $n) |
|
| 96 | - $this->assertEquals($want, $choice->format($string, $n)); |
|
| 97 | + foreach($numbers as $n) { |
|
| 98 | + $this->assertEquals($want, $choice->format($string, $n)); |
|
| 99 | + } |
|
| 97 | 100 | } |
| 98 | 101 | } |
| 99 | 102 | } |
@@ -107,16 +107,18 @@ |
||
| 107 | 107 | for ($max += $i; $i < $max; $i += $offset) { |
| 108 | 108 | $ret = $s->formatDate('m,d,Y,H,i,s',$i); |
| 109 | 109 | $arr = explode(',',$ret); |
| 110 | - if ($lastyear != $arr[2]) |
|
| 111 | - $lastyear = $arr[2]; |
|
| 110 | + if ($lastyear != $arr[2]) { |
|
| 111 | + $lastyear = $arr[2]; |
|
| 112 | + } |
|
| 112 | 113 | |
| 113 | 114 | $newi = $s->getTimestamp($arr[3],$arr[4],$arr[5],$arr[0],$arr[1],$arr[2]); |
| 114 | 115 | if ($i != $newi) { |
| 115 | 116 | // This actually can fail if $i is in the middle of a time change due to DST |
| 116 | 117 | $tz = new DateTimeZone(date_default_timezone_get()); |
| 117 | 118 | $transitions = $tz->getTransitions($i-3600, $i+3600); |
| 118 | - if(count($transitions) == 0) |
|
| 119 | - $fails++; |
|
| 119 | + if(count($transitions) == 0) { |
|
| 120 | + $fails++; |
|
| 121 | + } |
|
| 120 | 122 | |
| 121 | 123 | //$j = mktime($arr[3],$arr[4],$arr[5],$arr[0],$arr[1],$arr[2]); |
| 122 | 124 | //print "Error at $i, $j, getTimestamp() returned $newi ($ret)\n"; |
@@ -23,8 +23,7 @@ |
||
| 23 | 23 | { |
| 24 | 24 | $dependency=new TDirectoryCacheDependency(dirname(__FILE__).'/temp2'); |
| 25 | 25 | $this->fail("Expected exception is not raised"); |
| 26 | - } |
|
| 27 | - catch(TInvalidDataValueException $e) |
|
| 26 | + } catch(TInvalidDataValueException $e) |
|
| 28 | 27 | { |
| 29 | 28 | } |
| 30 | 29 | } |