From f4a30cc68bb633b6a990f87205f76728e27ae985 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Wed, 18 Sep 2013 17:21:47 +0000 Subject: [PATCH] Bug 10601: (follow-up) unit tests for new ->set() and ->get() This adds unit test for the new methods in C4::BackgroundJob. One of the tests verfies that setting extra values does not scribble over data that is mean to be internal to the C4::BackgroundJob object. To test: Verify that prove -v t/db_dependent/BackgroundJob.t passes. Signed-off-by: Galen Charlton --- t/db_dependent/BackgroundJob.t | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/BackgroundJob.t b/t/db_dependent/BackgroundJob.t index 0afa3158c0..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 => 11; +use Test::More tests => 14; BEGIN { use_ok('C4::BackgroundJob'); @@ -36,6 +36,12 @@ 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"); -- 2.39.2