View | Details | Raw Unified | Return to bug 28604
Collapse All | Expand All

(-)a/t/db_dependent/api/v1/biblios.t (-3 / +49 lines)
Lines 17-22 Link Here
17
17
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use utf8;
21
use Encode;
22
20
use Test::More tests => 5;
23
use Test::More tests => 5;
21
use Test::MockModule;
24
use Test::MockModule;
22
use Test::Mojo;
25
use Test::Mojo;
Lines 38-44 my $t = Test::Mojo->new('Koha::REST::V1'); Link Here
38
41
39
subtest 'get() tests' => sub {
42
subtest 'get() tests' => sub {
40
43
41
    plan tests => 21;
44
    plan tests => 22;
42
45
43
    $schema->storage->txn_begin;
46
    $schema->storage->txn_begin;
44
47
Lines 100-105 subtest 'get() tests' => sub { Link Here
100
      ->status_is(404)
103
      ->status_is(404)
101
      ->json_is( '/error', 'Object not found.' );
104
      ->json_is( '/error', 'Object not found.' );
102
105
106
    subtest 'marc-in-json encoding tests' => sub {
107
108
        plan tests => 3;
109
110
        my $title_with_diacritics = "L'insoutenable légèreté de l'être";
111
112
        my $biblio = $builder->build_sample_biblio(
113
            {
114
                title  => $title_with_diacritics,
115
                author => "Milan Kundera"
116
            }
117
        );
118
119
        my $result = $t->get_ok( "//$userid:$password@/api/v1/biblios/" . $biblio->biblionumber
120
                    => { Accept => 'application/marc-in-json' } )
121
          ->status_is(200)->tx->res->body;
122
123
        my $encoded_title  = Encode::encode( "UTF-8", $title_with_diacritics );
124
125
        like( $result, qr/\Q$encoded_title/, "The title is not double encoded" );
126
    };
127
103
    $schema->storage->txn_rollback;
128
    $schema->storage->txn_rollback;
104
};
129
};
105
130
Lines 194-200 subtest 'delete() tests' => sub { Link Here
194
219
195
subtest 'get_public() tests' => sub {
220
subtest 'get_public() tests' => sub {
196
221
197
    plan tests => 25;
222
    plan tests => 26;
198
223
199
    $schema->storage->txn_begin;
224
    $schema->storage->txn_begin;
200
225
Lines 277-282 subtest 'get_public() tests' => sub { Link Here
277
        ->content_is($biblio->metadata->record->as_formatted);
302
        ->content_is($biblio->metadata->record->as_formatted);
278
    };
303
    };
279
304
305
    subtest 'marc-in-json encoding tests' => sub {
306
307
        plan tests => 3;
308
309
        my $title_with_diacritics = "L'insoutenable légèreté de l'être";
310
311
        my $biblio = $builder->build_sample_biblio(
312
            {
313
                title  => $title_with_diacritics,
314
                author => "Milan Kundera"
315
            }
316
        );
317
318
        my $result = $t->get_ok( "/api/v1/public/biblios/" . $biblio->biblionumber
319
                    => { Accept => 'application/marc-in-json' } )
320
          ->status_is(200)->tx->res->body;
321
322
        my $encoded_title  = Encode::encode( "UTF-8", $title_with_diacritics );
323
324
        like( $result, qr/\Q$encoded_title/, "The title is not double encoded" );
325
    };
326
280
    # Hide author in OPAC
327
    # Hide author in OPAC
281
    $subfields = Koha::MarcSubfieldStructures->search({ tagfield => '100' });
328
    $subfields = Koha::MarcSubfieldStructures->search({ tagfield => '100' });
282
    while ( my $subfield = $subfields->next ) {
329
    while ( my $subfield = $subfields->next ) {
283
- 

Return to bug 28604