Merge remote-tracking branch 'origin/new/bug_929'
[koha.git] / t / db_dependent / BackgroundJob.t
1 #!/usr/bin/perl
2 #
3 # This Koha test module is a stub!  
4 # Add more tests here!!!
5
6 use strict;
7 use warnings;
8 use C4::Auth;
9 use CGI;
10 use Test::More tests => 11;
11
12 BEGIN {
13         use_ok('C4::BackgroundJob');
14 }
15 my $query = new CGI;
16 my ($userid, $cookie, $sessionID) = &checkauth($query, 1);
17 #my ($sessionID, $job_name, $job_invoker, $num_work_units) = @_;
18 my $background;
19 diag $sessionID;
20 ok ($background=C4::BackgroundJob->new($sessionID), "making job");
21 ok ($background->id, "fetching id number");
22
23 $background->name("George");
24 is ($background->name, "George", "testing name");
25
26 $background->invoker("enjoys");
27 is ($background->invoker, "enjoys", "testing invoker");
28
29 $background->progress("testing");
30 is ($background->progress, "testing", "testing progress");
31
32 ok ($background->status, "testing status");
33
34 $background->size("56");
35 is ($background->size, "56", "testing size");
36
37 ok (!$background->fetch($sessionID, $background->id), "testing fetch");
38
39
40 $background->finish("finished");
41 is ($background->status,'completed', "testing finished");
42
43 ok ($background->results); #Will return undef unless finished