1 package KohaTest::ImportBatch::GetZ3950BatchId;
2 use base qw( KohaTest::ImportBatch );
14 =head3 batch_does_not_exist
18 sub batch_does_not_exist : Test( 5 ) {
21 my $file_name = 'testing batch';
23 # lets make sure it doesn't exist first
24 my $sth = C4::Context->dbh->prepare('SELECT import_batch_id FROM import_batches
27 ok( $sth->execute( 'z3950', $file_name, ), 'execute' );
28 my $rowref = $sth->fetchrow_arrayref();
29 ok( !defined( $rowref ), 'this batch does not exist' );
31 # now let GetZ3950BatchId create one
32 my $new_batch_id = GetZ3950BatchId( $file_name );
33 ok( $new_batch_id, "got a new batch ID: $new_batch_id" );
35 # now search for the one that was just created
36 my $second_batch_id = GetZ3950BatchId( $file_name );
37 ok( $second_batch_id, "got a second batch ID: $second_batch_id" );
38 is( $second_batch_id, $new_batch_id, 'we got the same batch both times.' );