ExpressionFunctionTest.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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\ExpressionLanguage\Tests;
  11. use PHPUnit\Framework\TestCase;
  12. use Symfony\Component\ExpressionLanguage\ExpressionFunction;
  13. /**
  14. * Tests ExpressionFunction.
  15. *
  16. * @author Dany Maillard <danymaillard93b@gmail.com>
  17. */
  18. class ExpressionFunctionTest extends TestCase
  19. {
  20. /**
  21. * @expectedException \InvalidArgumentException
  22. * @expectedExceptionMessage PHP function "fn_does_not_exist" does not exist.
  23. */
  24. public function testFunctionDoesNotExist()
  25. {
  26. ExpressionFunction::fromPhp('fn_does_not_exist');
  27. }
  28. /**
  29. * @expectedException \InvalidArgumentException
  30. * @expectedExceptionMessage An expression function name must be defined when PHP function "Symfony\Component\ExpressionLanguage\Tests\fn_namespaced" is namespaced.
  31. */
  32. public function testFunctionNamespaced()
  33. {
  34. ExpressionFunction::fromPhp('Symfony\Component\ExpressionLanguage\Tests\fn_namespaced');
  35. }
  36. }
  37. function fn_namespaced()
  38. {
  39. }