Skip to content
Snippets Groups Projects
Commit b6496eb3 authored by Roy Storey's avatar Roy Storey
Browse files

symmetric operation for remove/store wrt internal caches etc... with tests - updated

parent dbd5c058
No related branches found
No related tags found
2 merge requests!353Improve symmetry of store / remove in CoordSystemAdaptor,!353Improve symmetry of store / remove in CoordSystemAdaptor
......@@ -1284,6 +1284,10 @@ sub remove {
delete $self->{'_dbID_cache'}->{$dbID};
delete $self->{'_rank_cache'}->{$rank};
delete $self->{'_is_sequence_level'}->{$dbID};
delete $self->{'_is_default_version'}->{$dbID};
$cs->dbID(undef);
$cs->adaptor(undef);
return $cs;
}
......
......@@ -225,6 +225,18 @@ is_deeply(
'Retrieval by name should return the same as version for NCBI33');
is_deeply($csa->fetch_all_by_version('thisdoesnotexist'), [], 'Bogus coordinate system results in no results');
#
# Test remove() and store() sequence level
#
$cs = $csa->fetch_sequence_level();
ok($cs, 'There is a sequence level coord system - fetched ok');
ok($cs->is_default, 'sequence level is the default coord system');
my $old_dbID = $cs->dbID;
is($csa->remove($cs), $cs, 'Adaptor remove() returns the same coordinate system object');
is_deeply($csa->{_is_sequence_level}, {}, 'Adaptor sequence_level cache updated to reflect the removal');
is($csa->{_is_default_version}{$old_dbID}, undef, 'Adaptor default_version cache updated to reflect removal');
lives_ok { $csa->store($cs); }, 'Adaptor store() successful. Coordinate system did not have dbID() or adaptor()';
$multi->restore('core', 'coord_system');
$multi->restore('core', 'meta');
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment