mirror of
https://github.com/smarty-php/smarty.git
synced 2025-11-07 07:41:37 +01:00
45 lines
925 B
PHP
45 lines
925 B
PHP
<?php
|
|
/**
|
|
* Smarty PHPunit tests of function calls
|
|
*
|
|
* @package PHPunit
|
|
* @author Uwe Tews
|
|
*/
|
|
|
|
/**
|
|
* class for function tests
|
|
*
|
|
* @runTestsInSeparateProcess
|
|
* @preserveGlobalState disabled
|
|
* @backupStaticAttributes enabled
|
|
*/
|
|
class FunctionTest extends PHPUnit_Smarty
|
|
{
|
|
public function setUp(): void
|
|
{
|
|
$this->setUpSmarty(__DIR__);
|
|
}
|
|
|
|
public function testInit()
|
|
{
|
|
$this->cleanDirs();
|
|
}
|
|
|
|
/**
|
|
* test unknown function error
|
|
*/
|
|
public function testUnknownFunction()
|
|
{
|
|
$this->smarty->enableSecurity();
|
|
try {
|
|
$this->smarty->fetch('eval:{unknown()}');
|
|
}
|
|
catch (Exception $e) {
|
|
$this->assertStringContainsString("PHP function 'unknown' not allowed by security setting", $e->getMessage());
|
|
|
|
return;
|
|
}
|
|
$this->fail('Exception for unknown function has not been raised.');
|
|
}
|
|
}
|