|
Lines 91-97
sub mock_objects {
Link Here
|
| 91 |
$schema->storage->txn_begin; |
91 |
$schema->storage->txn_begin; |
| 92 |
|
92 |
|
| 93 |
subtest ImportBreedingAuth => sub { |
93 |
subtest ImportBreedingAuth => sub { |
| 94 |
plan tests => 4; |
94 |
plan tests => 6; |
|
|
95 |
my $dbh = C4::Context->dbh; |
| 95 |
|
96 |
|
| 96 |
my $record = MARC::Record->new(); |
97 |
my $record = MARC::Record->new(); |
| 97 |
$record->append_fields( |
98 |
$record->append_fields( |
|
Lines 101-108
subtest ImportBreedingAuth => sub {
Link Here
|
| 101 |
|
102 |
|
| 102 |
my $breedingid = C4::Breeding::ImportBreedingAuth( $record, "kidclamp", "UTF-8", 'Jansson, Tove' ); |
103 |
my $breedingid = C4::Breeding::ImportBreedingAuth( $record, "kidclamp", "UTF-8", 'Jansson, Tove' ); |
| 103 |
ok( $breedingid, "We got a breeding id back" ); |
104 |
ok( $breedingid, "We got a breeding id back" ); |
|
|
105 |
|
| 104 |
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' ); |
| 105 |
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 |
# End Bug 19220 |
| 126 |
|
| 106 |
$breedingid_1 = C4::Breeding::ImportBreedingAuth( $record, "marcelr", "UTF-8", 'Jansson, Tove' ); |
127 |
$breedingid_1 = C4::Breeding::ImportBreedingAuth( $record, "marcelr", "UTF-8", 'Jansson, Tove' ); |
| 107 |
is( $breedingid, $breedingid_1, "For the same record in a different file, we get a new id" ); |
128 |
is( $breedingid, $breedingid_1, "For the same record in a different file, we get a new id" ); |
| 108 |
my $record_1 = MARC::Record->new(); |
129 |
my $record_1 = MARC::Record->new(); |
| 109 |
- |
|
|