Lines 16-22
Link Here
|
16 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
16 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
17 |
|
17 |
|
18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
19 |
use Test::More tests => 10; |
19 |
use Test::More tests => 11; |
20 |
use Test::MockModule; |
20 |
use Test::MockModule; |
21 |
use Data::Dumper qw( Dumper ); |
21 |
use Data::Dumper qw( Dumper ); |
22 |
use utf8; |
22 |
use utf8; |
Lines 456-458
sub setup_mss {
Link Here
|
456 |
} |
456 |
} |
457 |
)->update( { display_order => \['FLOOR( 1 + RAND( ) * 10 )'] } ); |
457 |
)->update( { display_order => \['FLOOR( 1 + RAND( ) * 10 )'] } ); |
458 |
} |
458 |
} |
459 |
- |
459 |
|
|
|
460 |
subtest 'replacementprice handling' => sub { |
461 |
plan tests => 3; |
462 |
|
463 |
my $subfield = { |
464 |
kohafield => 'items.replacementprice', |
465 |
id => 'tag_952_subfield_v_12345', |
466 |
value => '123.45', |
467 |
}; |
468 |
|
469 |
my $expected_marc_value = { |
470 |
type => 'replacementprice', |
471 |
id => 'tag_952_subfield_v_12345', |
472 |
value => '123.45', |
473 |
}; |
474 |
|
475 |
my $item = Koha::Item->new(); |
476 |
|
477 |
my %subfield_data; |
478 |
if ( $subfield->{kohafield} =~ /items\.(replacementprice)/ ) { |
479 |
$subfield_data{marc_value} = { |
480 |
type => 'replacementprice', |
481 |
id => $subfield->{id}, |
482 |
value => $subfield->{value}, |
483 |
}; |
484 |
} |
485 |
|
486 |
ok( |
487 |
exists $subfield_data{marc_value}, |
488 |
"Subfield data contains 'marc_value' key" |
489 |
); |
490 |
|
491 |
is( |
492 |
$subfield_data{marc_value}->{type}, |
493 |
$expected_marc_value->{type}, |
494 |
"Subfield 'type' is correctly set to 'replacementprice'" |
495 |
); |
496 |
|
497 |
is_deeply( |
498 |
$subfield_data{marc_value}, |
499 |
$expected_marc_value, |
500 |
'Subfield data is processed correctly for replacementprice' |
501 |
); |
502 |
}; |