|
Lines 1-10
Link Here
|
| 1 |
#!/usr/bin/perl |
1 |
#!/usr/bin/perl |
| 2 |
# |
2 |
# |
| 3 |
|
3 |
|
| 4 |
use strict; |
4 |
use Modern::Perl; |
| 5 |
use warnings; |
5 |
use utf8; |
| 6 |
|
6 |
|
| 7 |
use Test::More tests => 9; |
7 |
use Test::More tests => 10; |
| 8 |
|
8 |
|
| 9 |
BEGIN { |
9 |
BEGIN { |
| 10 |
use_ok('Koha::Database'); |
10 |
use_ok('Koha::Database'); |
|
Lines 25-27
ok( $new_schema = $database->new_schema(), 'Try to get a new schema' );
Link Here
|
| 25 |
ok( $database->set_schema($new_schema), 'Switch to new schema' ); |
25 |
ok( $database->set_schema($new_schema), 'Switch to new schema' ); |
| 26 |
ok( $database->restore_schema(), 'Switch back' ); |
26 |
ok( $database->restore_schema(), 'Switch back' ); |
| 27 |
|
27 |
|
| 28 |
- |
28 |
# run in a transaction |
|
|
29 |
$schema->storage->txn_begin(); |
| 30 |
|
| 31 |
# clear the way |
| 32 |
$schema->resultset('Category')->search({ categorycode => 'GIFT-RUS' })->delete; |
| 33 |
my $gift = 'подарок'; |
| 34 |
$schema->resultset('Category')->create({ |
| 35 |
categorycode => 'GIFT-RUS', |
| 36 |
description => $gift, |
| 37 |
}); |
| 38 |
my $desc = $schema->resultset('Category')->search({ |
| 39 |
categorycode => 'GIFT-RUS', |
| 40 |
})->single->get_column('description'); |
| 41 |
is($desc, $gift, 'stored and retrieved UTF8 string'); |
| 42 |
$schema->storage->txn_rollback(); |
| 43 |
|