SmartyConsistencyTest
extends CiviEndToEndTestCase
in package
Check that common syntax evaluates as expected on different versions of Smarty.
TIP: Every example is flagged as "PORTABLE" or "NOT PORTABLE". To get a summary,
run: grep PORTABLE tests/phpunit/E2E/Core/SmartyConsistencyTest.php
Tags
Table of Contents
Properties
- $smarty : array<string|int, RemoteTestFunction>
Methods
- setUpBeforeClass() : void
- testBlockParamFilters() : void
- testNonPortable() : mixed
- testPortable() : mixed
- testPurifyInteractions() : void
- testSpacing() : void
- check() : void
- Render a Smarty template across several versions. Compare results.
- checkInvalid() : void
- checkPortable() : void
- Render a smarty template across several versions. All versions should yield the same output.
- checkRegex() : void
- Render a Smarty template across several versions. Compare results.
- createSmartyRenderers() : array<string|int, mixed>
- render() : array<string|int, mixed>
- Render a Smarty template.
- setUp() : void
Properties
$smarty
protected
array<string|int, RemoteTestFunction>
$smarty
Methods
setUpBeforeClass()
public
static setUpBeforeClass() : void
testBlockParamFilters()
public
testBlockParamFilters() : void
testNonPortable()
public
testNonPortable() : mixed
testPortable()
public
testPortable() : mixed
testPurifyInteractions()
public
testPurifyInteractions() : void
testSpacing()
public
testSpacing() : void
check()
Render a Smarty template across several versions. Compare results.
protected
check(string $template, array<string|int, mixed> $vars, array<string|int, mixed> $versions) : void
Parameters
- $template : string
- $vars : array<string|int, mixed>
- $versions : array<string|int, mixed>
-
List of versions and their expected output. For ordinary/successful output, use
[string $expectedOutput]. For unusual output with expected warnings, use[string $expectedOutput, string $expectedWarningRegex]. Ex: [ '2_auto' => ['Hello world'] '3_auto' => ['Hello world'] '4_auto' => ['Hello world', '/Warning: foobar was deprecated in v4.5.6/'], ];
checkInvalid()
protected
checkInvalid(string $template, array<string|int, mixed> $vars[, string $expectRegex = '/EXCEPTION: Message was not parsed due to invalid smarty syntax/' ]) : void
Parameters
- $template : string
- $vars : array<string|int, mixed>
- $expectRegex : string = '/EXCEPTION: Message was not parsed due to invalid smarty syntax/'
checkPortable()
Render a smarty template across several versions. All versions should yield the same output.
protected
checkPortable(string $template, array<string|int, mixed> $vars, string $expect) : void
Parameters
- $template : string
- $vars : array<string|int, mixed>
- $expect : string
checkRegex()
Render a Smarty template across several versions. Compare results.
protected
checkRegex(string $template, array<string|int, mixed> $vars, array<string|int, mixed> $versions) : void
Parameters
- $template : string
- $vars : array<string|int, mixed>
- $versions : array<string|int, mixed>
-
List of versions and their expected output. For ordinary/successful output, use
[string $expectedOutput]. For unusual output with expected warnings, use[string $expectedOutput, string $expectedWarningRegex]. Ex: [ '2_auto' => ['Hello world'] '3_auto' => ['Hello world'] '4_auto' => ['Hello world', '/Warning: foobar was deprecated in v4.5.6/'], ];
createSmartyRenderers()
protected
createSmartyRenderers() : array<string|int, mixed>
Return values
array<string|int, mixed>render()
Render a Smarty template.
protected
render(string $version, string $template[, array<string|int, mixed> $vars = [] ]) : array<string|int, mixed>
Parameters
- $version : string
-
Smarty version/configuration to use.
- $template : string
-
The template we wish to evaluate.
- $vars : array<string|int, mixed> = []
-
Any Smarty variables to include.
Return values
array<string|int, mixed> —Tuple: [0 => string $rendered, 1 => string $warnings]
setUp()
protected
setUp() : void