From 75fcc7c2f84d0842ef2255eeaa12452066867978 Mon Sep 17 00:00:00 2001 From: mark_story Date: Sun, 23 Mar 2014 11:00:59 -0400 Subject: [PATCH] Don't use count() in a loop. Use do while so the count does not happen in a loop statement. This makes the code linter happier. --- lib/Cake/TestSuite/CakeTestCase.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/Cake/TestSuite/CakeTestCase.php b/lib/Cake/TestSuite/CakeTestCase.php index 4d8fd4050..77228fef6 100644 --- a/lib/Cake/TestSuite/CakeTestCase.php +++ b/lib/Cake/TestSuite/CakeTestCase.php @@ -516,7 +516,8 @@ abstract class CakeTestCase extends PHPUnit_Framework_TestCase { protected function _assertAttributes($assertions, $string) { $asserts = $assertions['attrs']; $explains = $assertions['explains']; - while (count($asserts) > 0) { + $len = count($asserts); + do { $matches = false; foreach ($asserts as $j => $assert) { if (preg_match(sprintf('/^%s/s', $assert), $string, $match)) { @@ -530,7 +531,8 @@ abstract class CakeTestCase extends PHPUnit_Framework_TestCase { if ($matches === false) { $this->assertTrue(false, 'Attribute did not match. Was expecting ' . $explains[$j]); } - } + $len = count($asserts); + } while ($len > 0); return $string; }