Have Setting's get work like other gets by returning a hashref when
no param is requested.
This commit is contained in:
parent
8d61c288e7
commit
05d62c92b7
2 changed files with 15 additions and 5 deletions
|
|
@ -87,16 +87,25 @@ sub DESTROY {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 get ( )
|
||||
=head2 get ( $param )
|
||||
|
||||
Returns a hash reference containing all the settings.
|
||||
|
||||
=head3 $param
|
||||
|
||||
If $param is defined, then it will return only the setting for that param.
|
||||
|
||||
=cut
|
||||
|
||||
sub get {
|
||||
my $self = shift;
|
||||
my $param = shift;
|
||||
return $self->{_settings}{$param};
|
||||
my $self = shift;
|
||||
my $param = shift;
|
||||
if (defined $param) {
|
||||
return $self->{_settings}{$param};
|
||||
}
|
||||
else {
|
||||
return $self->{_settings};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ use lib "$FindBin::Bin/../lib";
|
|||
use WebGUI::Test;
|
||||
use WebGUI::Session;
|
||||
|
||||
use Test::More tests => 6; # increment this value for each test you create
|
||||
use Test::More tests => 7; # increment this value for each test you create
|
||||
|
||||
my $session = WebGUI::Test->session;
|
||||
|
||||
|
|
@ -32,3 +32,4 @@ my ($value) = $session->db->quickArray("select value from settings where name='i
|
|||
is($value, undef, "delete()");
|
||||
|
||||
isa_ok($session->setting->session, 'WebGUI::Session', 'session method returns a session object');
|
||||
isa_ok($session->setting->get, 'HASH', '->get with no parameters returns a hashref');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue