/**
     * @group ZF-4010
     */
    public function testShouldAllowMatchingOfAttributeValues()
    {
        $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-0 @value');
        $result = $assertion->evaluate($html, Zend_Test_PHPUnit_Constraint_DomQuery::ASSERT_CONTENT_CONTAINS, 'value1');
        $this->assertTrue($result);
    }
Example #2
0
 /**
  * Assert against XPath selection; should contain no more than this number of nodes
  *
  * @param  string $path XPath path
  * @param  string $count Maximum number of nodes that should match
  * @param  string $message
  * @return void
  */
 public function assertXpathCountMax($path, $count, $message = '')
 {
     $this->_incrementAssertionCount();
     require_once 'Zend/Test/PHPUnit/Constraint/DomQuery.php';
     $constraint = new Zend_Test_PHPUnit_Constraint_DomQuery($path);
     $constraint->registerXpathNamespaces($this->_xpathNamespaces);
     $content = $this->response->outputBody();
     if (!$constraint->evaluate($content, __FUNCTION__, $count)) {
         $constraint->fail($path, $message);
     }
 }
Example #3
0
 /**
  * Assert against XPath selection; should contain no more than this number of nodes
  *
  * @param  string $path XPath path
  * @param  string $count Maximum number of nodes that should match
  * @param  string $message
  * @return void
  */
 public function assertXpathCountMax($path, $count, $message = '')
 {
     $this->_incrementAssertionCount();
     $constraint = new Zend_Test_PHPUnit_Constraint_DomQuery($path);
     $content = $this->response->outputBody();
     if (!$constraint->evaluate($content, __FUNCTION__, $count)) {
         $constraint->fail($path, $message);
     }
 }