From 231c1b12e198753decfba9e1679a1d1a70f233ce Mon Sep 17 00:00:00 2001 From: Christian Schneider Date: Wed, 6 Apr 2011 13:41:32 +0000 Subject: Added support for localized fields with suffix, e.g. copy title_de to title on read --- tests/it_dbi.t | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'tests') 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" +); + -- cgit v1.2.3