Skip to content
This repository has been archived by the owner on May 16, 2018. It is now read-only.

Commit

Permalink
Merge branch 'pr304'
Browse files Browse the repository at this point in the history
  • Loading branch information
akrabat committed Mar 27, 2014
2 parents 42c2f86 + 725427b commit 7884400
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
2 changes: 1 addition & 1 deletion library/Zend/Test/PHPUnit/Constraint/DomQuery37.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
Expand Down
28 changes: 28 additions & 0 deletions tests/Zend/Test/PHPUnit/Constraint/DomQueryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>ZF Issue ZF-4010</title>
</head>
<body>
<form>
<fieldset id="fieldset-input"><legend>Inputs</legend>
<ol>
<li><input type="text" name="input[0]" id="input-0" value="value1" /></li>
<li><input type="text" name="input[1]" id="input-1" value="value2" /></li>
<li><input type="text" name="input[2]" id="input-2" value="" /></li>
</ol>
</fieldset>
</form>
</body>
</html>';
$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);
}
}

0 comments on commit 7884400

Please sign in to comment.