Additional tests to cover WebGUI::Session::Scratch.
Found and fixed a but in Session/Scratch/deleteNameByValue. It would not delete any value that was false (0, '' or undef). Added a defined-ness check to make sure it will delete 0 or '', but undef is still not handled. Added POD to say that this was the case.
This commit is contained in:
parent
fc11dd64b2
commit
f5aaa2e996
2 changed files with 53 additions and 17 deletions
|
|
@ -112,7 +112,7 @@ The name of the scratch variable.
|
|||
|
||||
=head3 value
|
||||
|
||||
The value to match.
|
||||
The value to match. This can be anything except for undef.
|
||||
|
||||
=cut
|
||||
|
||||
|
|
@ -120,7 +120,7 @@ sub deleteNameByValue {
|
|||
my $self = shift;
|
||||
my $name = shift;
|
||||
my $value = shift;
|
||||
return undef unless ($name and $value);
|
||||
return undef unless ($name and defined $value);
|
||||
delete $self->{_data}{$name} if ($self->{_data}{$name} eq $value);
|
||||
$self->session->db->write("delete from userSessionScratch where name=? and value=?", [$name,$value]);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue