summaryrefslogtreecommitdiff
path: root/test/it_text.t
diff options
context:
space:
mode:
authorUrban Müller2018-06-21 16:42:32 +0200
committerUrban Müller2018-06-21 16:43:32 +0200
commit3dabbbd5325c9fad9582cd44b1da68dece78eaa0 (patch)
tree92d951b948f0e01dc6b7ae3f11b9c03034edb69a /test/it_text.t
parent455b15f7a850a58ef667ad170732769043eb1522 (diff)
downloaditools-3dabbbd5325c9fad9582cd44b1da68dece78eaa0.tar.gz
itools-3dabbbd5325c9fad9582cd44b1da68dece78eaa0.tar.bz2
itools-3dabbbd5325c9fad9582cd44b1da68dece78eaa0.zip
no reason for different naming
Diffstat (limited to 'test/it_text.t')
-rwxr-xr-xtest/it_text.t21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/it_text.t b/test/it_text.t
new file mode 100755
index 0000000..5629d51
--- /dev/null
+++ b/test/it_text.t
@@ -0,0 +1,21 @@
+#!/www/server/bin/php
+<?php
+
+$obj->x = "attr";
+$obj->y->z = "attr";
+
+is(it_text::transmogrify(""), "");
+is(it_text::transmogrify("foo"), "foo");
+is(it_text::transmogrify("{foo}"), "");
+is(it_text::transmogrify("{foo}", array('foo' => 1)), "1");
+is(it_text::transmogrify("{foo}{foo}", array('foo' => 1)), "11");
+is(it_text::transmogrify("{foo}X", array('foo' => 1)), "1X");
+is(it_text::transmogrify("{foo}X{foo}", array('foo' => 1)), "1X1");
+is(it_text::transmogrify("X{foo}", array('foo' => 1)), "X1");
+is(it_text::transmogrify("X{foo}{bar}", array('foo' => 1, 'bar' => 2)), "X12");
+is(it_text::transmogrify("X{foo}", array('foo' => "&")), "X&");
+is(it_text::transmogrify("X{x}", $obj), "Xattr");
+is(it_text::transmogrify("X{y.z}", $obj), "Xattr");
+is(it_text::transmogrify("{mb_strlen(xxx)}", null, null, ['mb_strlen' => 1]), "3");
+is(it_text::transmogrify("{it::ucfirst(xxx)}", null, null, ['it::ucfirst' => 1]), "Xxx");
+is(it_text::transmogrify("{format violation}"), '{format violation}');