summaryrefslogtreecommitdiff
path: root/test/autoprepend.t
blob: 287bdff8495f55e35edb6edb03801d93b4dfb5bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/www/server/bin/php -qC
<?php

it_text::init();
$GLOBALS['it_text']->statictext = [
	'_' => ["de" => "Deutsch", "en" => "English"],
	'foo' => ["de" => "bar {v1}", "en" => "qux {v1}"],
];

is(
	T('foo'),
	"bar ",
	"simple T()"
);

is(
	T('foo', 'en'),
	"qux ",
	"simple T() with language"
);

is(
	T('foo', ['v1' => "gna<bber"]),
	"bar gna&lt;bber",
	"T() with quoted values"
);

is(
	T('foo', ['v1' => "gna<bber"], 'en'),
	"qux gna&lt;bber",
	"T() with with quoted values and language"
);

is(
	T('foo', 'en', ['v1' => "gna<bber"]),
	"qux gna&lt;bber",
	"T() with with language and quoted values"
);

$var = "foo";
$GLOBALS['debug_edplain'] = 1;
like(
	D($var),
	'\\$var=\'foo\'',
	"D of a variable"
);
like(
	D("bar"),
	'\'bar\'',
	"D of a string"
);

putenv("IT_ED_STDERR=0");

ob_start();
ED($var);
like(
	ob_get_clean(),
	'\\$var=\'foo\'',
	"ED of a variable"
);

ob_start();
ED("bar");
like(
	ob_get_clean(),
	'\'bar\'',
	"ED of a variable"
);