NumberHandlerTest.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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\Parser\Handler;
  11. use Symfony\Component\CssSelector\Parser\Handler\NumberHandler;
  12. use Symfony\Component\CssSelector\Parser\Token;
  13. use Symfony\Component\CssSelector\Parser\Tokenizer\TokenizerPatterns;
  14. class NumberHandlerTest extends AbstractHandlerTest
  15. {
  16. public function getHandleValueTestData()
  17. {
  18. return array(
  19. array('12', new Token(Token::TYPE_NUMBER, '12', 0), ''),
  20. array('12.34', new Token(Token::TYPE_NUMBER, '12.34', 0), ''),
  21. array('+12.34', new Token(Token::TYPE_NUMBER, '+12.34', 0), ''),
  22. array('-12.34', new Token(Token::TYPE_NUMBER, '-12.34', 0), ''),
  23. array('12 arg', new Token(Token::TYPE_NUMBER, '12', 0), ' arg'),
  24. array('12]', new Token(Token::TYPE_NUMBER, '12', 0), ']'),
  25. );
  26. }
  27. public function getDontHandleValueTestData()
  28. {
  29. return array(
  30. array('hello'),
  31. array('>'),
  32. array('+'),
  33. array(' '),
  34. array('/* comment */'),
  35. );
  36. }
  37. protected function generateHandler()
  38. {
  39. $patterns = new TokenizerPatterns();
  40. return new NumberHandler($patterns);
  41. }
  42. }