3 # This Koha test module is a stub!
4 # Add more tests here!!!
10 use Test::More tests => 14;
13 use_ok('C4::BackgroundJob');
16 my ($userid, $cookie, $sessionID) = &checkauth($query, 1);
17 #my ($sessionID, $job_name, $job_invoker, $num_work_units) = @_;
20 ok ($background=C4::BackgroundJob->new($sessionID), "making job");
21 ok ($background->id, "fetching id number");
23 $background->name("George");
24 is ($background->name, "George", "testing name");
26 $background->invoker("enjoys");
27 is ($background->invoker, "enjoys", "testing invoker");
29 $background->progress("testing");
30 is ($background->progress, "testing", "testing progress");
32 ok ($background->status, "testing status");
34 $background->size("56");
35 is ($background->size, "56", "testing size");
37 ok (!$background->fetch($sessionID, $background->id), "testing fetch");
39 $background->set({ key1 => 'value1', key2 => 'value2' });
40 is ($background->get('key1'), 'value1', 'fetched extra value for key key1');
41 is ($background->get('key2'), 'value2', 'fetched extra value for key key2');
43 $background->set({ size => 666 });
44 is ($background->size, "56", '->set() does not scribble over private object data');
46 $background->finish("finished");
47 is ($background->status,'completed', "testing finished");
49 ok ($background->results); #Will return undef unless finished