summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rwxr-xr-xtests/it_dbi.t29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/it_dbi.t b/tests/it_dbi.t
index 3ee2562..c885930 100755
--- a/tests/it_dbi.t
+++ b/tests/it_dbi.t
@@ -215,3 +215,32 @@ $count = 0;
foreach ($record as $dummy_rec)
$count++;
is($count, 2, "Iterator reused");
+
+# Test field localization feature
+
+$dbi->query('create temporary table it_dbi_testlocalized (
+ ID int not null auto_increment,
+ foobar_de varchar(42),
+ foobar_fr varchar(42),
+ primary key(ID)
+);');
+
+$record = new it_dbi($db + array('table' => "it_dbi_testlocalized"));
+$record->insert(array('foobar_de' => "deutsch", 'foobar_fr' => "franz"));
+
+T_set_language('de');
+$record->read(1);
+is(
+ array($record->_key, $record->foobar),
+ array(1, "deutsch"),
+ "localized field foobar_de"
+);
+
+T_set_language('fr');
+$record->read(1);
+is(
+ array($record->_key, $record->foobar),
+ array(1, "franz"),
+ "localized field foobar_fr"
+);
+