ILIAS
release_5-4 Revision v5.4.26-12-gabc799a52e6
◀ ilDoc Overview
DeprecationCollectorTest.php
Go to the documentation of this file.
1
<?
php
2
3
/*
4
* This file is part of Twig.
5
*
6
* (c) Fabien Potencier
7
*
8
* For the full copyright and license information, please view the LICENSE
9
* file that was distributed with this source code.
10
*/
11
12
class
Twig_Tests_Util_DeprecationCollectorTest
extends
\PHPUnit\Framework\TestCase
13
{
17
public
function
testCollect
()
18
{
19
$twig =
new
Twig_Environment
($this->getMockBuilder(
'Twig_LoaderInterface'
)->getMock());
20
$twig->addFunction(
new
Twig_SimpleFunction
(
'deprec'
, array($this,
'deprec'
), array(
'deprecated'
=>
true
)));
21
22
$collector =
new
Twig_Util_DeprecationCollector
($twig);
23
$deprecations = $collector->collect(
new
Twig_Tests_Util_Iterator
());
24
25
$this->assertEquals(array(
'Twig Function "deprec" is deprecated in deprec.twig at line 1.'
), $deprecations);
26
}
27
28
public
function
deprec
()
29
{
30
}
31
}
32
33
class
Twig_Tests_Util_Iterator
implements
IteratorAggregate
34
{
35
public
function
getIterator
()
36
{
37
return
new
ArrayIterator
(array(
38
'ok.twig'
=>
'{{ foo }}'
,
39
'deprec.twig'
=>
'{{ deprec("foo") }}'
,
40
));
41
}
42
}
Twig_Tests_Util_Iterator
Definition:
DeprecationCollectorTest.php:33
Twig_Util_DeprecationCollector
Definition:
DeprecationCollector.php:17
Twig_SimpleFunction
Represents a template function.
Definition:
SimpleFunction.php:19
Twig_Tests_Util_Iterator\getIterator
getIterator()
Definition:
DeprecationCollectorTest.php:35
Twig_Tests_Util_DeprecationCollectorTest\testCollect
testCollect()
PHP 5.3
Definition:
DeprecationCollectorTest.php:17
IteratorAggregate
Twig_Tests_Util_DeprecationCollectorTest
Definition:
DeprecationCollectorTest.php:12
php
Twig_Environment
Stores the Twig configuration.
Definition:
Environment.php:17
ArrayIterator
Twig_Tests_Util_DeprecationCollectorTest\deprec
deprec()
Definition:
DeprecationCollectorTest.php:28
libs
composer
vendor
twig
twig
test
Twig
Tests
Util
DeprecationCollectorTest.php
Generated on Thu Jan 30 2025 19:01:35 for ILIAS by
1.8.13 (using
Doxyfile
)