菜谱项目

AttributeNodeTest.php 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\CssSelector\Tests\Node;
  11. use Symfony\Component\CssSelector\Node\AttributeNode;
  12. use Symfony\Component\CssSelector\Node\ElementNode;
  13. class AttributeNodeTest extends AbstractNodeTest
  14. {
  15. public function getToStringConversionTestData()
  16. {
  17. return array(
  18. array(new AttributeNode(new ElementNode(), null, 'attribute', 'exists', null), 'Attribute[Element[*][attribute]]'),
  19. array(new AttributeNode(new ElementNode(), null, 'attribute', '$=', 'value'), "Attribute[Element[*][attribute $= 'value']]"),
  20. array(new AttributeNode(new ElementNode(), 'namespace', 'attribute', '$=', 'value'), "Attribute[Element[*][namespace|attribute $= 'value']]"),
  21. );
  22. }
  23. public function getSpecificityValueTestData()
  24. {
  25. return array(
  26. array(new AttributeNode(new ElementNode(), null, 'attribute', 'exists', null), 10),
  27. array(new AttributeNode(new ElementNode(null, 'element'), null, 'attribute', 'exists', null), 11),
  28. array(new AttributeNode(new ElementNode(), null, 'attribute', '$=', 'value'), 10),
  29. array(new AttributeNode(new ElementNode(), 'namespace', 'attribute', '$=', 'value'), 10),
  30. );
  31. }
  32. }