FunctionNodeTest.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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\ElementNode;
  12. use Symfony\Component\CssSelector\Node\FunctionNode;
  13. use Symfony\Component\CssSelector\Parser\Token;
  14. class FunctionNodeTest extends AbstractNodeTest
  15. {
  16. public function getToStringConversionTestData()
  17. {
  18. return [
  19. [new FunctionNode(new ElementNode(), 'function'), 'Function[Element[*]:function()]'],
  20. [new FunctionNode(new ElementNode(), 'function', [
  21. new Token(Token::TYPE_IDENTIFIER, 'value', 0),
  22. ]), "Function[Element[*]:function(['value'])]"],
  23. [new FunctionNode(new ElementNode(), 'function', [
  24. new Token(Token::TYPE_STRING, 'value1', 0),
  25. new Token(Token::TYPE_NUMBER, 'value2', 0),
  26. ]), "Function[Element[*]:function(['value1', 'value2'])]"],
  27. ];
  28. }
  29. public function getSpecificityValueTestData()
  30. {
  31. return [
  32. [new FunctionNode(new ElementNode(), 'function'), 10],
  33. [new FunctionNode(new ElementNode(), 'function', [
  34. new Token(Token::TYPE_IDENTIFIER, 'value', 0),
  35. ]), 10],
  36. [new FunctionNode(new ElementNode(), 'function', [
  37. new Token(Token::TYPE_STRING, 'value1', 0),
  38. new Token(Token::TYPE_NUMBER, 'value2', 0),
  39. ]), 10],
  40. ];
  41. }
  42. }