Test fix.
[blog.pm-common-perl-mods.git] / Rose-DB-Object-I18N / t / available-translations.t
blobf5a47906dcd2199e8991da4392d44b80d0ea25a5
1 #! /usr/bin/perl
3 use strict;
4 use warnings;
6 use Test::More 'tests' => 4;
8 use lib 't/lib';
10 use NewDB;
11 use User;
12 use User::Manager;
14 my $db = NewDB->new();
16 $db->init();
18 my $u = User->new(
19 name => 'oooo',
20 orig_lang => 'ru',
21 signature => 'hello'
23 $u->save();
25 $u = User->new( id => $u->id );
26 $u->load();
28 $u->load_i18n();
29 is_deeply( $u->available_translations, [] );
31 $u->load_i18n( language => 'en' );
32 $u->i18n->signature( 'hello2' );
33 $u->save( );
34 $u->load_i18n();
35 is_deeply( $u->available_translations, [ 'en' ] );
37 $u->load_i18n( language => 'ru' );
38 is_deeply( $u->available_translations, [ 'en' ] );
40 $u->load_i18n( language => 'ua' );
41 is_deeply( $u->available_translations, [ 'en' ] );
43 $u->delete( cascade => 1 );