1 package KohaTest::ImportBatch::GetImportRecordMarc;
2 use base qw( KohaTest::ImportBatch );
14 =head3 record_does_not_exist
18 sub record_does_not_exist : Test( 1 ) {
21 my $id = '999999999999';
22 my $marc = GetImportRecordMarc( $id );
23 ok( ! defined( $marc ), 'this marc is undefined' );
27 sub record_does_exist : Test( 4 ) {
30 # we need an import_batch, so let GetZ3950BatchId create one:
31 my $new_batch_id = GetZ3950BatchId('foo');
32 ok( $new_batch_id, "got a new batch ID: $new_batch_id" );
34 my $sth = C4::Context->dbh->prepare(
35 "INSERT INTO import_records (import_batch_id, marc, marcxml)
38 my $execute = $sth->execute(
39 $new_batch_id, # batch_id
43 ok( $execute, 'succesfully executed' );
44 my $import_record_id = C4::Context->dbh->{'mysql_insertid'};
45 ok( $import_record_id, 'we got an import_record_id' );
47 my $marc = GetImportRecordMarc($import_record_id);
48 ok( defined($marc), 'this marc is defined' );