Add tests for most other wobjects. Block broken code in Role/Asset/Comments. Refactor run_asset.t

This commit is contained in:
Colin Kuskie 2010-03-12 08:41:04 -08:00
parent e0e71a5925
commit 8209de7978
23 changed files with 648 additions and 78 deletions

View file

@ -187,23 +187,23 @@ sub deleteComment {
}
}
#-------------------------------------------------------------------
=head2 get ()
See SUPER::get(). Extends the get() method to automatically decode the comments field into a Perl hash structure.
=cut
sub get {
my $self = shift;
my $param = shift;
if ($param eq 'comments') {
return JSON->new->decode($self->next::method('comments')||'[]');
}
return $self->next::method($param, @_);
}
##-------------------------------------------------------------------
#
#=head2 get ()
#
#See SUPER::get(). Extends the get() method to automatically decode the comments field into a Perl hash structure.
#
#=cut
#
#sub get {
# my $self = shift;
# my $param = shift;
# if ($param eq 'comments') {
# return JSON->new->decode($self->next::method('comments')||'[]');
# }
# return $self->next::method($param, @_);
#}
#
#-------------------------------------------------------------------
=head2 getAverageCommentRatingIcon ()
@ -279,30 +279,30 @@ sub getKarmaAmountPerComment {
}
#-------------------------------------------------------------------
=head2 update ()
See SUPER::update(). Extends the update() method to encode the comments field into something storable in the database.
=cut
sub update {
my $self = shift;
my $properties = shift;
if (exists $properties->{comments}) {
my $comments = $properties->{comments};
if (ref $comments ne 'ARRAY') {
$comments = eval{JSON->new->decode($comments)};
if (WebGUI::Error->caught || ref $comments ne 'ARRAY') {
$comments = [];
}
}
$properties->{comments} = JSON->new->encode($comments);
}
$self->next::method($properties, @_);
}
##-------------------------------------------------------------------
#
#=head2 update ()
#
#See SUPER::update(). Extends the update() method to encode the comments field into something storable in the database.
#
#=cut
#
#sub update {
# my $self = shift;
# my $properties = shift;
# if (exists $properties->{comments}) {
# my $comments = $properties->{comments};
# if (ref $comments ne 'ARRAY') {
# $comments = eval{JSON->new->decode($comments)};
# if (WebGUI::Error->caught || ref $comments ne 'ARRAY') {
# $comments = [];
# }
# }
# $properties->{comments} = JSON->new->encode($comments);
# }
# $self->next::method($properties, @_);
#}
#
#-------------------------------------------------------------------
=head2 www_addComment ()