2
0

DomQueryTest.php 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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-2009 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. require_once dirname(__FILE__) . '/../../../../TestHelper.php';
  23. /**
  24. * @see Zend_Test_PHPUnit_Constraint_DomQuery
  25. */
  26. require_once 'Zend/Test/PHPUnit/Constraint/DomQuery.php';
  27. /**
  28. * @category Zend
  29. * @package Zend_Test
  30. * @subpackage UnitTests
  31. * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
  32. * @license http://framework.zend.com/license/new-bsd New BSD License
  33. * @group Zend_Test
  34. * @group Zend_Test_PHPUnit
  35. */
  36. class Zend_Test_PHPUnit_Constraint_DomQueryTest extends PHPUnit_Framework_TestCase
  37. {
  38. /**
  39. * @group ZF-4010
  40. */
  41. public function testShouldAllowMatchingOfAttributeValues()
  42. {
  43. $html = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  44. <html>
  45. <head>
  46. <title>ZF Issue ZF-4010</title>
  47. </head>
  48. <body>
  49. <form>
  50. <fieldset id="fieldset-input"><legend>Inputs</legend>
  51. <ol>
  52. <li><input type="text" name="input[0]" id="input-0" value="value1" /></li>
  53. <li><input type="text" name="input[1]" id="input-1" value="value2" /></li>
  54. <li><input type="text" name="input[2]" id="input-2" value="" /></li>
  55. </ol>
  56. </fieldset>
  57. </form>
  58. </body>
  59. </html>';
  60. $assertion = new Zend_Test_PHPUnit_Constraint_DomQuery('input#input-0 @value');
  61. $result = $assertion->evaluate($html,
  62. Zend_Test_PHPUnit_Constraint_DomQuery::ASSERT_CONTENT_CONTAINS, 'value1');
  63. $this->assertTrue($result);
  64. }
  65. }