Lines 22-29
Link Here
|
22 |
use Modern::Perl; |
22 |
use Modern::Perl; |
23 |
use utf8; |
23 |
use utf8; |
24 |
|
24 |
|
25 |
use Test::NoWarnings; |
25 |
use Test::More tests => 2; |
26 |
use Test::More tests => 3; |
|
|
27 |
use Test::MockModule; |
26 |
use Test::MockModule; |
28 |
use Test::MockObject; |
27 |
use Test::MockObject; |
29 |
use Test::Warn; |
28 |
use Test::Warn; |
Lines 92-98
sub mock_objects {
Link Here
|
92 |
$schema->storage->txn_begin; |
91 |
$schema->storage->txn_begin; |
93 |
|
92 |
|
94 |
subtest ImportBreedingAuth => sub { |
93 |
subtest ImportBreedingAuth => sub { |
95 |
plan tests => 4; |
94 |
plan tests => 6; |
|
|
95 |
my $dbh = C4::Context->dbh; |
96 |
|
96 |
|
97 |
my $record = MARC::Record->new(); |
97 |
my $record = MARC::Record->new(); |
98 |
$record->append_fields( |
98 |
$record->append_fields( |
Lines 102-109
subtest ImportBreedingAuth => sub {
Link Here
|
102 |
|
102 |
|
103 |
my $breedingid = C4::Breeding::ImportBreedingAuth( $record, "kidclamp", "UTF-8", 'Jansson, Tove' ); |
103 |
my $breedingid = C4::Breeding::ImportBreedingAuth( $record, "kidclamp", "UTF-8", 'Jansson, Tove' ); |
104 |
ok( $breedingid, "We got a breeding id back" ); |
104 |
ok( $breedingid, "We got a breeding id back" ); |
|
|
105 |
|
105 |
my $breedingid_1 = C4::Breeding::ImportBreedingAuth( $record, "kidclamp", "UTF-8", 'Jansson, Tove' ); |
106 |
my $breedingid_1 = C4::Breeding::ImportBreedingAuth( $record, "kidclamp", "UTF-8", 'Jansson, Tove' ); |
106 |
is( $breedingid, $breedingid_1, "For the same record, we get the same id" ); |
107 |
is( $breedingid, $breedingid_1, "For the same record, we get the same id" ); |
|
|
108 |
|
109 |
# Bug 19220: In case of XSLT transformation, we make sure to have the new version of the record |
110 |
$record->append_fields( |
111 |
MARC::Field->new( '999', ' ', ' ', a => 'Added field' ), |
112 |
); |
113 |
|
114 |
$breedingid_1 = C4::Breeding::ImportBreedingAuth( $record, "kidclamp", "UTF-8", 'Jansson, Tove' ); |
115 |
is( $breedingid, $breedingid_1, "For the same record, modified, we get the same id" ); |
116 |
|
117 |
my $sth = $dbh->prepare('SELECT * FROM import_records WHERE import_record_id = ?'); |
118 |
$sth->execute($breedingid); |
119 |
my $imported_records_record = $sth->fetchrow_hashref(); |
120 |
my $imported_record = MARC::Record::new_from_xml( $imported_records_record->{marcxml} ); |
121 |
is( |
122 |
$imported_record->subfield( '999', 'a' ), $record->subfield( '999', 'a' ), |
123 |
'We also get the new the version of the record' |
124 |
); |
125 |
|
126 |
# End Bug 19220 |
127 |
|
107 |
$breedingid_1 = C4::Breeding::ImportBreedingAuth( $record, "marcelr", "UTF-8", 'Jansson, Tove' ); |
128 |
$breedingid_1 = C4::Breeding::ImportBreedingAuth( $record, "marcelr", "UTF-8", 'Jansson, Tove' ); |
108 |
is( $breedingid, $breedingid_1, "For the same record in a different file, we get a new id" ); |
129 |
is( $breedingid, $breedingid_1, "For the same record in a different file, we get a new id" ); |
109 |
my $record_1 = MARC::Record->new(); |
130 |
my $record_1 = MARC::Record->new(); |
110 |
- |
|
|