2018-04-17 02:11:51 +00:00
< ? php
/*
* This file is part of the Symfony package .
*
* ( c ) Fabien Potencier < fabien @ symfony . com >
*
* For the full copyright and license information , please view the LICENSE
* file that was distributed with this source code .
*/
namespace Symfony\Component\ExpressionLanguage\Tests ;
use PHPUnit\Framework\TestCase ;
use Symfony\Component\ExpressionLanguage\ExpressionFunction ;
/**
* Tests ExpressionFunction .
*
* @ author Dany Maillard < danymaillard93b @ gmail . com >
*/
class ExpressionFunctionTest extends TestCase
{
public function testFunctionDoesNotExist ()
{
2024-01-12 05:08:24 +00:00
$this -> expectException ( 'InvalidArgumentException' );
$this -> expectExceptionMessage ( 'PHP function "fn_does_not_exist" does not exist.' );
2018-04-17 02:11:51 +00:00
ExpressionFunction :: fromPhp ( 'fn_does_not_exist' );
}
public function testFunctionNamespaced ()
{
2024-01-12 05:08:24 +00:00
$this -> expectException ( 'InvalidArgumentException' );
$this -> expectExceptionMessage ( 'An expression function name must be defined when PHP function "Symfony\Component\ExpressionLanguage\Tests\fn_namespaced" is namespaced.' );
2018-04-17 02:11:51 +00:00
ExpressionFunction :: fromPhp ( 'Symfony\Component\ExpressionLanguage\Tests\fn_namespaced' );
}
}
function fn_namespaced ()
{
}