diff --git a/library/Zend/Test/PHPUnit/Constraint/DomQuery37.php b/library/Zend/Test/PHPUnit/Constraint/DomQuery37.php index 9e4b3ac093..4d396b7ad0 100644 --- a/library/Zend/Test/PHPUnit/Constraint/DomQuery37.php +++ b/library/Zend/Test/PHPUnit/Constraint/DomQuery37.php @@ -193,7 +193,7 @@ public function evaluate($content, $assertType = '', $match = FALSE) case self::ASSERT_CONTENT_COUNT: case self::ASSERT_CONTENT_COUNT_MIN: case self::ASSERT_CONTENT_COUNT_MAX: - if (!$match) { + if ($match === false) { require_once 'Zend/Test/PHPUnit/Constraint/Exception.php'; throw new Zend_Test_PHPUnit_Constraint_Exception('No count provided against which to compare'); } diff --git a/tests/Zend/Test/PHPUnit/Constraint/DomQueryTest.php b/tests/Zend/Test/PHPUnit/Constraint/DomQueryTest.php index 060f03ae3b..879db0bf7d 100644 --- a/tests/Zend/Test/PHPUnit/Constraint/DomQueryTest.php +++ b/tests/Zend/Test/PHPUnit/Constraint/DomQueryTest.php @@ -63,4 +63,32 @@ public function testShouldAllowMatchingOfAttributeValues() Zend_Test_PHPUnit_Constraint_DomQuery::ASSERT_CONTENT_CONTAINS, 'value1'); $this->assertTrue($result); } + + /** + * @group issue-303 + */ + public function testShouldAllowMatchingZeroCounts() + { + $html = ' + + + ZF Issue ZF-4010 + + +
+
Inputs +
    +
  1. +
  2. +
  3. +
+
+
+ +'; + $assertion = new Zend_Test_PHPUnit_Constraint_DomQuery('input#input-3 @value'); + $result = $assertion->evaluate($html, + Zend_Test_PHPUnit_Constraint_DomQuery::ASSERT_CONTENT_COUNT, 0); + $this->assertTrue($result); + } }