X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=t%2Fdb_dependent%2FBackgroundJob.t;h=668e1ca4f102e50d552a73097b8c9774419dcf21;hb=05bb6f4f37bfbd6c29cbaa7fe1fe9ccf667fca98;hp=8106e02523fbe4e321f545c7a0fcb938f7d356ef;hpb=2202ee78c3abf41aa46d131036b1a4162c8faf35;p=koha.git diff --git a/t/db_dependent/BackgroundJob.t b/t/db_dependent/BackgroundJob.t index 8106e02523..668e1ca4f1 100644 --- a/t/db_dependent/BackgroundJob.t +++ b/t/db_dependent/BackgroundJob.t @@ -7,7 +7,7 @@ use strict; use warnings; use C4::Auth; use CGI; -use Test::More tests => 10; +use Test::More tests => 14; BEGIN { use_ok('C4::BackgroundJob'); @@ -17,8 +17,8 @@ my ($userid, $cookie, $sessionID) = &checkauth($query, 1); #my ($sessionID, $job_name, $job_invoker, $num_work_units) = @_; my $background; diag $sessionID; -ok ($background=C4::BackgroundJob->new($sessionID)); -ok ($background->id); +ok ($background=C4::BackgroundJob->new($sessionID), "making job"); +ok ($background->id, "fetching id number"); $background->name("George"); is ($background->name, "George", "testing name"); @@ -29,12 +29,21 @@ is ($background->invoker, "enjoys", "testing invoker"); $background->progress("testing"); is ($background->progress, "testing", "testing progress"); -ok ($background->status); +ok ($background->status, "testing status"); $background->size("56"); is ($background->size, "56", "testing size"); +ok (!$background->fetch($sessionID, $background->id), "testing fetch"); + +$background->set({ key1 => 'value1', key2 => 'value2' }); +is ($background->get('key1'), 'value1', 'fetched extra value for key key1'); +is ($background->get('key2'), 'value2', 'fetched extra value for key key2'); + +$background->set({ size => 666 }); +is ($background->size, "56", '->set() does not scribble over private object data'); + $background->finish("finished"); is ($background->status,'completed', "testing finished"); -ok ($background->results); # Will return undef unless finished \ No newline at end of file +ok ($background->results); #Will return undef unless finished