DomQueryTest.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. /**
  3. * Zend Framework
  4. *
  5. * LICENSE
  6. *
  7. * This source file is subject to the new BSD license that is bundled
  8. * with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://framework.zend.com/license/new-bsd
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to license@zend.com so we can send you a copy immediately.
  14. *
  15. * @category Zend
  16. * @package Zend_Test
  17. * @subpackage UnitTests
  18. * @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. * @version $Id$
  21. */
  22. /**
  23. * @see Zend_Test_PHPUnit_Constraint_DomQuery
  24. */
  25. require_once 'Zend/Test/PHPUnit/Constraint/DomQuery.php';
  26. /**
  27. * @category Zend
  28. * @package Zend_Test
  29. * @subpackage UnitTests
  30. * @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
  31. * @license http://framework.zend.com/license/new-bsd New BSD License
  32. * @group Zend_Test
  33. * @group Zend_Test_PHPUnit
  34. */
  35. class Zend_Test_PHPUnit_Constraint_DomQueryTest extends PHPUnit_Framework_TestCase
  36. {
  37. /**
  38. * @group ZF-4010
  39. */
  40. public function testShouldAllowMatchingOfAttributeValues()
  41. {
  42. $html = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  43. <html>
  44. <head>
  45. <title>ZF Issue ZF-4010</title>
  46. </head>
  47. <body>
  48. <form>
  49. <fieldset id="fieldset-input"><legend>Inputs</legend>
  50. <ol>
  51. <li><input type="text" name="input[0]" id="input-0" value="value1" /></li>
  52. <li><input type="text" name="input[1]" id="input-1" value="value2" /></li>
  53. <li><input type="text" name="input[2]" id="input-2" value="" /></li>
  54. </ol>
  55. </fieldset>
  56. </form>
  57. </body>
  58. </html>';
  59. $assertion = new Zend_Test_PHPUnit_Constraint_DomQuery('input#input-0 @value');
  60. $result = $assertion->evaluate($html,
  61. Zend_Test_PHPUnit_Constraint_DomQuery::ASSERT_CONTENT_CONTAINS, 'value1');
  62. $this->assertTrue($result);
  63. }
  64. }