mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-03 18:04:26 +02:00
2 small fixes for unit tests
This commit is contained in:
@@ -31,14 +31,8 @@ class FunctionTest extends PHPUnit_Smarty
|
||||
public function testUnknownFunction()
|
||||
{
|
||||
$this->smarty->enableSecurity();
|
||||
try {
|
||||
$this->expectException(\Smarty\CompilerException::class);
|
||||
$this->expectExceptionMessage('Cannot compile unknown function unknown');
|
||||
$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.');
|
||||
}
|
||||
}
|
||||
|
@@ -62,9 +62,10 @@ class SecurityTest extends PHPUnit_Smarty
|
||||
*/
|
||||
public function testNotTrustedModifier()
|
||||
{
|
||||
$this->smarty->security_policy->disabled_modifiers[] = 'escape';
|
||||
$this->expectException(\Smarty\Exception::class);
|
||||
$this->expectExceptionMessage('modifier \'sizeof\' not allowed by security setting');
|
||||
@$this->smarty->fetch('string:{assign var=foo value=[1,2,3,4,5]}{$foo|@sizeof}');
|
||||
$this->expectExceptionMessage('modifier \'escape\' disabled by security setting');
|
||||
@$this->smarty->fetch('string:{assign var=foo value=[1,2,3,4,5]}{$foo|escape}');
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user