mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-03 18:04:26 +02:00
Dropped suppport for php<7.2 to enable unit testing for php8, using phpunit8. Updated unit tests for compatability with phpunit8.
This commit is contained in:
@@ -7,15 +7,6 @@ install:
|
||||
|
||||
jobs:
|
||||
include:
|
||||
- php: 5.3 # Composer and PHPUnit require PHP 5.3.2+ to run, so we cannot test below 5.3
|
||||
dist: precise # PHP 5.3 is supported only on Precise.
|
||||
- php: 5.4
|
||||
dist: trusty # PHP 5.4 is supported only on Trusty.
|
||||
- php: 5.5
|
||||
dist: trusty # PHP 5.5 is supported only on Trusty.
|
||||
- php: 5.6
|
||||
- php: 7.0
|
||||
- php: 7.1
|
||||
- php: 7.2
|
||||
- php: 7.3
|
||||
- php: 7.4
|
||||
|
@@ -7,11 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
## [Unreleased]
|
||||
|
||||
### Changed
|
||||
- Dropped support for PHP versions lower than PHP7.1 (and disabled unit tests for 7.1)
|
||||
- Changed error handlers and handling of undefined constants for php8-compatibility (set $errcontext argument optional) https://github.com/smarty-php/smarty/issues/605
|
||||
- Changed expected error levels in unit tests for php8-compatibility
|
||||
- Travis unit tests now run for all php versions >= 5.3, including php8
|
||||
- Travis runs on Xenial where possible
|
||||
|
||||
|
||||
### Fixed
|
||||
- PHP5.3 compatibility fixes
|
||||
|
||||
|
@@ -27,7 +27,7 @@
|
||||
"forum": "http://www.smarty.net/forums/"
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.2"
|
||||
"php": ">=7.1"
|
||||
},
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
@@ -40,7 +40,7 @@
|
||||
}
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^9.5 || ^8.5 || ^7.5 || ^6.5 || ^5.7 || ^4.8",
|
||||
"phpunit/phpunit": "^8.5",
|
||||
"smarty/smarty-lexer": "^3.1"
|
||||
}
|
||||
}
|
||||
|
15
phpunit.xml
15
phpunit.xml
@@ -6,7 +6,6 @@
|
||||
backupGlobals="false"
|
||||
backupStaticAttributes="true"
|
||||
forceCoversAnnotation="false"
|
||||
mapTestClassNameToCoveredClassName="false"
|
||||
processIsolation="false"
|
||||
stopOnError="false"
|
||||
stopOnFailure="false"
|
||||
@@ -17,18 +16,7 @@
|
||||
timeoutForMediumTests="10"
|
||||
timeoutForLargeTests="60"
|
||||
verbose="false">
|
||||
|
||||
<filter>
|
||||
<testsuites>
|
||||
<testsuite name="Smarty Test Suite">
|
||||
<directory>tests/UnitTests</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
<blacklist>
|
||||
<directory suffix=".php">tests</directory>
|
||||
<directory suffix=".php">tests/cache</directory>
|
||||
<directory suffix=".php">tests/templates_c</directory>
|
||||
</blacklist>
|
||||
<filter>
|
||||
<whitelist processUncoveredFilesFromWhitelist="true">
|
||||
<directory suffix=".php">libs</directory>
|
||||
<directory suffix=".php">libs/plugins</directory>
|
||||
@@ -39,5 +27,4 @@
|
||||
<logging>
|
||||
<log type="tap" target="tests/TestResults.tap"/>
|
||||
</logging>
|
||||
|
||||
</phpunit>
|
||||
|
@@ -86,7 +86,7 @@ class PHPUnit_Smarty extends PHPUnit_Framework_TestCase
|
||||
* This method is called before the first test of this test class is run.
|
||||
*
|
||||
*/
|
||||
public static function setUpBeforeClass()
|
||||
public static function setUpBeforeClass(): void
|
||||
{
|
||||
error_reporting(E_ALL & ~E_STRICT);
|
||||
self::$init = true;
|
||||
@@ -97,7 +97,7 @@ class PHPUnit_Smarty extends PHPUnit_Framework_TestCase
|
||||
* This method is called after the last test of this test class is run.
|
||||
*
|
||||
*/
|
||||
public static function tearDownAfterClass()
|
||||
public static function tearDownAfterClass(): void
|
||||
{
|
||||
//self::$pdo = null;
|
||||
self::$testNumber = 0;
|
||||
@@ -676,7 +676,7 @@ KEY `name` (`name`)
|
||||
* This method is called after a test is executed.
|
||||
*
|
||||
*/
|
||||
protected function tearDown()
|
||||
protected function tearDown(): void
|
||||
{
|
||||
if (class_exists('Smarty_Internal_TemplateCompilerBase') &&
|
||||
isset(Smarty_Internal_TemplateCompilerBase::$_tag_objects)
|
||||
|
@@ -15,7 +15,7 @@ class PathNormalizationTest extends PHPUnit_Smarty
|
||||
/*
|
||||
* Setup test fixture
|
||||
*/
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@ class PluginNormalizationTest extends PHPUnit_Smarty
|
||||
/*
|
||||
* Setup test fixture
|
||||
*/
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@ class TemplateNormalizationTest extends PHPUnit_Smarty
|
||||
/*
|
||||
* Setup test fixture
|
||||
*/
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@ class ProtectedFolderVarsTest extends PHPUnit_Smarty
|
||||
/*
|
||||
* Setup test fixture
|
||||
*/
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
}
|
||||
|
@@ -13,7 +13,7 @@ class UndefinedTemplateVarTest extends PHPUnit_Smarty
|
||||
/*
|
||||
* Setup test fixture
|
||||
*/
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
error_reporting(E_ALL | E_STRICT);
|
||||
|
@@ -15,7 +15,7 @@ class AutoEscapeTest extends PHPUnit_Smarty
|
||||
/*
|
||||
* Setup test fixture
|
||||
*/
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
$this->smarty->setEscapeHtml(true);
|
||||
|
@@ -17,7 +17,7 @@ class FilterTest extends PHPUnit_Smarty
|
||||
{
|
||||
public $loadSmartyBC = true;
|
||||
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
class LoadFilterTest extends PHPUnit_Smarty
|
||||
{
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
class RegisterFilterTest extends PHPUnit_Smarty
|
||||
{
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
class GetterSetterTest extends PHPUnit_Smarty
|
||||
{
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
class DefaultPluginHandlerTest extends PHPUnit_Smarty
|
||||
{
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
$this->smarty->setForceCompile(true);
|
||||
|
@@ -11,7 +11,7 @@
|
||||
*/
|
||||
class IncludePathTest extends PHPUnit_Smarty
|
||||
{
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
$this->smarty->use_include_path = true;
|
||||
@@ -26,7 +26,7 @@ class IncludePathTest extends PHPUnit_Smarty
|
||||
* This method is called after a test is executed.
|
||||
*
|
||||
*/
|
||||
protected function tearDown()
|
||||
protected function tearDown(): void
|
||||
{
|
||||
ini_restore('include_path');
|
||||
$this->smarty->disableSecurity();
|
||||
@@ -38,14 +38,14 @@ class IncludePathTest extends PHPUnit_Smarty
|
||||
}
|
||||
public function testInclude1()
|
||||
{
|
||||
$this->assertContains('plugin1', $this->smarty->fetch('test_include_path1.tpl'));
|
||||
$this->assertStringContainsString('plugin1', $this->smarty->fetch('test_include_path1.tpl'));
|
||||
}
|
||||
public function testInclude2()
|
||||
{
|
||||
$this->assertContains('plugin2', $this->smarty->fetch('test_include_path2.tpl'));
|
||||
$this->assertStringContainsString('plugin2', $this->smarty->fetch('test_include_path2.tpl'));
|
||||
}
|
||||
public function testInclude3()
|
||||
{
|
||||
$this->assertContains('plugin3', $this->smarty->fetch('test_include_path3.tpl'));
|
||||
$this->assertStringContainsString('plugin3', $this->smarty->fetch('test_include_path3.tpl'));
|
||||
}
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
class LoadPluginTest extends PHPUnit_Smarty
|
||||
{
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
}
|
||||
|
@@ -17,7 +17,7 @@ class MuteExpectedErrorsTest extends PHPUnit_Smarty
|
||||
{
|
||||
protected $_errors = array();
|
||||
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
class PluginChainedLoadTest extends PHPUnit_Smarty
|
||||
{
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
}
|
||||
@@ -28,6 +28,6 @@ class PluginChainedLoadTest extends PHPUnit_Smarty
|
||||
public function testPluginChainedLoad()
|
||||
{
|
||||
$this->smarty->addPluginsDir(dirname(__FILE__) . "/PHPunitplugins/");
|
||||
$this->assertContains('from chain3', $this->smarty->fetch('test_plugin_chained_load.tpl'));
|
||||
$this->assertStringContainsString('from chain3', $this->smarty->fetch('test_plugin_chained_load.tpl'));
|
||||
}
|
||||
}
|
||||
|
@@ -11,7 +11,7 @@
|
||||
*/
|
||||
class SharedFunctionsTest extends PHPUnit_Smarty
|
||||
{
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
}
|
||||
|
@@ -17,7 +17,7 @@ class SmartyBcTest extends PHPUnit_Smarty
|
||||
{
|
||||
public $loadSmartyBC = true;
|
||||
public $loadSmarty = false;
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
}
|
||||
|
@@ -16,7 +16,7 @@
|
||||
class HttpModifiedSinceTest extends PHPUnit_Smarty
|
||||
{
|
||||
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->markTestSkipped('modified since tests are disabled');
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
|
@@ -18,7 +18,7 @@ include_once dirname(__FILE__) . '/../_shared/CacheResourceTestCommon.php';
|
||||
class CacheResourceFileTest extends CacheResourceTestCommon
|
||||
{
|
||||
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
parent::setUp();
|
||||
|
@@ -22,7 +22,7 @@ class CacheResourceCustomMemcacheTest extends CacheResourceTestCommon
|
||||
* This method is called before a test is executed.
|
||||
*
|
||||
*/
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
if (MemCacheEnable != true) {
|
||||
$this->markTestSkipped('Memcache tests are disabled');
|
||||
|
@@ -15,7 +15,7 @@ class CacheResourceTestCommon extends PHPUnit_Smarty
|
||||
{
|
||||
public static $touchResource = null;
|
||||
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->smarty->setTemplateDir(dirname(__FILE__) . '/templates');
|
||||
$this->smarty->addPluginsDir(dirname(__FILE__) . '/PHPunitplugins');
|
||||
@@ -551,7 +551,7 @@ class CacheResourceTestCommon extends PHPUnit_Smarty
|
||||
}
|
||||
$tpl = $this->smarty->createTemplate('templatedir.tpl', $this->smarty);
|
||||
$this->assertEquals($iscached, $tpl->isCached());
|
||||
$this->assertContains($result, $tpl->fetch());
|
||||
$this->assertStringContainsString($result, $tpl->fetch());
|
||||
}
|
||||
|
||||
public function dataDir(){
|
||||
|
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
class CompileCompilerPluginTest extends PHPUnit_Smarty
|
||||
{
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
}
|
||||
|
@@ -14,7 +14,7 @@
|
||||
*/
|
||||
class AutoliteralTest extends PHPUnit_Smarty
|
||||
{
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
$this->smarty->addPluginsDir("../../__shared/PHPunitplugins/");
|
||||
|
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
class DelimiterTest extends PHPUnit_Smarty
|
||||
{
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
class UserliteralTest extends PHPUnit_Smarty
|
||||
{
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
if (!property_exists('Smarty', 'literals')) {
|
||||
$this->markTestSkipped('user literal support');
|
||||
|
@@ -21,33 +21,30 @@ class DefaultConfigHandlerTest extends PHPUnit_Smarty
|
||||
* This method is called before a test is executed.
|
||||
*
|
||||
*/
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
$this->smarty->setForceCompile(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException SmartyException
|
||||
* @expectedExceptionMessage Unable to load config 'file:foo.conf'
|
||||
*
|
||||
* test unknown config file
|
||||
*/
|
||||
public function testUnknownConfigFile()
|
||||
{
|
||||
$this->expectException('SmartyException');
|
||||
$this->expectExceptionMessage('Unable to load config \'file:foo.conf\'');
|
||||
$this->smarty->configLoad('foo.conf');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException SmartyException
|
||||
* @expectedExceptionMessage Default config handler
|
||||
* @expectedExceptionMessage not callable
|
||||
*
|
||||
* test register unknown default config handler
|
||||
*
|
||||
*/
|
||||
public function testRegisterUnknownDefaultConfigHandler()
|
||||
{
|
||||
$this->expectException('SmartyException');
|
||||
$this->expectExceptionMessage('Default config handler');
|
||||
$this->expectExceptionMessage('not callable');
|
||||
$this->smarty->registerDefaultConfigHandler('foo');
|
||||
}
|
||||
|
||||
@@ -77,42 +74,32 @@ class DefaultConfigHandlerTest extends PHPUnit_Smarty
|
||||
$this->assertEquals("123.4", $this->smarty->fetch('number.tpl'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException SmartyException
|
||||
* @expectedExceptionMessage Unable to load config default file 'no.conf' for 'file:fo.conf'
|
||||
*
|
||||
*
|
||||
*/
|
||||
public function testDefaultConfigHandlerReplacementByConfigFileFail()
|
||||
{
|
||||
$this->expectException('SmartyException');
|
||||
$this->expectExceptionMessage("Unable to load config default file 'no.conf' for 'file:fo.conf'");
|
||||
$this->smarty->registerDefaultConfigHandler('configHandlerFile');
|
||||
$this->smarty->configLoad('fo.conf');
|
||||
$this->assertEquals("123.4", $this->smarty->fetch('number.tpl'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException SmartyException
|
||||
* @expectedExceptionMessage Unable to load config 'file:foo.conf'
|
||||
*
|
||||
*
|
||||
* test default config handler replacement (return false)
|
||||
*
|
||||
*/
|
||||
public function testDefaultConfigHandlerReplacementReturningFalse()
|
||||
{
|
||||
$this->expectException('SmartyException');
|
||||
$this->expectExceptionMessage('Unable to load config \'file:foo.conf\'');
|
||||
$this->smarty->configLoad('foo.conf');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException SmartyException
|
||||
* @expectedExceptionMessage No config default content for 'file:bla.conf'
|
||||
*
|
||||
*
|
||||
* test default config handler replacement (return false)
|
||||
*
|
||||
*/
|
||||
public function testDefaultConfigHandlerReplacementReturningFalse1()
|
||||
{
|
||||
$this->expectException('SmartyException');
|
||||
$this->expectExceptionMessage('No config default content for \'file:bla.conf\'');
|
||||
$this->smarty->registerDefaultConfigHandler('configHandlerData');
|
||||
$this->smarty->configLoad('bla.conf');
|
||||
}
|
||||
|
@@ -20,7 +20,7 @@ class ConfigVarTest extends PHPUnit_Smarty
|
||||
* This method is called before a test is executed.
|
||||
*
|
||||
*/
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
}
|
||||
|
@@ -17,7 +17,7 @@ class CustomResourceAmbiguousTest extends PHPUnit_Smarty
|
||||
{
|
||||
public $_resource = null;
|
||||
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
require_once dirname(__FILE__) . '/PHPunitplugins/resource.ambiguous.php';
|
||||
|
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
class ResourceExtendsAllPluginTest extends PHPUnit_Smarty
|
||||
{
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
}
|
||||
|
@@ -138,13 +138,13 @@ if (MysqlResourceEnable == true) {
|
||||
/**
|
||||
* test unknown template
|
||||
*
|
||||
* @expectedException SmartyException
|
||||
* @expectedExceptionMessage Unable to load template 'mysqlstest:foo.tpl'
|
||||
* @runInSeparateProcess
|
||||
* @preserveGlobalState disabled
|
||||
*
|
||||
*/
|
||||
public function testUnknownTemplate() {
|
||||
$this->expectException('SmartyException');
|
||||
$this->expectExceptionMessage('Unable to load template \'mysqlstest:foo.tpl\'');
|
||||
$this->assertEquals('foo', $this->smarty->fetch('mysqlstest:foo.tpl'));
|
||||
}
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
class DefaultTemplateHandlerTest extends PHPUnit_Smarty
|
||||
{
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
$this->smarty->setForceCompile(true);
|
||||
@@ -36,7 +36,7 @@ class DefaultTemplateHandlerTest extends PHPUnit_Smarty
|
||||
$this->smarty->fetch('foo.tpl');
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$this->assertContains('Unable to load template', $e->getMessage());
|
||||
$this->assertStringContainsString('Unable to load template', $e->getMessage());
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -52,8 +52,8 @@ class DefaultTemplateHandlerTest extends PHPUnit_Smarty
|
||||
$this->smarty->registerDefaultTemplateHandler('foo');
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$this->assertContains("Default template handler", $e->getMessage());
|
||||
$this->assertContains("not callable", $e->getMessage());
|
||||
$this->assertStringContainsString("Default template handler", $e->getMessage());
|
||||
$this->assertStringContainsString("not callable", $e->getMessage());
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -85,7 +85,7 @@ class DefaultTemplateHandlerTest extends PHPUnit_Smarty
|
||||
$this->smarty->fetch('foo.tpl');
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$this->assertContains('Default handler: No template default content for \'file:foo.tpl\'', $e->getMessage());
|
||||
$this->assertStringContainsString('Default handler: No template default content for \'file:foo.tpl\'', $e->getMessage());
|
||||
|
||||
return;
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
class EvalResourceTest extends PHPUnit_Smarty
|
||||
{
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
class ExtendsResourceTest extends PHPUnit_Smarty
|
||||
{
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
$this->smarty->enableSecurity();
|
||||
@@ -48,8 +48,8 @@ class ExtendsResourceTest extends PHPUnit_Smarty
|
||||
$this->smarty->compile_id = 1;
|
||||
}
|
||||
$result = $this->smarty->fetch('extends:003_parent.tpl|003_child_prepend.tpl');
|
||||
$this->assertContains("prepend - Default Title", $result, $testName . ' - content');
|
||||
$this->assertContains("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result, $testName . ' - fetch() failure');
|
||||
$this->assertStringContainsString("prepend - Default Title", $result, $testName . ' - content');
|
||||
$this->assertStringContainsString("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result, $testName . ' - fetch() failure');
|
||||
}
|
||||
/**
|
||||
* test child/parent template chain with apppend
|
||||
@@ -67,8 +67,8 @@ class ExtendsResourceTest extends PHPUnit_Smarty
|
||||
$this->smarty->compile_id = 1;
|
||||
}
|
||||
$result = $this->smarty->fetch('extends:004_parent.tpl|004_child_append.tpl');
|
||||
$this->assertContains("Default Title - append", $result, $testName . ' - content');
|
||||
$this->assertContains("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result, $testName . ' - fetch() failure');
|
||||
$this->assertStringContainsString("Default Title - append", $result, $testName . ' - content');
|
||||
$this->assertStringContainsString("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result, $testName . ' - fetch() failure');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -87,8 +87,8 @@ class ExtendsResourceTest extends PHPUnit_Smarty
|
||||
$this->smarty->compile_id = 1;
|
||||
}
|
||||
$result = $this->smarty->fetch('extends:040_parent.tpl|040_child.tpl');
|
||||
$this->assertContains("var-bar-var", $result, $testName . ' - content');
|
||||
$this->assertContains("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result, $testName . ' - fetch() failure');
|
||||
$this->assertStringContainsString("var-bar-var", $result, $testName . ' - content');
|
||||
$this->assertStringContainsString("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result, $testName . ' - fetch() failure');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -103,7 +103,7 @@ class ExtendsResourceTest extends PHPUnit_Smarty
|
||||
$tpl = $this->smarty->createTemplate('extends:021_parent.tpl|021_child.tpl|021_grandchild.tpl');
|
||||
$this->assertFalse($tpl->isCached());
|
||||
$result = $this->smarty->fetch($tpl);
|
||||
$this->assertContains('Grandchild Page Title', $result);
|
||||
$this->assertStringContainsString('Grandchild Page Title', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -118,7 +118,7 @@ class ExtendsResourceTest extends PHPUnit_Smarty
|
||||
$tpl2 = $this->smarty->createTemplate('extends:021_parent.tpl|021_child.tpl|021_grandchild.tpl');
|
||||
$this->assertTrue($tpl2->isCached());
|
||||
$result = $this->smarty->fetch($tpl2);
|
||||
$this->assertContains('Grandchild Page Title', $result);
|
||||
$this->assertStringContainsString('Grandchild Page Title', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -137,7 +137,7 @@ class ExtendsResourceTest extends PHPUnit_Smarty
|
||||
$tpl = $this->smarty->createTemplate('extends:021_parent.tpl|021_child.tpl|021_grandchild.tpl');
|
||||
$this->assertFalse($tpl->isCached());
|
||||
$result = $this->smarty->fetch($tpl);
|
||||
$this->assertContains('Grandchild Page Title', $result);
|
||||
$this->assertStringContainsString('Grandchild Page Title', $result);
|
||||
}
|
||||
/**
|
||||
* test grandchild/child/parent dependency test2
|
||||
@@ -152,7 +152,7 @@ class ExtendsResourceTest extends PHPUnit_Smarty
|
||||
$tpl2 = $this->smarty->createTemplate('extends:021_parent.tpl|021_child.tpl|021_grandchild.tpl');
|
||||
$this->assertTrue($tpl2->isCached());
|
||||
$result = $this->smarty->fetch($tpl2);
|
||||
$this->assertContains('Grandchild Page Title', $result);
|
||||
$this->assertStringContainsString('Grandchild Page Title', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -171,7 +171,7 @@ class ExtendsResourceTest extends PHPUnit_Smarty
|
||||
$tpl = $this->smarty->createTemplate('extends:021_parent.tpl|021_child.tpl|021_grandchild.tpl');
|
||||
$this->assertFalse($tpl->isCached());
|
||||
$result = $this->smarty->fetch($tpl);
|
||||
$this->assertContains('Grandchild Page Title', $result);
|
||||
$this->assertStringContainsString('Grandchild Page Title', $result);
|
||||
}
|
||||
/**
|
||||
* test grandchild/child/parent dependency test3
|
||||
@@ -186,7 +186,7 @@ class ExtendsResourceTest extends PHPUnit_Smarty
|
||||
$tpl2 = $this->smarty->createTemplate('extends:021_parent.tpl|021_child.tpl|021_grandchild.tpl');
|
||||
$this->assertTrue($tpl2->isCached());
|
||||
$result = $this->smarty->fetch($tpl2);
|
||||
$this->assertContains('Grandchild Page Title', $result);
|
||||
$this->assertStringContainsString('Grandchild Page Title', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -205,7 +205,7 @@ class ExtendsResourceTest extends PHPUnit_Smarty
|
||||
$tpl = $this->smarty->createTemplate('extends:021_parent.tpl|021_child.tpl|021_grandchild.tpl');
|
||||
$this->assertFalse($tpl->isCached());
|
||||
$result = $this->smarty->fetch($tpl);
|
||||
$this->assertContains('Grandchild Page Title', $result);
|
||||
$this->assertStringContainsString('Grandchild Page Title', $result);
|
||||
}
|
||||
/**
|
||||
* test grandchild/child/parent dependency test4
|
||||
@@ -220,7 +220,7 @@ class ExtendsResourceTest extends PHPUnit_Smarty
|
||||
$tpl = $this->smarty->createTemplate('extends:021_parent.tpl|021_child.tpl|021_grandchild.tpl');
|
||||
$this->assertTrue($tpl->isCached());
|
||||
$result = $this->smarty->fetch($tpl);
|
||||
$this->assertContains('Grandchild Page Title', $result);
|
||||
$this->assertStringContainsString('Grandchild Page Title', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -241,10 +241,10 @@ class ExtendsResourceTest extends PHPUnit_Smarty
|
||||
$this->smarty->setCompileId(1);
|
||||
}
|
||||
$result = $this->smarty->fetch('extends:./child/parent/033_parent.tpl|./child/033_child.tpl|033_grandchild.tpl');
|
||||
$this->assertContains('include grand:content include grand', $result, $testName . ' - grand');
|
||||
$this->assertContains('include child:content include child', $result, $testName . ' - grand');
|
||||
$this->assertContains('include parent:content include parent', $result, $testName . ' - grand');
|
||||
$this->assertContains("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result,
|
||||
$this->assertStringContainsString('include grand:content include grand', $result, $testName . ' - grand');
|
||||
$this->assertStringContainsString('include child:content include child', $result, $testName . ' - grand');
|
||||
$this->assertStringContainsString('include parent:content include parent', $result, $testName . ' - grand');
|
||||
$this->assertStringContainsString("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result,
|
||||
$testName . ' - fetch() failure');
|
||||
}
|
||||
public function data(){
|
||||
@@ -293,11 +293,11 @@ class ExtendsResourceTest extends PHPUnit_Smarty
|
||||
}
|
||||
$this->smarty->setCompileId($cid);
|
||||
$result = $this->smarty->fetch('extends:034_parent.tpl|034_grandchild.tpl');
|
||||
$this->assertContains('grandchild - grandchild', $result, $testName . ' - grand');
|
||||
$this->assertContains('parent - parent', $result, $testName . ' - grand');
|
||||
$this->assertContains($extends_recursion ? 'child - child' : 'child - parent', $result,
|
||||
$this->assertStringContainsString('grandchild - grandchild', $result, $testName . ' - grand');
|
||||
$this->assertStringContainsString('parent - parent', $result, $testName . ' - grand');
|
||||
$this->assertStringContainsString($extends_recursion ? 'child - child' : 'child - parent', $result,
|
||||
$testName . ' - grand');
|
||||
$this->assertContains("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}",
|
||||
$this->assertStringContainsString("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}",
|
||||
$result, $testName . ' - fetch() failure');
|
||||
}
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
class FileResourceTest extends PHPUnit_Smarty
|
||||
{
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
$this->smarty->enableSecurity();
|
||||
@@ -65,16 +65,14 @@ class FileResourceTest extends PHPUnit_Smarty
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException SmartyException
|
||||
* @expectedExceptionMessage Unable to
|
||||
* @expectedExceptionMessage notthere.tpl
|
||||
*
|
||||
* test not existing file
|
||||
*/
|
||||
public function testTemplateFileNotExists3()
|
||||
{
|
||||
|
||||
$result = $this->smarty->fetch('notthere.tpl');
|
||||
$this->expectException('SmartyException');
|
||||
$this->expectExceptionMessage('Unable to');
|
||||
$this->expectExceptionMessage('notthere.tpl');
|
||||
$this->smarty->fetch('notthere.tpl');
|
||||
}
|
||||
|
||||
public function testGetTemplateTimestamp()
|
||||
@@ -196,7 +194,7 @@ class FileResourceTest extends PHPUnit_Smarty
|
||||
public function testRelativeInclude()
|
||||
{
|
||||
$result = $this->smarty->fetch('relative.tpl');
|
||||
$this->assertContains('hello world', $result);
|
||||
$this->assertStringContainsString('hello world', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -208,12 +206,9 @@ class FileResourceTest extends PHPUnit_Smarty
|
||||
public function testRelativeIncludeSub()
|
||||
{
|
||||
$result = $this->smarty->fetch('sub/relative.tpl');
|
||||
$this->assertContains('hello world', $result);
|
||||
$this->assertStringContainsString('hello world', $result);
|
||||
}
|
||||
/**
|
||||
* @expectedException SmartyException
|
||||
* @expectedExceptionMessage Unable to
|
||||
* @expectedExceptionMessage notthereh.tpl
|
||||
* @runInSeparateProcess
|
||||
* @preserveGlobalState disabled
|
||||
*
|
||||
@@ -221,11 +216,11 @@ class FileResourceTest extends PHPUnit_Smarty
|
||||
*/
|
||||
public function testRelativeIncludeFail()
|
||||
{
|
||||
$result = $this->smarty->fetch('relative_sub.tpl');
|
||||
$this->expectException('SmartyException');
|
||||
$this->expectExceptionMessage('Unable to');
|
||||
$this->smarty->fetch('relative_sub.tpl');
|
||||
}
|
||||
/**
|
||||
* @expectedException SmartyException
|
||||
* @expectedExceptionMessage ./hello.tpl
|
||||
* @runInSeparateProcess
|
||||
* @preserveGlobalState disabled
|
||||
*
|
||||
@@ -233,8 +228,10 @@ class FileResourceTest extends PHPUnit_Smarty
|
||||
*/
|
||||
public function testRelativeIncludeFailOtherDir()
|
||||
{
|
||||
$this->expectException('SmartyException');
|
||||
$this->expectExceptionMessage('./hello.tpl');
|
||||
$this->smarty->addTemplateDir('./templates_2');
|
||||
$result = $this->smarty->fetch('relative_notexist.tpl');
|
||||
$this->smarty->fetch('relative_notexist.tpl');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -11,7 +11,7 @@
|
||||
*/
|
||||
class FileIncludePathTest extends PHPUnit_Smarty
|
||||
{
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
$this->smarty->use_include_path = true;
|
||||
@@ -26,7 +26,7 @@ class FileIncludePathTest extends PHPUnit_Smarty
|
||||
* This method is called after a test is executed.
|
||||
*
|
||||
*/
|
||||
protected function tearDown()
|
||||
protected function tearDown(): void
|
||||
{
|
||||
ini_restore('include_path');
|
||||
$this->smarty->disableSecurity();
|
||||
@@ -38,30 +38,30 @@ class FileIncludePathTest extends PHPUnit_Smarty
|
||||
}
|
||||
public function testInclude1()
|
||||
{
|
||||
$this->assertContains('include_test1', $this->smarty->fetch('test1.tpl'));
|
||||
$this->assertStringContainsString('include_test1', $this->smarty->fetch('test1.tpl'));
|
||||
}
|
||||
public function testInclude2()
|
||||
{
|
||||
$this->assertContains('include_test2', $this->smarty->fetch('test2.tpl'));
|
||||
$this->assertStringContainsString('include_test2', $this->smarty->fetch('test2.tpl'));
|
||||
}
|
||||
public function testInclude3()
|
||||
{
|
||||
$this->assertContains('include_test3', $this->smarty->fetch('test3.tpl'));
|
||||
$this->assertStringContainsString('include_test3', $this->smarty->fetch('test3.tpl'));
|
||||
}
|
||||
public function testInclude31()
|
||||
{
|
||||
$this->smarty->use_include_path = false;
|
||||
$this->smarty->security_policy->secure_dir = getcwd();
|
||||
$this->assertContains('include_test3', $this->smarty->fetch('test3.tpl'));
|
||||
$this->assertStringContainsString('include_test3', $this->smarty->fetch('test3.tpl'));
|
||||
}
|
||||
public function testInclude4()
|
||||
{
|
||||
$this->assertContains('include_test4', $this->smarty->fetch('test4.tpl'));
|
||||
$this->assertStringContainsString('include_test4', $this->smarty->fetch('test4.tpl'));
|
||||
}
|
||||
public function testInclude5()
|
||||
{
|
||||
$this->smarty->setTemplateDir(array('./'));
|
||||
$this->assertContains('include path root', $this->smarty->fetch('test5.tpl'));
|
||||
$this->assertStringContainsString('include path root', $this->smarty->fetch('test5.tpl'));
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -11,7 +11,7 @@
|
||||
*/
|
||||
class FileResourceIndexedTest extends PHPUnit_Smarty
|
||||
{
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
$this->smarty->addTemplateDir(dirname(__FILE__) . '/templates_2');
|
||||
|
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
class PhpResourceTest extends PHPUnit_Smarty
|
||||
{
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
}
|
||||
@@ -57,7 +57,7 @@ class PhpResourceTest extends PHPUnit_Smarty
|
||||
* public function testGetTemplateSource()
|
||||
* {
|
||||
* $tpl = $this->smarty->createTemplate('php:phphelloworld.php');
|
||||
* $this->assertContains('php hello world', $tpl->source->getContent());
|
||||
* $this->assertStringContainsString('php hello world', $tpl->source->getContent());
|
||||
* }
|
||||
* /**
|
||||
* test usesCompiler
|
||||
@@ -110,7 +110,7 @@ class PhpResourceTest extends PHPUnit_Smarty
|
||||
$this->smarty->caching = true;
|
||||
$this->smarty->cache_lifetime = 1000;
|
||||
$tpl = $this->smarty->createTemplate('php:phphelloworld.php');
|
||||
$this->assertContains('php hello world', $this->smarty->fetch($tpl));
|
||||
$this->assertStringContainsString('php hello world', $this->smarty->fetch($tpl));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -207,7 +207,7 @@ class PhpResourceTest extends PHPUnit_Smarty
|
||||
{
|
||||
$this->smarty->setAllowPhpTemplates(true);
|
||||
$tpl = $this->smarty->createTemplate('php:phphelloworld.php');
|
||||
$this->assertContains('php hello world', $tpl->fetch());
|
||||
$this->assertStringContainsString('php hello world', $tpl->fetch());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -275,7 +275,7 @@ class PhpResourceTest extends PHPUnit_Smarty
|
||||
public function testIncludePhpTemplate()
|
||||
{
|
||||
$this->smarty->setAllowPhpTemplates(true);
|
||||
$this->assertContains('php hello world', $this->smarty->fetch('includephp.tpl'));
|
||||
$this->assertStringContainsString('php hello world', $this->smarty->fetch('includephp.tpl'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -285,7 +285,7 @@ class PhpResourceTest extends PHPUnit_Smarty
|
||||
{
|
||||
$this->smarty->caching = true;
|
||||
$this->smarty->setAllowPhpTemplates(true);
|
||||
$this->assertContains('php hello world', $this->smarty->fetch('includephp.tpl'));
|
||||
$this->assertStringContainsString('php hello world', $this->smarty->fetch('includephp.tpl'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -16,7 +16,7 @@
|
||||
class RegisteredResourceTest extends PHPUnit_Smarty
|
||||
{
|
||||
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
|
||||
|
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
class ResourcePluginTest extends PHPUnit_Smarty
|
||||
{
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
class StreamResourceTest extends PHPUnit_Smarty
|
||||
{
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
|
||||
@@ -32,7 +32,7 @@ class StreamResourceTest extends PHPUnit_Smarty
|
||||
{
|
||||
$this->cleanDirs();
|
||||
}
|
||||
public function tearDown()
|
||||
public function tearDown(): void
|
||||
{
|
||||
parent::tearDown();
|
||||
stream_wrapper_unregister("global");
|
||||
@@ -138,8 +138,6 @@ class StreamResourceTest extends PHPUnit_Smarty
|
||||
$this->assertFalse($this->smarty->templateExists('global:notthere'));
|
||||
}
|
||||
/**
|
||||
* @expectedException SmartyException
|
||||
* @expectedExceptionMessage 'global:notthere'
|
||||
* @runInSeparateProcess
|
||||
* @preserveGlobalState disabled
|
||||
*
|
||||
@@ -148,7 +146,9 @@ class StreamResourceTest extends PHPUnit_Smarty
|
||||
|
||||
public function testTemplateStramNotExists3()
|
||||
{
|
||||
$result = $this->smarty->fetch('global:notthere');
|
||||
$this->expectException('SmartyException');
|
||||
$this->expectExceptionMessage('\'global:notthere\'');
|
||||
$this->smarty->fetch('global:notthere');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
class StringResourceTest extends PHPUnit_Smarty
|
||||
{
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
class FunctionTest extends PHPUnit_Smarty
|
||||
{
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
}
|
||||
@@ -35,7 +35,7 @@ class FunctionTest extends PHPUnit_Smarty
|
||||
$this->smarty->fetch('eval:{unknown()}');
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$this->assertContains("PHP function 'unknown' not allowed by security setting", $e->getMessage());
|
||||
$this->assertStringContainsString("PHP function 'unknown' not allowed by security setting", $e->getMessage());
|
||||
|
||||
return;
|
||||
}
|
||||
|
@@ -16,7 +16,7 @@
|
||||
class SecurityTest extends PHPUnit_Smarty
|
||||
{
|
||||
public $loadSmartyBC = true;
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
|
||||
@@ -60,15 +60,15 @@ class SecurityTest extends PHPUnit_Smarty
|
||||
|
||||
/**
|
||||
* test not trusted PHP function
|
||||
* @expectedException SmartyException
|
||||
* @expectedExceptionMessage PHP function 'count' not allowed by security setting
|
||||
* @runInSeparateProcess
|
||||
* @preserveGlobalState disabled
|
||||
*/
|
||||
public function testNotTrustedPHPFunction()
|
||||
{
|
||||
$this->expectException('SmartyException');
|
||||
$this->expectExceptionMessage('PHP function \'count\' not allowed by security setting');
|
||||
$this->smarty->security_policy->php_functions = array('null');
|
||||
$this->smarty->fetch('string:{assign var=foo value=[1,2,3,4,5]}{count($foo)}');
|
||||
$this->smarty->fetch('string:{assign var=foo value=[1,2,3,4,5]}{count($foo)}');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -91,13 +91,13 @@ class SecurityTest extends PHPUnit_Smarty
|
||||
|
||||
/**
|
||||
* test not trusted modifier
|
||||
* @expectedException SmartyException
|
||||
* @expectedExceptionMessage modifier 'count' not allowed by security setting
|
||||
* @runInSeparateProcess
|
||||
* @preserveGlobalState disabled
|
||||
*/
|
||||
public function testNotTrustedModifier()
|
||||
{
|
||||
$this->expectException('SmartyException');
|
||||
$this->expectExceptionMessage('modifier \'count\' not allowed by security setting');
|
||||
$this->smarty->security_policy->php_modifiers = array('null');
|
||||
$this->smarty->fetch('string:{assign var=foo value=[1,2,3,4,5]}{$foo|@count}');
|
||||
}
|
||||
@@ -123,26 +123,26 @@ class SecurityTest extends PHPUnit_Smarty
|
||||
|
||||
/**
|
||||
* test not allowed tag
|
||||
* @expectedException SmartyException
|
||||
* @expectedExceptionMessage tag 'cycle' not allowed by security setting
|
||||
* @runInSeparateProcess
|
||||
* @preserveGlobalState disabled
|
||||
*/
|
||||
public function testNotAllowedTags2()
|
||||
{
|
||||
$this->expectException('SmartyException');
|
||||
$this->expectExceptionMessage('tag \'cycle\' not allowed by security setting');
|
||||
$this->smarty->security_policy->allowed_tags = array('counter');
|
||||
$this->smarty->fetch('string:{counter}{cycle values="1,2"}');
|
||||
}
|
||||
|
||||
/**
|
||||
* test disabled tag
|
||||
* @expectedException SmartyException
|
||||
* @expectedExceptionMessage tag 'cycle' disabled by security setting
|
||||
* @runInSeparateProcess
|
||||
* @preserveGlobalState disabled
|
||||
*/
|
||||
public function testDisabledTags()
|
||||
{
|
||||
$this->expectException('SmartyException');
|
||||
$this->expectExceptionMessage('tag \'cycle\' disabled by security setting');
|
||||
$this->smarty->security_policy->disabled_tags = array('cycle');
|
||||
$this->smarty->fetch('string:{counter}{cycle values="1,2"}');
|
||||
}
|
||||
@@ -166,28 +166,28 @@ class SecurityTest extends PHPUnit_Smarty
|
||||
|
||||
/**
|
||||
* test not allowed modifier
|
||||
* @expectedException SmartyException
|
||||
* @expectedExceptionMessage modifier 'lower' not allowed by security setting
|
||||
* @runInSeparateProcess
|
||||
* @preserveGlobalState disabled
|
||||
*/
|
||||
public function testNotAllowedModifier()
|
||||
{
|
||||
$this->expectException('SmartyException');
|
||||
$this->expectExceptionMessage('modifier \'lower\' not allowed by security setting');
|
||||
$this->smarty->security_policy->allowed_modifiers = array('upper');
|
||||
$this->smarty->fetch('string:{"hello"|upper}{"world"|lower}');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* test disabled modifier
|
||||
* @expectedException SmartyException
|
||||
* @expectedExceptionMessage modifier 'lower' disabled by security setting
|
||||
* @runInSeparateProcess
|
||||
* @preserveGlobalState disabled
|
||||
*/
|
||||
public function testDisabledModifier()
|
||||
{
|
||||
$this->expectException('SmartyException');
|
||||
$this->expectExceptionMessage('modifier \'lower\' disabled by security setting');
|
||||
$this->smarty->security_policy->disabled_modifiers = array('lower');
|
||||
$this->smarty->fetch('string:{"hello"|upper}{"world"|lower}');
|
||||
$this->smarty->fetch('string:{"hello"|upper}{"world"|lower}');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -268,15 +268,15 @@ class SecurityTest extends PHPUnit_Smarty
|
||||
/**
|
||||
* test not trusted directory
|
||||
*
|
||||
* @expectedException SmartyException
|
||||
* @expectedExceptionMessage not trusted file path
|
||||
* @runInSeparateProcess
|
||||
* @preserveGlobalState disabled
|
||||
*/
|
||||
public function testNotTrustedDirectory()
|
||||
{
|
||||
$this->expectException('SmartyException');
|
||||
$this->expectExceptionMessage('not trusted file path');
|
||||
$this->smarty->security_policy->secure_dir = array(str_replace('\\', '/', dirname(__FILE__) . '/templates_3/'));
|
||||
$this->smarty->fetch('string:{include file="templates_2/hello.tpl"}');
|
||||
$this->smarty->fetch('string:{include file="templates_2/hello.tpl"}');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -300,15 +300,15 @@ class SecurityTest extends PHPUnit_Smarty
|
||||
|
||||
/**
|
||||
* test not trusted PHP function
|
||||
* @expectedException SmartyException
|
||||
* @expectedExceptionMessage access to static class 'mysecuritystaticclass' not allowed by security setting
|
||||
* @runInSeparateProcess
|
||||
* @preserveGlobalState disabled
|
||||
*/
|
||||
public function testNotTrustedStaticClass()
|
||||
{
|
||||
$this->expectException('SmartyException');
|
||||
$this->expectExceptionMessage('access to static class \'mysecuritystaticclass\' not allowed by security setting');
|
||||
$this->smarty->security_policy->static_classes = array('null');
|
||||
$this->smarty->fetch('string:{mysecuritystaticclass::square(5)}');
|
||||
$this->smarty->fetch('string:{mysecuritystaticclass::square(5)}');
|
||||
}
|
||||
|
||||
public function testChangedTrustedDirectory()
|
||||
@@ -342,14 +342,14 @@ class SecurityTest extends PHPUnit_Smarty
|
||||
$this->assertTrue($tpl->source->exists);
|
||||
}
|
||||
/**
|
||||
* @expectedException SmartyException
|
||||
* @expectedExceptionMessage stream 'global' not allowed by security setting
|
||||
* @runInSeparateProcess
|
||||
* @preserveGlobalState disabled
|
||||
* test template file exits
|
||||
*/
|
||||
public function testTemplateNotTrustedStream()
|
||||
{
|
||||
$this->expectException('SmartyException');
|
||||
$this->expectExceptionMessage('stream \'global\' not allowed by security setting');
|
||||
stream_wrapper_register("global", "ResourceStreamSecurity")
|
||||
or die("Failed to register protocol");
|
||||
$fp = fopen("global://mytest", "r+");
|
||||
@@ -368,19 +368,19 @@ class SecurityTest extends PHPUnit_Smarty
|
||||
$this->smarty->security_policy->trusted_uri = array(
|
||||
'#https://www.smarty.net$#i'
|
||||
);
|
||||
$this->assertContains('<title>Preface | Smarty</title>', $this->smarty->fetch('string:{fetch file="https://www.smarty.net/docs/en/preface.tpl"}'));
|
||||
$this->assertStringContainsString('<title>Preface | Smarty</title>', $this->smarty->fetch('string:{fetch file="https://www.smarty.net/docs/en/preface.tpl"}'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException SmartyException
|
||||
* @expectedExceptionMessage URI 'https://www.smarty.net/docs/en/preface.tpl' not allowed by security setting
|
||||
* @runInSeparateProcess
|
||||
* @preserveGlobalState disabled
|
||||
*/
|
||||
public function testNotTrustedUri()
|
||||
{
|
||||
$this->expectException('SmartyException');
|
||||
$this->expectExceptionMessage('URI \'https://www.smarty.net/docs/en/preface.tpl\' not allowed by security setting');
|
||||
$this->smarty->security_policy->trusted_uri = array();
|
||||
$this->assertContains('<title>Preface | Smarty</title>', $this->smarty->fetch('string:{fetch file="https://www.smarty.net/docs/en/preface.tpl"}'));
|
||||
$this->assertStringContainsString('<title>Preface | Smarty</title>', $this->smarty->fetch('string:{fetch file="https://www.smarty.net/docs/en/preface.tpl"}'));
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
class AppendTest extends PHPUnit_Smarty
|
||||
{
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
}
|
||||
|
@@ -17,7 +17,7 @@ class AppendByRefBCTest extends PHPUnit_Smarty
|
||||
{
|
||||
public $loadSmartyBC = true;
|
||||
public $loadSmarty = false;
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
class AppendByRefTest extends PHPUnit_Smarty
|
||||
{
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
class AssignTest extends PHPUnit_Smarty
|
||||
{
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
}
|
||||
|
@@ -17,7 +17,7 @@ class AssignByRefBCTest extends PHPUnit_Smarty
|
||||
{
|
||||
public $loadSmartyBC = true;
|
||||
public $loadSmarty = false;
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
class AssignByRefTest extends PHPUnit_Smarty
|
||||
{
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
class AssignGlobalTest extends PHPUnit_Smarty
|
||||
{
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
}
|
||||
|
@@ -20,7 +20,7 @@ class ClearAllAssignBCTest extends PHPUnit_Smarty
|
||||
protected $_dataBC = null;
|
||||
protected $_tplBC = null;
|
||||
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
|
||||
|
@@ -18,7 +18,7 @@ class ClearAllAssignTest extends PHPUnit_Smarty
|
||||
protected $_data = null;
|
||||
protected $_tpl = null;
|
||||
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
|
||||
|
@@ -17,7 +17,7 @@ class ClearAssignBCTest extends PHPUnit_Smarty
|
||||
{
|
||||
public $loadSmartyBC = true;
|
||||
public $loadSmarty = false;
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
|
||||
|
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
class ClearAssignTest extends PHPUnit_Smarty
|
||||
{
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
$this->smarty->assign('foo', 'foo');
|
||||
|
@@ -20,7 +20,7 @@ class ClearCompiledBCTest extends ClearCompiledTest
|
||||
public $loadSmartyBC = true;
|
||||
public $loadSmarty = false;
|
||||
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
$this->smartyBC->addTemplateDir('./templates_2/');
|
||||
|
@@ -17,7 +17,7 @@
|
||||
class ClearCompiledTest extends PHPUnit_Smarty
|
||||
{
|
||||
public $methodName = null;
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
$this->smarty->addTemplateDir('./templates_2/');
|
||||
|
@@ -18,7 +18,7 @@ class get_template_varsBCTest extends PHPUnit_Smarty
|
||||
public $loadSmartyBC = true;
|
||||
public $loadSmarty = false;
|
||||
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
class GetTemplateVarsTest extends PHPUnit_Smarty
|
||||
{
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
}
|
||||
|
@@ -16,7 +16,7 @@
|
||||
class RegisterBlockTest extends PHPUnit_Smarty
|
||||
{
|
||||
public $loadSmartyBC = true;
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
$this->smarty->disableSecurity();
|
||||
|
@@ -18,7 +18,7 @@ class RegisterCompilerFunctionBCTest extends PHPUnit_Smarty
|
||||
public $loadSmartyBC = true;
|
||||
public $loadSmarty = false;
|
||||
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
class RegisterCompilerFunctionTest extends PHPUnit_Smarty
|
||||
{
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
}
|
||||
|
@@ -20,7 +20,7 @@ class RegisterFunctionBCTest extends PHPUnit_Smarty
|
||||
|
||||
public $loadSmarty = false;
|
||||
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
}
|
||||
|
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
class RegisterFunctionTest extends PHPUnit_Smarty
|
||||
{
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
class RegisterModifierTest extends PHPUnit_Smarty
|
||||
{
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
class CompileRegisteredObjectFunctionTest extends PHPUnit_Smarty
|
||||
{
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
|
||||
|
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
class TemplateExistsTest extends PHPUnit_Smarty
|
||||
{
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
class CommentsTest extends PHPUnit_Smarty
|
||||
{
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
class SpacingTest extends PHPUnit_Smarty
|
||||
{
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
class StaticClassAccessTest extends PHPUnit_Smarty
|
||||
{
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
$this->smarty->disableSecurity();
|
||||
|
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
class CompileAppendTest extends PHPUnit_Smarty
|
||||
{
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
$this->smarty->addPluginsDir("../../../__shared/PHPunitplugins/");
|
||||
|
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
class CompileAssignTest extends PHPUnit_Smarty
|
||||
{
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
$this->smarty->addPluginsDir("../../../__shared/PHPunitplugins/");
|
||||
|
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
class CompileBlockPluginTest extends PHPUnit_Smarty
|
||||
{
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
$this->smarty->addPluginsDir("./PHPunitplugins/");
|
||||
@@ -47,13 +47,11 @@ class CompileBlockPluginTest extends PHPUnit_Smarty
|
||||
|
||||
/**
|
||||
* test unknown block plugin tag
|
||||
*
|
||||
* @expectedException SmartyCompilerException
|
||||
* @expectedExceptionMessage unknown tag 'bar'
|
||||
*
|
||||
*/
|
||||
public function testBlockPluginUnknown()
|
||||
{
|
||||
$this->expectException('SmartyCompilerException');
|
||||
$this->expectExceptionMessage('unknown tag \'bar\'');
|
||||
$this->assertEquals("hello world", $this->smarty->fetch('unknown.tpl'));
|
||||
}
|
||||
|
||||
@@ -75,12 +73,11 @@ class CompileBlockPluginTest extends PHPUnit_Smarty
|
||||
*
|
||||
* @runInSeparateProcess
|
||||
* @preserveGlobalState disabled
|
||||
* @expectedException SmartyException
|
||||
* @expectedExceptionMessage block tag 'blockplugintest' not callable
|
||||
*
|
||||
*/
|
||||
public function testBlockPluginRegisteredFunction2()
|
||||
{
|
||||
$this->expectException('SmartyException');
|
||||
$this->expectExceptionMessage('block tag \'blockplugintest\' not callable');
|
||||
$this->assertEquals('block test', $this->smarty->fetch('registered.tpl'));
|
||||
}
|
||||
|
||||
@@ -102,12 +99,12 @@ class CompileBlockPluginTest extends PHPUnit_Smarty
|
||||
*
|
||||
* @runInSeparateProcess
|
||||
* @preserveGlobalState disabled
|
||||
* @expectedException SmartyException
|
||||
* @expectedExceptionMessage block tag 'blockpluginstatic' not callable
|
||||
*
|
||||
*/
|
||||
public function testBlockPluginRegisteredStatic2()
|
||||
{
|
||||
$this->expectException('SmartyException');
|
||||
$this->expectExceptionMessage('block tag \'blockpluginstatic\' not callable');
|
||||
$this->assertEquals('static block test', $this->smarty->fetch('registered_static.tpl'));
|
||||
}
|
||||
|
||||
@@ -130,12 +127,11 @@ class CompileBlockPluginTest extends PHPUnit_Smarty
|
||||
*
|
||||
* @runInSeparateProcess
|
||||
* @preserveGlobalState disabled
|
||||
* @expectedException SmartyException
|
||||
* @expectedExceptionMessage block tag 'blockpluginmethod' not callable
|
||||
*
|
||||
*/
|
||||
public function testBlockPluginRegisteredMethod2()
|
||||
{
|
||||
$this->expectException('SmartyException');
|
||||
$this->expectExceptionMessage('block tag \'blockpluginmethod\' not callable');
|
||||
$this->assertEquals('method block test', $this->smarty->fetch('registered_method.tpl'));
|
||||
}
|
||||
|
||||
@@ -158,12 +154,11 @@ class CompileBlockPluginTest extends PHPUnit_Smarty
|
||||
*
|
||||
* @runInSeparateProcess
|
||||
* @preserveGlobalState disabled
|
||||
* @expectedException SmartyException
|
||||
* @expectedExceptionMessage block tag 'myobject' not callable
|
||||
*
|
||||
*/
|
||||
public function testBlockPluginRegisteredObject2()
|
||||
{
|
||||
$this->expectException('SmartyException');
|
||||
$this->expectExceptionMessage('block tag \'myobject\' not callable');
|
||||
$this->assertEquals('object block test', $this->smarty->fetch('registered_object.tpl'));
|
||||
}
|
||||
|
||||
@@ -297,10 +292,10 @@ class CompileBlockPluginTest extends PHPUnit_Smarty
|
||||
$this->assertEquals($isCached, $tpl->isCached(), $testName . ' - isCached()');
|
||||
}
|
||||
$result = $this->smarty->fetch($tpl);
|
||||
$this->assertContains("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}",
|
||||
$this->assertStringContainsString("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}",
|
||||
$result,
|
||||
$testName . ' - fetch() failure test number');
|
||||
$this->assertContains("block test{$resultNumber}", $result, $testName . ' - fetch() failure result');
|
||||
$this->assertStringContainsString("block test{$resultNumber}", $result, $testName . ' - fetch() failure result');
|
||||
}
|
||||
|
||||
public function data()
|
||||
|
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
class CompileBlockExtendsTest extends PHPUnit_Smarty
|
||||
{
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
//$this->smarty->setMergeCompiledIncludes(true);
|
||||
@@ -54,7 +54,7 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
|
||||
{
|
||||
$this->smarty->assign('parent', 'parent');
|
||||
$result = $this->smarty->fetch('001_parent.tpl');
|
||||
$this->assertContains('(parent|b)content parent b(parent|/b)', $result);
|
||||
$this->assertStringContainsString('(parent|b)content parent b(parent|/b)', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -77,8 +77,8 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
|
||||
$this->smarty->setCompileId(1);
|
||||
}
|
||||
$result = $this->smarty->fetch('002_child.tpl');
|
||||
$this->assertContains('(child|b)content child b(child|/b)', $result, $testName . ' - content');
|
||||
$this->assertContains("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result,
|
||||
$this->assertStringContainsString('(child|b)content child b(child|/b)', $result, $testName . ' - content');
|
||||
$this->assertStringContainsString("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result,
|
||||
$testName . ' - fetch() failure');
|
||||
}
|
||||
|
||||
@@ -102,9 +102,9 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
|
||||
$this->smarty->setCompileId(1);
|
||||
}
|
||||
$result = $this->smarty->fetch('003_child.tpl');
|
||||
$this->assertContains('(child|b)content child b(child|/b)(parent|b)content parent b(parent|/b)', $result,
|
||||
$this->assertStringContainsString('(child|b)content child b(child|/b)(parent|b)content parent b(parent|/b)', $result,
|
||||
$testName . ' - content');
|
||||
$this->assertContains("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result,
|
||||
$this->assertStringContainsString("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result,
|
||||
$testName . ' - fetch() failure');
|
||||
}
|
||||
|
||||
@@ -129,9 +129,9 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
|
||||
$this->smarty->setCompileId(1);
|
||||
}
|
||||
$result = $this->smarty->fetch('003_grand.tpl');
|
||||
$this->assertContains('(grand|b)content grand b(grand|/b)(child|b)content child b(child|/b)(parent|b)content parent b(parent|/b)',
|
||||
$this->assertStringContainsString('(grand|b)content grand b(grand|/b)(child|b)content child b(child|/b)(parent|b)content parent b(parent|/b)',
|
||||
$result, $testName . ' - content');
|
||||
$this->assertContains("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result,
|
||||
$this->assertStringContainsString("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result,
|
||||
$testName . ' - fetch() failure');
|
||||
}
|
||||
|
||||
@@ -156,9 +156,9 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
|
||||
$this->smarty->setCompileId(1);
|
||||
}
|
||||
$result = $this->smarty->fetch('004_child.tpl');
|
||||
$this->assertContains('(parent|b)content parent b(parent|/b)(child|b)content child b(child|/b)', $result,
|
||||
$this->assertStringContainsString('(parent|b)content parent b(parent|/b)(child|b)content child b(child|/b)', $result,
|
||||
$testName . ' - content');
|
||||
$this->assertContains("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result,
|
||||
$this->assertStringContainsString("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result,
|
||||
$testName . ' - fetch() failure');
|
||||
}
|
||||
|
||||
@@ -183,9 +183,9 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
|
||||
$this->smarty->setCompileId(1);
|
||||
}
|
||||
$result = $this->smarty->fetch('004_grand.tpl');
|
||||
$this->assertContains('(parent|b)content parent b(parent|/b)(child|b)content child b(child|/b)(grand|b)content grand b(grand|/b)',
|
||||
$this->assertStringContainsString('(parent|b)content parent b(parent|/b)(child|b)content child b(child|/b)(grand|b)content grand b(grand|/b)',
|
||||
$result, $testName . ' - content');
|
||||
$this->assertContains("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result,
|
||||
$this->assertStringContainsString("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result,
|
||||
$testName . ' - fetch() failure');
|
||||
}
|
||||
|
||||
@@ -210,9 +210,9 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
|
||||
$this->smarty->setCompileId(1);
|
||||
}
|
||||
$result = $this->smarty->fetch('004_grand2.tpl');
|
||||
$this->assertContains('(parent|b)content parent b(parent|/b)(grand|b)content grand b(grand|/b)(child|b)content child b(child|/b)(grand|b)content grand b(grand|/b)',
|
||||
$this->assertStringContainsString('(parent|b)content parent b(parent|/b)(grand|b)content grand b(grand|/b)(child|b)content child b(child|/b)(grand|b)content grand b(grand|/b)',
|
||||
$result, $testName . ' - content');
|
||||
$this->assertContains("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result,
|
||||
$this->assertStringContainsString("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result,
|
||||
$testName . ' - fetch() failure');
|
||||
}
|
||||
|
||||
@@ -236,9 +236,9 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
|
||||
$this->smarty->setCompileId(1);
|
||||
}
|
||||
$result = $this->smarty->fetch('005_child.tpl');
|
||||
$this->assertContains('(parent|b)content parent b(parent|/b)(child|b)content child b(child|/b)', $result,
|
||||
$this->assertStringContainsString('(parent|b)content parent b(parent|/b)(child|b)content child b(child|/b)', $result,
|
||||
$testName . ' - content');
|
||||
$this->assertContains("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result,
|
||||
$this->assertStringContainsString("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result,
|
||||
$testName . ' - fetch() failure');
|
||||
}
|
||||
|
||||
@@ -262,9 +262,9 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
|
||||
$this->smarty->setCompileId(1);
|
||||
}
|
||||
$result = $this->smarty->fetch('006_child.tpl');
|
||||
$this->assertContains('(parent|b)content (child|b)content child b(child|/b) b(parent|/b)', $result,
|
||||
$this->assertStringContainsString('(parent|b)content (child|b)content child b(child|/b) b(parent|/b)', $result,
|
||||
$testName . ' - content');
|
||||
$this->assertContains("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result,
|
||||
$this->assertStringContainsString("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result,
|
||||
$testName . ' - fetch() failure');
|
||||
}
|
||||
|
||||
@@ -289,9 +289,9 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
|
||||
$this->smarty->setCompileId(1);
|
||||
}
|
||||
$result = $this->smarty->fetch('007_child.tpl');
|
||||
$this->assertContains('(child|b)content (parent|b)content parent b(parent|/b) b(child|/b)', $result,
|
||||
$this->assertStringContainsString('(child|b)content (parent|b)content parent b(parent|/b) b(child|/b)', $result,
|
||||
$testName . ' - content');
|
||||
$this->assertContains("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result,
|
||||
$this->assertStringContainsString("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result,
|
||||
$testName . ' - fetch() failure');
|
||||
}
|
||||
|
||||
@@ -316,9 +316,9 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
|
||||
$this->smarty->setCompileId(1);
|
||||
}
|
||||
$result = $this->smarty->fetch('007_grand.tpl');
|
||||
$this->assertContains('(grand|b)content (child|b)content (parent|b)content parent b(parent|/b) b(child|/b) b(grand|/b)',
|
||||
$this->assertStringContainsString('(grand|b)content (child|b)content (parent|b)content parent b(parent|/b) b(child|/b) b(grand|/b)',
|
||||
$result, $testName . ' - content');
|
||||
$this->assertContains("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result,
|
||||
$this->assertStringContainsString("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result,
|
||||
$testName . ' - fetch() failure');
|
||||
}
|
||||
|
||||
@@ -343,9 +343,9 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
|
||||
$this->smarty->setCompileId(1);
|
||||
}
|
||||
$result = $this->smarty->fetch('008_child.tpl');
|
||||
$this->assertContains('(child|b)content escaped <text> child 1 b(child|/b', $result,
|
||||
$this->assertStringContainsString('(child|b)content escaped <text> child 1 b(child|/b', $result,
|
||||
$testName . ' - content');
|
||||
$this->assertContains("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result,
|
||||
$this->assertStringContainsString("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result,
|
||||
$testName . ' - fetch() failure');
|
||||
}
|
||||
|
||||
@@ -368,9 +368,9 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
|
||||
$this->smarty->setCompileId(1);
|
||||
}
|
||||
$result = $this->smarty->fetch('009_parent.tpl');
|
||||
$this->assertContains('(parent|b)content (parent|c)content parent c(parent|/c) b(parent|/b)', $result,
|
||||
$this->assertStringContainsString('(parent|b)content (parent|c)content parent c(parent|/c) b(parent|/b)', $result,
|
||||
$testName . ' - content');
|
||||
$this->assertContains("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result,
|
||||
$this->assertStringContainsString("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result,
|
||||
$testName . ' - fetch() failure');
|
||||
}
|
||||
|
||||
@@ -394,9 +394,9 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
|
||||
$this->smarty->setCompileId(1);
|
||||
}
|
||||
$result = $this->smarty->fetch('010_child.tpl');
|
||||
$this->assertContains('(parent|b)content (parent|c)content child c(parent|/c) b(parent|/b)', $result,
|
||||
$this->assertStringContainsString('(parent|b)content (parent|c)content child c(parent|/c) b(parent|/b)', $result,
|
||||
$testName . ' - content');
|
||||
$this->assertContains("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result,
|
||||
$this->assertStringContainsString("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result,
|
||||
$testName . ' - fetch() failure');
|
||||
}
|
||||
|
||||
@@ -421,9 +421,9 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
|
||||
$this->smarty->setCompileId(1);
|
||||
}
|
||||
$result = $this->smarty->fetch('011_grand.tpl');
|
||||
$this->assertContains('(child|b)content(child|c)content(child|n)content(include)content child i(/include)n(child|/n)c(child|/c)(grand|c)content grand c(grand|\c)b(child|/b)',
|
||||
$this->assertStringContainsString('(child|b)content(child|c)content(child|n)content(include)content child i(/include)n(child|/n)c(child|/c)(grand|c)content grand c(grand|\c)b(child|/b)',
|
||||
$result, $testName . ' - content');
|
||||
$this->assertContains("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result,
|
||||
$this->assertStringContainsString("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result,
|
||||
$testName . ' - fetch() failure');
|
||||
}
|
||||
|
||||
@@ -448,9 +448,9 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
|
||||
$this->smarty->setCompileId(1);
|
||||
}
|
||||
$result = $this->smarty->fetch('012_grandgrand.tpl');
|
||||
$this->assertContains('(grand|b)content (grandgrand|c)content c(grandgrand|\c)(grand|c)content c(grand|\c) b(grand|/b)',
|
||||
$this->assertStringContainsString('(grand|b)content (grandgrand|c)content c(grandgrand|\c)(grand|c)content c(grand|\c) b(grand|/b)',
|
||||
$result, $testName . ' - content');
|
||||
$this->assertContains("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result,
|
||||
$this->assertStringContainsString("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result,
|
||||
$testName . ' - fetch() failure');
|
||||
}
|
||||
|
||||
@@ -472,9 +472,9 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
|
||||
$this->smarty->setCompileId(1);
|
||||
}
|
||||
$result = $this->smarty->fetch('018_child.tpl');
|
||||
$this->assertContains('(child|b)content(child|c)content child c(child|/c)b(child|/b)', $result,
|
||||
$this->assertStringContainsString('(child|b)content(child|c)content child c(child|/c)b(child|/b)', $result,
|
||||
$testName . ' - content');
|
||||
$this->assertContains("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result,
|
||||
$this->assertStringContainsString("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result,
|
||||
$testName . ' - fetch() failure');
|
||||
}
|
||||
|
||||
@@ -496,9 +496,9 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
|
||||
$this->smarty->setCompileId(1);
|
||||
}
|
||||
$result = $this->smarty->fetch('018_grand.tpl');
|
||||
$this->assertContains('(child|b)content(child|c)content child c(child|/c)(child|d)content (grand|d)content grand d(grand|/d) d(child|/d)b(child|/b)',
|
||||
$this->assertStringContainsString('(child|b)content(child|c)content child c(child|/c)(child|d)content (grand|d)content grand d(grand|/d) d(child|/d)b(child|/b)',
|
||||
$result, $testName . ' - content');
|
||||
$this->assertContains("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result,
|
||||
$this->assertStringContainsString("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result,
|
||||
$testName . ' - fetch() failure');
|
||||
}
|
||||
|
||||
@@ -520,9 +520,9 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
|
||||
$this->smarty->setCompileId(1);
|
||||
}
|
||||
$result = $this->smarty->fetch('018_grandgrand.tpl');
|
||||
$this->assertContains('(child|b)content(grand|c)content (grandgrand|c)content grandgrand c(grandgrand|/c) c(grand|/c)(child|d)content (grandgrand|d)content grandgrand d(grandgrand|/d) d(child|/d)b(child|/b)',
|
||||
$this->assertStringContainsString('(child|b)content(grand|c)content (grandgrand|c)content grandgrand c(grandgrand|/c) c(grand|/c)(child|d)content (grandgrand|d)content grandgrand d(grandgrand|/d) d(child|/d)b(child|/b)',
|
||||
$result, $testName . ' - content');
|
||||
$this->assertContains("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result,
|
||||
$this->assertStringContainsString("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result,
|
||||
$testName . ' - fetch() failure');
|
||||
}
|
||||
|
||||
@@ -544,13 +544,13 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
|
||||
$this->smarty->setCompileId(1);
|
||||
}
|
||||
$result = $this->smarty->fetch('020_include_root.tpl');
|
||||
$this->assertContains('(include1)(include1|p)content 1 p(include1|\p)(include1|b)content 1 b(include1|\b)(\include1)',
|
||||
$this->assertStringContainsString('(include1)(include1|p)content 1 p(include1|\p)(include1|b)content 1 b(include1|\b)(\include1)',
|
||||
$result, $testName . ' - include 1');
|
||||
$this->assertContains('(include2)(include2|p)content 2 p(include2|\p)(include2|b)content 2 b(include2|\b)(\include2)',
|
||||
$this->assertStringContainsString('(include2)(include2|p)content 2 p(include2|\p)(include2|b)content 2 b(include2|\b)(\include2)',
|
||||
$result, $testName . ' - include 1');
|
||||
$this->assertContains('(include3)(include3|p)content 3 p(include3|\p)(include3|b)content 3 b(include3|\b)(\include3)',
|
||||
$this->assertStringContainsString('(include3)(include3|p)content 3 p(include3|\p)(include3|b)content 3 b(include3|\b)(\include3)',
|
||||
$result, $testName . ' - include 1');
|
||||
$this->assertContains("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result,
|
||||
$this->assertStringContainsString("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result,
|
||||
$testName . ' - fetch() failure');
|
||||
}
|
||||
|
||||
@@ -571,7 +571,7 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
|
||||
$tpl = $this->smarty->createTemplate('021_grand.tpl', $this->smarty);
|
||||
$this->assertFalse($tpl->isCached());
|
||||
$result = $this->smarty->fetch($tpl);
|
||||
$this->assertContains('(grand|b)content grand b(grand|/b)(child|b)content child b(child|/b)(parent|b)content parent b(parent|/b)',
|
||||
$this->assertStringContainsString('(grand|b)content grand b(grand|/b)(child|b)content child b(child|/b)(parent|b)content parent b(parent|/b)',
|
||||
$result);
|
||||
$this->smarty->_clearTemplateCache();
|
||||
$this->smarty->assign('parent', 'parent2');
|
||||
@@ -580,7 +580,7 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
|
||||
$tpl2 = $this->smarty->createTemplate('021_grand.tpl', $this->smarty);
|
||||
$this->assertTrue($tpl2->isCached());
|
||||
$result = $this->smarty->fetch($tpl2);
|
||||
$this->assertContains('(grand|b)content grand2 b(grand|/b)(child|b)content child2 b(child|/b)(parent|b)content parent b(parent|/b)',
|
||||
$this->assertStringContainsString('(grand|b)content grand2 b(grand|/b)(child|b)content child2 b(child|/b)(parent|b)content parent b(parent|/b)',
|
||||
$result);
|
||||
}
|
||||
|
||||
@@ -601,7 +601,7 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
|
||||
$tpl2 = $this->smarty->createTemplate('021_grand.tpl', $this->smarty);
|
||||
$this->assertTrue($tpl2->isCached());
|
||||
$result = $this->smarty->fetch($tpl2);
|
||||
$this->assertContains('(grand|b)content grand3 b(grand|/b)(child|b)content child3 b(child|/b)(parent|b)content parent b(parent|/b)',
|
||||
$this->assertStringContainsString('(grand|b)content grand3 b(grand|/b)(child|b)content child3 b(child|/b)(parent|b)content parent b(parent|/b)',
|
||||
$result);
|
||||
}
|
||||
|
||||
@@ -626,7 +626,7 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
|
||||
$tpl = $this->smarty->createTemplate('021_grand.tpl', $this->smarty);
|
||||
$this->assertFalse($tpl->isCached());
|
||||
$result = $this->smarty->fetch($tpl);
|
||||
$this->assertContains('(grand|b)content grand4 b(grand|/b)(child|b)content child4 b(child|/b)(parent|b)content parent4 b(parent|/b)',
|
||||
$this->assertStringContainsString('(grand|b)content grand4 b(grand|/b)(child|b)content child4 b(child|/b)(parent|b)content parent4 b(parent|/b)',
|
||||
$result);
|
||||
$this->smarty->_clearTemplateCache();
|
||||
$this->smarty->assign('parent', 'parent5');
|
||||
@@ -636,7 +636,7 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
|
||||
$tpl2 = $this->smarty->createTemplate('021_grand.tpl', $this->smarty);
|
||||
$this->assertTrue($tpl2->isCached());
|
||||
$result = $this->smarty->fetch($tpl2);
|
||||
$this->assertContains('(grand|b)content grand5 b(grand|/b)(child|b)content child5 b(child|/b)(parent|b)content parent4 b(parent|/b)',
|
||||
$this->assertStringContainsString('(grand|b)content grand5 b(grand|/b)(child|b)content child5 b(child|/b)(parent|b)content parent4 b(parent|/b)',
|
||||
$result);
|
||||
}
|
||||
|
||||
@@ -661,7 +661,7 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
|
||||
$tpl = $this->smarty->createTemplate('021_grand.tpl', $this->smarty);
|
||||
$this->assertFalse($tpl->isCached());
|
||||
$result = $this->smarty->fetch($tpl);
|
||||
$this->assertContains('(grand|b)content grand6 b(grand|/b)(child|b)content child6 b(child|/b)(parent|b)content parent6 b(parent|/b)',
|
||||
$this->assertStringContainsString('(grand|b)content grand6 b(grand|/b)(child|b)content child6 b(child|/b)(parent|b)content parent6 b(parent|/b)',
|
||||
$result);
|
||||
}
|
||||
|
||||
@@ -683,7 +683,7 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
|
||||
$tpl2 = $this->smarty->createTemplate('021_grand.tpl', $this->smarty);
|
||||
$this->assertTrue($tpl2->isCached());
|
||||
$result = $this->smarty->fetch($tpl2);
|
||||
$this->assertContains('(grand|b)content grand7 b(grand|/b)(child|b)content child7 b(child|/b)(parent|b)content parent6 b(parent|/b)',
|
||||
$this->assertStringContainsString('(grand|b)content grand7 b(grand|/b)(child|b)content child7 b(child|/b)(parent|b)content parent6 b(parent|/b)',
|
||||
$result);
|
||||
}
|
||||
|
||||
@@ -707,7 +707,7 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
|
||||
$tpl = $this->smarty->createTemplate('021_grand.tpl', $this->smarty);
|
||||
$this->assertFalse($tpl->isCached());
|
||||
$result = $this->smarty->fetch($tpl);
|
||||
$this->assertContains('(grand|b)content grand8 b(grand|/b)(child|b)content child8 b(child|/b)(parent|b)content parent8 b(parent|/b)',
|
||||
$this->assertStringContainsString('(grand|b)content grand8 b(grand|/b)(child|b)content child8 b(child|/b)(parent|b)content parent8 b(parent|/b)',
|
||||
$result);
|
||||
}
|
||||
|
||||
@@ -728,7 +728,7 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
|
||||
$tpl2 = $this->smarty->createTemplate('021_grand.tpl', $this->smarty);
|
||||
$this->assertTrue($tpl2->isCached());
|
||||
$result = $this->smarty->fetch($tpl2);
|
||||
$this->assertContains('(grand|b)content grand9 b(grand|/b)(child|b)content child9 b(child|/b)(parent|b)content parent8 b(parent|/b)',
|
||||
$this->assertStringContainsString('(grand|b)content grand9 b(grand|/b)(child|b)content child9 b(child|/b)(parent|b)content parent8 b(parent|/b)',
|
||||
$result);
|
||||
}
|
||||
|
||||
@@ -747,37 +747,37 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
|
||||
public function testNotExistingChildBlock_024()
|
||||
{
|
||||
$result = $this->smarty->fetch('024_parent.tpl');
|
||||
$this->assertContains('no >< child', $result);
|
||||
$this->assertStringContainsString('no >< child', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException SmartyCompilerException
|
||||
* @expectedExceptionMessage '{$smarty.block.child}' used outside {block} tags
|
||||
* test {$this->smarty.block.child} outside {block]
|
||||
*/
|
||||
public function testSmartyBlockChildOutsideBlock_025()
|
||||
{
|
||||
$this->expectException('SmartyCompilerException');
|
||||
$this->expectExceptionMessage('\'{$smarty.block.child}\' used outside {block} tags');
|
||||
$this->smarty->fetch('025_parent.tpl');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException SmartyCompilerException
|
||||
* @expectedExceptionMessage '{$smarty.block.parent}' used outside {block} tags
|
||||
* test {$this->smarty.block.parent} outside {block]
|
||||
*/
|
||||
public function testSmartyBlockParentOutsideBlock_026()
|
||||
{
|
||||
$this->expectException('SmartyCompilerException');
|
||||
$this->expectExceptionMessage('\'{$smarty.block.parent}\' used outside {block} tags');
|
||||
$this->smarty->fetch('026_child.tpl');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException SmartyException
|
||||
* @expectedExceptionMessage illegal '{$smarty.block.parent}'
|
||||
* test {$this->smarty.block.parent} in parent template
|
||||
*/
|
||||
public function testSmartyBlockParentInParent_027()
|
||||
{
|
||||
$result = $this->smarty->fetch('027_parent.tpl');
|
||||
$this->expectException('SmartyException');
|
||||
$this->expectExceptionMessage('illegal \'{$smarty.block.parent}\'');
|
||||
$this->smarty->fetch('027_parent.tpl');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -800,8 +800,8 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
|
||||
}
|
||||
$this->smarty->assign('foo', '028_parent_include1.tpl');
|
||||
$result = $this->smarty->fetch('028_child.tpl');
|
||||
$this->assertContains('b1-include-1--b1', $result, $testName . ' - content');
|
||||
$this->assertContains("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result,
|
||||
$this->assertStringContainsString('b1-include-1--b1', $result, $testName . ' - content');
|
||||
$this->assertStringContainsString("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result,
|
||||
$testName . ' - fetch() failure');
|
||||
}
|
||||
|
||||
@@ -822,8 +822,8 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
|
||||
}
|
||||
$this->smarty->assign('foo', '028_parent_include2.tpl');
|
||||
$result = $this->smarty->fetch('028_child.tpl');
|
||||
$this->assertContains('b1-child-i2-include-2--b1', $result, $testName . ' - content');
|
||||
$this->assertContains("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result,
|
||||
$this->assertStringContainsString('b1-child-i2-include-2--b1', $result, $testName . ' - content');
|
||||
$this->assertStringContainsString("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result,
|
||||
$testName . ' - fetch() failure');
|
||||
}
|
||||
|
||||
@@ -845,9 +845,9 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
|
||||
$this->smarty->setCompileId(1);
|
||||
}
|
||||
$result = $this->smarty->fetch('030_grandchild_nested.tpl');
|
||||
$this->assertContains('child pre -grandchild content- child post', $result, $testName . ' - content');
|
||||
$this->assertContains('include:' . $testNumber, $result, $testName . ' - content 2');
|
||||
$this->assertContains("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result,
|
||||
$this->assertStringContainsString('child pre -grandchild content- child post', $result, $testName . ' - content');
|
||||
$this->assertStringContainsString('include:' . $testNumber, $result, $testName . ' - content 2');
|
||||
$this->assertStringContainsString("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result,
|
||||
$testName . ' - fetch() failure');
|
||||
}
|
||||
/**
|
||||
@@ -868,9 +868,9 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
|
||||
$this->smarty->setCompileId(1);
|
||||
}
|
||||
$result = $this->smarty->fetch('sub/030_grandchild_nested_rel.tpl');
|
||||
$this->assertContains('child pre -grandchild content- child post', $result, $testName . ' - content');
|
||||
$this->assertContains('include:' . $testNumber, $result, $testName . ' - content 2');
|
||||
$this->assertContains("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result,
|
||||
$this->assertStringContainsString('child pre -grandchild content- child post', $result, $testName . ' - content');
|
||||
$this->assertStringContainsString('include:' . $testNumber, $result, $testName . ' - content 2');
|
||||
$this->assertStringContainsString("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result,
|
||||
$testName . ' - fetch() failure');
|
||||
}
|
||||
/**
|
||||
@@ -891,8 +891,8 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
|
||||
$this->smarty->setCompileId(1);
|
||||
}
|
||||
$result = $this->smarty->fetch('034_1child.tpl');
|
||||
$this->assertContains('parent b1', $result, $testName . ' - content');
|
||||
$this->assertContains("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result,
|
||||
$this->assertStringContainsString('parent b1', $result, $testName . ' - content');
|
||||
$this->assertStringContainsString("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result,
|
||||
$testName . ' - fetch() failure');
|
||||
}
|
||||
/**
|
||||
@@ -913,8 +913,8 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
|
||||
$this->smarty->setCompileId(1);
|
||||
}
|
||||
$result = $this->smarty->fetch('034_2child.tpl');
|
||||
$this->assertContains('parent b1', $result, $testName . ' - content');
|
||||
$this->assertContains("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result,
|
||||
$this->assertStringContainsString('parent b1', $result, $testName . ' - content');
|
||||
$this->assertStringContainsString("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result,
|
||||
$testName . ' - fetch() failure');
|
||||
}
|
||||
/**
|
||||
@@ -935,8 +935,8 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
|
||||
$this->smarty->setCompileId(1);
|
||||
}
|
||||
$result = $this->smarty->fetch('034_3child.tpl');
|
||||
$this->assertContains('parent b1', $result, $testName . ' - content');
|
||||
$this->assertContains("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result,
|
||||
$this->assertStringContainsString('parent b1', $result, $testName . ' - content');
|
||||
$this->assertStringContainsString("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result,
|
||||
$testName . ' - fetch() failure');
|
||||
}
|
||||
/**
|
||||
@@ -957,8 +957,8 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
|
||||
$this->smarty->setCompileId(1);
|
||||
}
|
||||
$result = $this->smarty->fetch('034_4child.tpl');
|
||||
$this->assertContains('parent b1', $result, $testName . ' - content');
|
||||
$this->assertContains("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result,
|
||||
$this->assertStringContainsString('parent b1', $result, $testName . ' - content');
|
||||
$this->assertStringContainsString("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result,
|
||||
$testName . ' - fetch() failure');
|
||||
}
|
||||
/**
|
||||
@@ -982,9 +982,9 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
|
||||
$this->smarty->setCompileId(1);
|
||||
}
|
||||
$result = $this->smarty->fetch('035_child.tpl');
|
||||
$this->assertContains('(parent|b)content (child|b)content child b(child|/b) b(parent|/b)', $result,
|
||||
$this->assertStringContainsString('(parent|b)content (child|b)content child b(child|/b) b(parent|/b)', $result,
|
||||
$testName . ' - content');
|
||||
$this->assertContains("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result,
|
||||
$this->assertStringContainsString("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result,
|
||||
$testName . ' - fetch() failure');
|
||||
}
|
||||
|
||||
@@ -1009,9 +1009,9 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
|
||||
$this->smarty->setCompileId(1);
|
||||
}
|
||||
$result = $this->smarty->fetch('035_child.tpl');
|
||||
$this->assertContains('(parent|b)content (child|b)content child b(child|/b) b(parent|/b)', $result,
|
||||
$this->assertStringContainsString('(parent|b)content (child|b)content child b(child|/b) b(parent|/b)', $result,
|
||||
$testName . ' - content');
|
||||
$this->assertContains("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result,
|
||||
$this->assertStringContainsString("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result,
|
||||
$testName . ' - fetch() failure');
|
||||
}
|
||||
/**
|
||||
@@ -1035,9 +1035,9 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
|
||||
$this->smarty->setCompileId(1);
|
||||
}
|
||||
$result = $this->smarty->fetch('035_child.tpl');
|
||||
$this->assertContains('(parent|b)content (child|b)content child b(child|/b) b(parent|/b)', $result,
|
||||
$this->assertStringContainsString('(parent|b)content (child|b)content child b(child|/b) b(parent|/b)', $result,
|
||||
$testName . ' - content');
|
||||
$this->assertContains("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result,
|
||||
$this->assertStringContainsString("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result,
|
||||
$testName . ' - fetch() failure');
|
||||
}
|
||||
/**
|
||||
@@ -1061,9 +1061,9 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
|
||||
$this->smarty->setCompileId(1);
|
||||
}
|
||||
$result = $this->smarty->fetch('035_child.tpl');
|
||||
$this->assertContains('(parent|b)content (child|b)content child b(child|/b) b(parent|/b)', $result,
|
||||
$this->assertStringContainsString('(parent|b)content (child|b)content child b(child|/b) b(parent|/b)', $result,
|
||||
$testName . ' - content');
|
||||
$this->assertContains("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result,
|
||||
$this->assertStringContainsString("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result,
|
||||
$testName . ' - fetch() failure');
|
||||
}
|
||||
|
||||
@@ -1102,7 +1102,7 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
|
||||
$this->smarty->loadFilter('post', 'test031');
|
||||
$this->smarty->assign('foo', 'foo');
|
||||
$this->smarty->assign('bar', 'bar');
|
||||
$this->assertContains('bar', $this->smarty->fetch('031_post_filter.tpl'));
|
||||
$this->assertStringContainsString('bar', $this->smarty->fetch('031_post_filter.tpl'));
|
||||
}
|
||||
/*
|
||||
* Test new inheritance root in outermost include
|
||||
@@ -1110,11 +1110,11 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
|
||||
public function testInclude_032()
|
||||
{
|
||||
$result = $this->smarty->fetch('032_child.tpl');
|
||||
$this->assertContains('foo in 032_child.tpl', $result);
|
||||
$this->assertContains('bar in 032_included_child.tpl', $result);
|
||||
$this->assertContains('foo in 032_included_parent.tpl', $result);
|
||||
$this->assertNotContains('bar in 032_included_parent.tpl', $result);
|
||||
$this->assertNotContains('foo in 032_parent.tpl', $result);
|
||||
$this->assertStringContainsString('foo in 032_child.tpl', $result);
|
||||
$this->assertStringContainsString('bar in 032_included_child.tpl', $result);
|
||||
$this->assertStringContainsString('foo in 032_included_parent.tpl', $result);
|
||||
$this->assertStringNotContainsString('bar in 032_included_parent.tpl', $result);
|
||||
$this->assertStringNotContainsString('foo in 032_parent.tpl', $result);
|
||||
}
|
||||
/**
|
||||
* test relative includes in {block}
|
||||
@@ -1134,66 +1134,56 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
|
||||
$this->smarty->setCompileId(1);
|
||||
}
|
||||
$result = $this->smarty->fetch('033_grandchild.tpl');
|
||||
$this->assertContains('include grand:content include grand', $result, $testName . ' - grand');
|
||||
$this->assertContains('include child:content include child', $result, $testName . ' - grand');
|
||||
$this->assertContains('include parent:content include parent', $result, $testName . ' - grand');
|
||||
$this->assertContains("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result,
|
||||
$this->assertStringContainsString('include grand:content include grand', $result, $testName . ' - grand');
|
||||
$this->assertStringContainsString('include child:content include child', $result, $testName . ' - grand');
|
||||
$this->assertStringContainsString('include parent:content include parent', $result, $testName . ' - grand');
|
||||
$this->assertStringContainsString("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result,
|
||||
$testName . ' - fetch() failure');
|
||||
}
|
||||
/**
|
||||
*
|
||||
* test smarty.block.foo
|
||||
*
|
||||
* @expectedException SmartyCompilerException
|
||||
* @expectedExceptionMessage $smarty.block is not defined
|
||||
*/
|
||||
public function testSmartyBlockWrongBlockName_036()
|
||||
{
|
||||
$this->expectException('SmartyCompilerException');
|
||||
$this->expectExceptionMessage('$smarty.block is not defined');
|
||||
$this->smarty->fetch('036_parent.tpl');
|
||||
}
|
||||
/**
|
||||
*
|
||||
* test '{$smarty.block.parent}'
|
||||
*
|
||||
* @expectedException SmartyException
|
||||
* @expectedExceptionMessage inheritance: illegal '{$smarty.block.parent}' used in child template
|
||||
*/
|
||||
public function testSmartyParentBlockCalledInParent_036_1()
|
||||
{
|
||||
$this->expectException('SmartyException');
|
||||
$this->expectExceptionMessage('inheritance: illegal \'{$smarty.block.parent}\' used in child template');
|
||||
$this->smarty->fetch('036_1_parent.tpl');
|
||||
}
|
||||
/**
|
||||
*
|
||||
* test {block_parent}
|
||||
*
|
||||
* @expectedException SmartyException
|
||||
* @expectedExceptionMessage inheritance: illegal '{block_parent}' used in child template
|
||||
*/
|
||||
public function testSmartyParentBlockCalledInParent_036_2()
|
||||
{
|
||||
$this->expectException('SmartyException');
|
||||
$this->expectExceptionMessage('inheritance: illegal \'{block_parent}\' used in child template');
|
||||
$this->smarty->fetch('036_2_parent.tpl');
|
||||
}
|
||||
/**
|
||||
*
|
||||
* test {block_parent}
|
||||
*
|
||||
* @expectedException SmartyException
|
||||
* @expectedExceptionMessage inheritance: illegal '{parent}' used in child template
|
||||
*/
|
||||
public function testSmartyParentBlockCalledInParent_036_3()
|
||||
{
|
||||
$this->expectException('SmartyException');
|
||||
$this->expectExceptionMessage('inheritance: illegal \'{parent}\' used in child template');
|
||||
$this->smarty->fetch('036_3_parent.tpl');
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* test smarty.block
|
||||
*
|
||||
* @expectedException SmartyCompilerException
|
||||
* @expectedExceptionMessage $smarty.block is not defined
|
||||
*/
|
||||
public function testSmartyBlockMissigBlockName_037()
|
||||
{
|
||||
$this->expectException('SmartyCompilerException');
|
||||
$this->expectExceptionMessage('$smarty.block is not defined');
|
||||
$this->smarty->fetch('037_parent.tpl');
|
||||
}
|
||||
|
||||
|
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
class CompileCaptureTest extends PHPUnit_Smarty
|
||||
{
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
$this->smarty->addTemplateDir("./templates_tmp");
|
||||
@@ -70,15 +70,15 @@ class CompileCaptureTest extends PHPUnit_Smarty
|
||||
public function testCapture9()
|
||||
{
|
||||
$result = $this->smarty->fetch('009_capture.tpl');
|
||||
$this->assertContains('-->hello world<--', $result);
|
||||
$this->assertContains('-->hello world2<--', $result);
|
||||
$this->assertStringContainsString('-->hello world<--', $result);
|
||||
$this->assertStringContainsString('-->hello world2<--', $result);
|
||||
}
|
||||
|
||||
public function testCompileCaptureNocache1()
|
||||
{
|
||||
$this->smarty->assign('foo', 1);
|
||||
$this->smarty->caching = 1;
|
||||
$this->assertContains('foo 1', $this->smarty->fetch('test_capture_nocache.tpl'));
|
||||
$this->assertStringContainsString('foo 1', $this->smarty->fetch('test_capture_nocache.tpl'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -92,7 +92,7 @@ class CompileCaptureTest extends PHPUnit_Smarty
|
||||
$this->smarty->assign('foo', 2);
|
||||
$this->smarty->caching = 1;
|
||||
$this->assertTrue($this->smarty->isCached('test_capture_nocache.tpl'));
|
||||
$this->assertContains('foo 2', $this->smarty->fetch('test_capture_nocache.tpl'));
|
||||
$this->assertStringContainsString('foo 2', $this->smarty->fetch('test_capture_nocache.tpl'));
|
||||
}
|
||||
/*
|
||||
* Test capture buffer names with uppercase
|
||||
@@ -100,8 +100,8 @@ class CompileCaptureTest extends PHPUnit_Smarty
|
||||
public function testCapture10()
|
||||
{
|
||||
$result = $this->smarty->fetch('010_capture.tpl');
|
||||
$this->assertContains('lowercase', $result);
|
||||
$this->assertContains('uppercase', $result);
|
||||
$this->assertStringContainsString('lowercase', $result);
|
||||
$this->assertStringContainsString('uppercase', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
class CompilerPluginTest extends PHPUnit_Smarty
|
||||
{
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
}
|
||||
|
@@ -20,7 +20,7 @@ class CompileConfigLoadTest extends PHPUnit_Smarty
|
||||
* This method is called before a test is executed.
|
||||
*
|
||||
*/
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
$this->smarty->addPluginsDir("../../../__shared/PHPunitplugins/");
|
||||
@@ -161,12 +161,12 @@ class CompileConfigLoadTest extends PHPUnit_Smarty
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException SmartyCompilerException
|
||||
* @expectedExceptionMessage Syntax error in config file
|
||||
* test config file syntax error
|
||||
*/
|
||||
public function testConfigSyntaxError_009()
|
||||
{
|
||||
$this->expectException('SmartyCompilerException');
|
||||
$this->expectExceptionMessage('Syntax error in config file');
|
||||
$this->smarty->fetch('009_error.tpl');
|
||||
}
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
class CompileDelimiterTest extends PHPUnit_Smarty
|
||||
{
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
}
|
||||
@@ -41,12 +41,10 @@ class CompileDelimiterTest extends PHPUnit_Smarty
|
||||
$this->assertEquals('x}x', $this->smarty->fetch($tpl));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException SmartyCompilerException
|
||||
* @expectedExceptionMessage nocache option not allowed
|
||||
*/
|
||||
public function testLeftDelimiterError()
|
||||
{
|
||||
$this->expectException('SmartyCompilerException');
|
||||
$this->expectExceptionMessage('nocache option not allowed');
|
||||
$tpl = $this->smarty->createTemplate('string:x{ldelim nocache}x');
|
||||
$this->assertEquals('x{x', $this->smarty->fetch($tpl));
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
class CompileEvalTest extends PHPUnit_Smarty
|
||||
{
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
class CompileForTest extends PHPUnit_Smarty
|
||||
{
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
class CompileForeachTest extends PHPUnit_Smarty
|
||||
{
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
$this->smarty->addPluginsDir("../../../__shared/PHPunitplugins/");
|
||||
|
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
class CompileFunctionPluginTest extends PHPUnit_Smarty
|
||||
{
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
$this->smarty->addPluginsDir("../../../__shared/PHPunitplugins/");
|
||||
|
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
class CompileIfTest extends PHPUnit_Smarty
|
||||
{
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
$this->smarty->addPluginsDir("../../../__shared/PHPunitplugins/");
|
||||
|
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
class CompileIncludeTest extends PHPUnit_Smarty
|
||||
{
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
$this->smarty->addPluginsDir("../../../__shared/PHPunitplugins/");
|
||||
@@ -187,7 +187,7 @@ class CompileIncludeTest extends PHPUnit_Smarty
|
||||
$this->smarty->assign('foo', 1);
|
||||
$this->smarty->assign('bar', 'bar');
|
||||
$content = $this->smarty->fetch('test_recursive_includes.tpl');
|
||||
$this->assertContains("before 1 bar<br>\nbefore 2 bar<br>\nbefore 3 bar<br>\nafter 3 bar<br>\nafter 2 bar<br>\nafter 1 bar<br>", $content, $text);
|
||||
$this->assertStringContainsString("before 1 bar<br>\nbefore 2 bar<br>\nbefore 3 bar<br>\nafter 3 bar<br>\nafter 2 bar<br>\nafter 1 bar<br>", $content, $text);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -203,7 +203,7 @@ class CompileIncludeTest extends PHPUnit_Smarty
|
||||
$this->smarty->assign('foo', 1);
|
||||
$this->smarty->assign('bar', 'bar');
|
||||
$content = $this->smarty->fetch('test_recursive_includes2.tpl');
|
||||
$this->assertContains("before 1 bar<br>\nbefore 3 bar<br>\nbefore 5 bar<br>\nafter 5 bar<br>\nafter 3 bar<br>\nafter 1 bar<br>", $content, $text);
|
||||
$this->assertStringContainsString("before 1 bar<br>\nbefore 3 bar<br>\nbefore 5 bar<br>\nafter 5 bar<br>\nafter 3 bar<br>\nafter 1 bar<br>", $content, $text);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -17,7 +17,7 @@ class CompileIncludePhpTest extends PHPUnit_Smarty
|
||||
{
|
||||
public $loadSmartyBC = true;
|
||||
public $loadSmarty = false;
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
$this->smartyBC->setForceCompile(true);
|
||||
@@ -36,7 +36,7 @@ class CompileIncludePhpTest extends PHPUnit_Smarty
|
||||
$this->smartyBC->disableSecurity();
|
||||
$tpl = $this->smartyBC->createTemplate('include_php.tpl');
|
||||
$result = $this->smartyBC->fetch($tpl);
|
||||
$this->assertContains("test include php", $result);
|
||||
$this->assertStringContainsString("test include php", $result);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -48,7 +48,7 @@ class CompileIncludePhpTest extends PHPUnit_Smarty
|
||||
$this->smartyBC->security_policy->trusted_dir = '.\\scripts\\';
|
||||
$tpl = $this->smartyBC->createTemplate('include_php_trusted.tpl');
|
||||
$result = $this->smartyBC->fetch($tpl);
|
||||
$this->assertContains("test include php", $result);
|
||||
$this->assertStringContainsString("test include php", $result);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -60,7 +60,7 @@ class CompileIncludePhpTest extends PHPUnit_Smarty
|
||||
$tpl = $this->smartyBC->createTemplate('string:start {include_php file=$filename once=false} end');
|
||||
$tpl->assign('filename', 'scripts/test_include_php.php');
|
||||
$result = $this->smartyBC->fetch($tpl);
|
||||
$this->assertContains("test include php", $result);
|
||||
$this->assertStringContainsString("test include php", $result);
|
||||
}
|
||||
|
||||
public function testIncludePhpVariableFileNameShortag()
|
||||
@@ -69,6 +69,6 @@ class CompileIncludePhpTest extends PHPUnit_Smarty
|
||||
$tpl = $this->smartyBC->createTemplate('string:start {include_php $filename once=false} end');
|
||||
$tpl->assign('filename', 'scripts/test_include_php.php');
|
||||
$result = $this->smartyBC->fetch($tpl);
|
||||
$this->assertContains("test include php", $result);
|
||||
$this->assertStringContainsString("test include php", $result);
|
||||
}
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
class CompileInsertTest extends PHPUnit_Smarty
|
||||
{
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
$this->smarty->addPluginsDir(dirname(__FILE__) . "/PHPunitplugins/");
|
||||
@@ -192,7 +192,7 @@ class CompileInsertTest extends PHPUnit_Smarty
|
||||
$this->smarty->compile_id = 1;
|
||||
$tpl = $this->smarty->createTemplate('insertplugintest.tpl');
|
||||
$tpl->assign('foo', 'buh');
|
||||
$this->assertContains('param foo bar globalvar global 2', $this->smarty->fetch($tpl));
|
||||
$this->assertStringContainsString('param foo bar globalvar global 2', $this->smarty->fetch($tpl));
|
||||
}
|
||||
/**
|
||||
* test insert plugin caching 3
|
||||
@@ -203,7 +203,7 @@ class CompileInsertTest extends PHPUnit_Smarty
|
||||
{
|
||||
$this->smarty->caching = true;
|
||||
$this->smarty->assign('insert',$t=time());
|
||||
$this->assertContains($t.'Inner template', $this->smarty->fetch('insertplugintest2.tpl'));
|
||||
$this->assertStringContainsString($t.'Inner template', $this->smarty->fetch('insertplugintest2.tpl'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -216,7 +216,7 @@ class CompileInsertTest extends PHPUnit_Smarty
|
||||
sleep(2);
|
||||
$this->smarty->caching = true;
|
||||
$this->smarty->assign('insert',$t=time());
|
||||
$this->assertContains($t.'Inner template', $this->smarty->fetch('insertplugintest2.tpl'));
|
||||
$this->assertStringContainsString($t.'Inner template', $this->smarty->fetch('insertplugintest2.tpl'));
|
||||
}
|
||||
|
||||
|
||||
@@ -232,7 +232,7 @@ class CompileInsertTest extends PHPUnit_Smarty
|
||||
$this->smarty->fetch($tpl);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$this->assertContains("{insert} no function or plugin found for 'mustfail'", $e->getMessage());
|
||||
$this->assertStringContainsString("{insert} no function or plugin found for 'mustfail'", $e->getMessage());
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -251,7 +251,7 @@ class CompileInsertTest extends PHPUnit_Smarty
|
||||
$this->smarty->fetch($tpl);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$this->assertContains('missing script file', $e->getMessage());
|
||||
$this->assertStringContainsString('missing script file', $e->getMessage());
|
||||
|
||||
return;
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
class LiteralTest extends PHPUnit_Smarty
|
||||
{
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
class CompileMakeNocacheTest extends PHPUnit_Smarty
|
||||
{
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
$this->smarty->addPluginsDir("../../../__shared/PHPunitplugins/");
|
||||
|
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
class CompileNocacheTest extends PHPUnit_Smarty
|
||||
{
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
}
|
||||
@@ -34,13 +34,13 @@ class CompileNocacheTest extends PHPUnit_Smarty
|
||||
$this->smarty->assign('foo', 0);
|
||||
$this->smarty->assign('bar', 'A');
|
||||
$content = $this->smarty->fetch('test_nocache_tag.tpl');
|
||||
$this->assertContains("root 2A", $content);
|
||||
$this->assertContains("include 4A", $content);
|
||||
$this->assertStringContainsString("root 2A", $content);
|
||||
$this->assertStringContainsString("include 4A", $content);
|
||||
$this->smarty->assign('foo', 2);
|
||||
$this->smarty->assign('bar', 'B');
|
||||
$content = $this->smarty->fetch('test_nocache_tag.tpl');
|
||||
$this->assertContains("root 4B", $content);
|
||||
$this->assertContains("include 6B", $content);
|
||||
$this->assertStringContainsString("root 4B", $content);
|
||||
$this->assertStringContainsString("include 6B", $content);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -52,8 +52,8 @@ class CompileNocacheTest extends PHPUnit_Smarty
|
||||
$this->smarty->assign('foo', 0);
|
||||
$this->smarty->assign('bar', 'A');
|
||||
$content = $this->smarty->fetch('test_nocache_tag.tpl');
|
||||
$this->assertContains("root 2A", $content);
|
||||
$this->assertContains("include 4A", $content);
|
||||
$this->assertStringContainsString("root 2A", $content);
|
||||
$this->assertStringContainsString("include 4A", $content);
|
||||
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ class CompileNocacheTest extends PHPUnit_Smarty
|
||||
$this->smarty->assign('foo', 2);
|
||||
$this->smarty->assign('bar', 'B');
|
||||
$content = $this->smarty->fetch('test_nocache_tag.tpl');
|
||||
$this->assertContains("root 4A", $content);
|
||||
$this->assertContains("include 6A", $content);
|
||||
$this->assertStringContainsString("root 4A", $content);
|
||||
$this->assertStringContainsString("include 6A", $content);
|
||||
}
|
||||
}
|
||||
|
@@ -16,7 +16,7 @@
|
||||
class CompilePhpTest extends PHPUnit_Smarty
|
||||
{
|
||||
public $loadSmartyBC = true;
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
$this->smarty->setUseSubDirs(true);
|
||||
@@ -79,13 +79,11 @@ class CompilePhpTest extends PHPUnit_Smarty
|
||||
$content = $tpl->fetch();
|
||||
$this->assertEquals($result, $content, $testName);
|
||||
}
|
||||
/**
|
||||
* @expectedException SmartyCompilerException
|
||||
* @expectedExceptionMessage $smarty->php_handling PHP_ALLOW not allowed. Use SmartyBC to enable it
|
||||
*/
|
||||
|
||||
public function testPHP_ALLOW_error()
|
||||
{
|
||||
$this->expectException('SmartyCompilerException');
|
||||
$this->expectExceptionMessage('$smarty->php_handling PHP_ALLOW not allowed. Use SmartyBC to enable it');
|
||||
$this->smarty->setPhpHandling(Smarty::PHP_ALLOW);
|
||||
$content = $this->smarty->fetch("string:aa <?php echo 'hallo'; ?> ae");
|
||||
}
|
||||
@@ -112,13 +110,12 @@ class CompilePhpTest extends PHPUnit_Smarty
|
||||
}
|
||||
/**
|
||||
* test {php no cache}illegal option
|
||||
* @expectedException SmartyCompilerException
|
||||
* @expectedExceptionMessage illegal value of option flag 'no cache'
|
||||
*
|
||||
*/
|
||||
public function testPHP_Tag_IllegalOption()
|
||||
{
|
||||
$content = $this->smartyBC->fetch("string:aa {php no cache} echo 'hallo'; {/php} ae");
|
||||
$this->expectException('SmartyCompilerException');
|
||||
$this->expectExceptionMessage('illegal value of option flag \'no cache\'');
|
||||
$this->smartyBC->fetch("string:aa {php no cache} echo 'hallo'; {/php} ae");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -17,7 +17,7 @@ class PluginBlockTextformatTest extends PHPUnit_Smarty
|
||||
{
|
||||
protected $string = "\n\nThis is foo.\nThis is foo.\nThis is foo.\nThis is foo.\nThis is foo.\nThis is foo.\n\nThis is bar.\n\nbar foo bar foo foo.\nbar foo bar foo foo.\nbar foo bar foo foo.\nbar foo bar foo foo.\nbar foo bar foo foo.\nbar foo bar foo foo.\nbar foo bar foo foo.\n\n";
|
||||
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
class PluginFunctionFetchTest extends PHPUnit_Smarty
|
||||
{
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
}
|
||||
@@ -34,52 +34,52 @@ class PluginFunctionFetchTest extends PHPUnit_Smarty
|
||||
*/
|
||||
public function testFetchUri()
|
||||
{
|
||||
$this->assertContains('<title>Preface | Smarty</title>', $this->smarty->fetch('string:{fetch file="https://www.smarty.net/docs/en/preface.tpl"}'));
|
||||
$this->assertStringContainsString('<title>Preface | Smarty</title>', $this->smarty->fetch('string:{fetch file="https://www.smarty.net/docs/en/preface.tpl"}'));
|
||||
}
|
||||
|
||||
/**
|
||||
* test {fetch} invalid uri
|
||||
*
|
||||
* @expectedException SmartyException
|
||||
* @expectedExceptionMessage {fetch} cannot read resource 'https://foo.smarty.net/foo.dat'
|
||||
* @runInSeparateProcess
|
||||
* @preserveGlobalState disabled
|
||||
*/
|
||||
public function testFetchInvalidUri()
|
||||
{
|
||||
$result = $this->smarty->fetch('string:{fetch file="https://foo.smarty.net/foo.dat"}');
|
||||
$this->expectException('SmartyException');
|
||||
$this->expectExceptionMessage('{fetch} cannot read resource \'https://foo.smarty.net/foo.dat\'');
|
||||
$this->smarty->fetch('string:{fetch file="https://foo.smarty.net/foo.dat"}');
|
||||
}
|
||||
|
||||
/**
|
||||
* test {fetch file=...} access to file from path not aloo/wed by security settings
|
||||
*
|
||||
* @expectedException SmartyException
|
||||
* @expectedExceptionMessage not trusted file path
|
||||
* @run InSeparateProcess
|
||||
* @preserveGlobalState disabled
|
||||
*/
|
||||
public function testFetchSecurity()
|
||||
{
|
||||
$this->expectException('SmartyException');
|
||||
$this->expectExceptionMessage('not trusted file path');
|
||||
$this->cleanDirs();
|
||||
$dir=$this->smarty->getTemplateDir();
|
||||
$this->smarty->enableSecurity();
|
||||
$result = $this->smarty->fetch('string:{fetch file=\''. $dir[0]. '../../../../../etc/passwd\'}');
|
||||
$this->smarty->fetch('string:{fetch file=\''. $dir[0]. '../../../../../etc/passwd\'}');
|
||||
}
|
||||
/**
|
||||
* test {fetch file=...} access to file from path not aloo/wed by security settings
|
||||
*
|
||||
* @expectedException SmartyException
|
||||
* @expectedExceptionMessage not trusted file path
|
||||
* @run InSeparateProcess
|
||||
* @preserveGlobalState disabled
|
||||
*/
|
||||
public function testFetchSecurity2()
|
||||
{
|
||||
$this->expectException('SmartyException');
|
||||
$this->expectExceptionMessage('not trusted file path');
|
||||
$this->cleanDirs();
|
||||
$dir=$this->smarty->getTemplateDir();
|
||||
$this->smarty->getTemplateDir();
|
||||
$this->smarty->enableSecurity();
|
||||
$this->smarty->setTemplateDir('/templates');
|
||||
$result = $this->smarty->fetch('string:{fetch file="/templates/../etc/passwd"}');
|
||||
$this->smarty->fetch('string:{fetch file="/templates/../etc/passwd"}');
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -17,7 +17,7 @@ require_once(dirname(__FILE__) . '/helpers/_object_tostring.php');
|
||||
*/
|
||||
class PluginFunctionHtmlCheckboxesTest extends PHPUnit_Smarty
|
||||
{
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
class PluginFunctionHtmlImageTest extends PHPUnit_Smarty
|
||||
{
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
}
|
||||
|
@@ -17,7 +17,7 @@ require_once(dirname(__FILE__) . '/helpers/_object_tostring.php');
|
||||
*/
|
||||
class PluginFunctionHtmlOptionsTest extends PHPUnit_Smarty
|
||||
{
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
}
|
||||
|
@@ -16,7 +16,7 @@ require_once(dirname(__FILE__) . '/helpers/_object_tostring.php');
|
||||
*/
|
||||
class PluginFunctionHtmlRadiosTest extends PHPUnit_Smarty
|
||||
{
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user