ILIAS
release_5-3 Revision v5.3.23-19-g915713cf615
◀ ilDoc Overview
TextTest.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
require_once __DIR__.
'/../../../../lib/Twig/Extensions/Extension/Text.php'
;
13
14
class
Twig_Tests_Extension_TextTest
extends
PHPUnit_Framework_TestCase
15
{
17
private
$env
;
18
19
public
function
setUp
()
20
{
21
$this->env = $this->getMockBuilder(
'Twig_Environment'
)->disableOriginalConstructor()->getMock();
22
$this->env
23
->expects($this->any())
24
->method(
'getCharset'
)
25
->will($this->returnValue(
'utf-8'
))
26
;
27
}
28
32
public
function
testTruncate
($input, $length, $preserve, $separator, $expectedOutput)
33
{
34
$output
= twig_truncate_filter($this->env, $input, $length, $preserve, $separator);
35
$this->assertEquals($expectedOutput,
$output
);
36
}
37
38
public
function
getTruncateTestData
()
39
{
40
return
array
(
41
array
(
'This is a very long sentence.'
, 2,
false
,
'...'
,
'Th...'
),
42
array
(
'This is a very long sentence.'
, 6,
false
,
'...'
,
'This i...'
),
43
array
(
'This is a very long sentence.'
, 2,
true
,
'...'
,
'This...'
),
44
array
(
'This is a very long sentence.'
, 2,
true
,
'[...]'
,
'This[...]'
),
45
array
(
'This is a very long sentence.'
, 23,
false
,
'...'
,
'This is a very long sen...'
),
46
array
(
'This is a very long sentence.'
, 23,
true
,
'...'
,
'This is a very long sentence.'
),
47
);
48
}
49
}
Twig_Tests_Extension_TextTest
Definition:
TextTest.php:14
PHPUnit_Framework_TestCase
Twig_Tests_Extension_TextTest\getTruncateTestData
getTruncateTestData()
Definition:
TextTest.php:38
$output
if(!is_dir( $entity_dir)) exit("Fatal Error ([A-Za-z0-9]+)\+" &#(? foreach( $entity_files as $file) $output
Definition:
generate-entity-file.php:67
Twig_Tests_Extension_TextTest\testTruncate
testTruncate($input, $length, $preserve, $separator, $expectedOutput)
getTruncateTestData
Definition:
TextTest.php:32
Twig_Tests_Extension_TextTest\$env
$env
Definition:
TextTest.php:17
array
Create styles array
The data for the language used.
Definition:
40duplicateStyle.php:19
Twig_Tests_Extension_TextTest\setUp
setUp()
Definition:
TextTest.php:19
libs
composer
vendor
twig
extensions
test
Twig
Tests
Extension
TextTest.php
Generated on Sat Mar 1 2025 19:01:12 for ILIAS by
1.8.13 (using
Doxyfile
)