Browse Source

Adding an assert for Validation::count()

Florian Krämer 10 years ago
parent
commit
dae46da83d
2 changed files with 4 additions and 1 deletions
  1. 1 1
      src/Validation/Validation.php
  2. 3 0
      tests/TestCase/Validation/ValidationTest.php

+ 1 - 1
src/Validation/Validation.php

@@ -237,7 +237,7 @@ class Validation
             $count = $check1;
         }
 
-        if (!$count) {
+        if (!isset($count)) {
             return false;
         }
 

+ 3 - 0
tests/TestCase/Validation/ValidationTest.php

@@ -2784,5 +2784,8 @@ class ValidationTest extends TestCase
         $this->assertTrue(Validation::count($int, '==', 7));
         $this->assertFalse(Validation::count($int, '>', 8));
         $this->assertFalse(Validation::count($int, '<', 1));
+
+        $int = 0;
+        $this->assertTrue(Validation::count($int, '==', 0));
     }
 }