diff --git a/modules/Bio/EnsEMBL/DBSQL/AnalysisAdaptor.pm b/modules/Bio/EnsEMBL/DBSQL/AnalysisAdaptor.pm index 4b5ff2a74c78dd587e8f808853f44613ad4c956a..d35d47dfe7e154a15b43e485b7e3d47685697a91 100755 --- a/modules/Bio/EnsEMBL/DBSQL/AnalysisAdaptor.pm +++ b/modules/Bio/EnsEMBL/DBSQL/AnalysisAdaptor.pm @@ -67,6 +67,7 @@ use strict; use Data::Dumper; $Data::Dumper::Terse = 1; +$Data::Dumper::Indent = 0; @ISA = qw( Bio::EnsEMBL::DBSQL::BaseAdaptor); diff --git a/modules/t/analysis.t b/modules/t/analysis.t index 94e68200f43191f584b05ab0e23406aa3924b557..2e0a093a756242fa6c344f5aca133056cce97cea 100644 --- a/modules/t/analysis.t +++ b/modules/t/analysis.t @@ -64,6 +64,9 @@ $analysis_ad->store($analysis); ok(defined $analysis->dbID() ); +# Check that web_data is stored without newlines +unlike(retrieve_web_data($db, $analysis->dbID), '/\n/', "No newlines in stored web_data"); + # Need to explicitly delete cache, otherwise we just return that, # and don't actually extract the data from the table and truly verify storage. $analysis_ad->{_logic_name_cache} = {}; @@ -89,7 +92,7 @@ $analysis->logic_name("new_dummy"); $analysis->description("new description"); $analysis->display_label("new label"); $analysis->displayable(0); -$analysis->web_data("blahblah"); +$analysis->web_data({thing => 'blahblah'}); my $dbID = $analysis->dbID(); $analysis_ad->update($analysis); my $analysis_updated = $analysis_ad->fetch_by_dbID($dbID); @@ -97,7 +100,10 @@ is($analysis_updated->logic_name(), "new_dummy", "Logic name is correct"); is($analysis_updated->description(), "new description", "Description is correct"); is($analysis_updated->display_label(), "new label", "Label is correct"); is($analysis_updated->displayable(), 0, "Displayable is correct"); -is($analysis_updated->web_data(), "blahblah", "web_data is correct"); +is($analysis_updated->web_data->{thing}, "blahblah", "web_data is correct"); + +# Check that web_data is stored without newlines +unlike(retrieve_web_data($db, $dbID), '/\n/', "No newlines in updated web_data"); # now try updating analysis that has no existing description $analysis = Bio::EnsEMBL::Analysis->new(); @@ -136,4 +142,12 @@ sub check_methods { return $all_implemented; } +sub retrieve_web_data { + my ($db, $dbID) = @_; + + my $sql_helper = $db->dbc->sql_helper; + my $sql = "SELECT web_data FROM analysis_description WHERE analysis_id = $dbID"; + return $sql_helper->execute_single_result(-SQL => $sql); +} + done_testing();