check the logging for duping a singleton

This commit is contained in:
Colin Kuskie 2008-09-12 23:23:52 +00:00
parent 119e5d9645
commit d43d06ea1a

View file

@ -42,7 +42,7 @@ my $session = WebGUI::Test->session;
#----------------------------------------------------------------------------
# Tests
plan tests => 11; # Increment this number for each test you create
plan tests => 12; # Increment this number for each test you create
#----------------------------------------------------------------------------
# put your tests here
@ -80,9 +80,13 @@ cmp_ok(abs ($instance->get('lastUpdate')-$dateUpdated), '<=', 3, 'Date updated f
my $otherInstance = WebGUI::Workflow::Instance->create($session, $properties);
is ($otherInstance, undef, 'create: only allows one instance of a singleton to be created');
WebGUI::Test->interceptLogging;
$instance->set({ 'parameters' => {session => 1}, });
$otherInstance = WebGUI::Workflow::Instance->create($session, {workflowId => $wf->getId, parameters => { session => 1,} });
is($otherInstance, undef, 'create: another singleton instance can not be created if it the same parameters as a currently existing instance');
like($WebGUI::Test::logger_info, qr/An instance of singleton workflow \w{22} already exists/, 'create: Warning logged for trying to make another singleton');
$otherInstance = WebGUI::Workflow::Instance->create($session, {workflowId => $wf->getId, parameters => { session => 2,}});
isnt ($otherInstance, undef, 'create: another singleton instance can be created if it has different parameters');
$otherInstance->delete;