Skip to content

Commit

Permalink
Test and fix for entries not having an object
Browse files Browse the repository at this point in the history
The 'object' attribute was set by the collapser, but not by the linker
on inflate.

Reported in #46374 by Jake Borevich
  • Loading branch information
nothingmuch committed May 26, 2009
1 parent 0f33669 commit b60fffb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/KiokuDB/Linker.pm
Expand Up @@ -211,6 +211,8 @@ sub inflate_data {

$$into = $obj;
}

$data->object($$into);
} elsif ( ref($data) eq 'HASH' ) {
my %targ;
$self->register_object( $entry => \%targ ) if $entry;
Expand Down
8 changes: 8 additions & 0 deletions lib/KiokuDB/Test/Fixture/Small.pm
Expand Up @@ -6,6 +6,8 @@ use Moose;
use Test::More;
use Test::Exception;

use Scalar::Util qw(refaddr);

use KiokuDB::Test::Person;
use KiokuDB::Test::Employee;
use KiokuDB::Test::Company;
Expand Down Expand Up @@ -84,6 +86,12 @@ sub verify {

isa_ok( $oscar, "KiokuDB::Test::Person" );

my $entry = $self->directory->live_objects->object_to_entry($joe);

ok( $entry->has_object, "entry is associated with object" );

is( refaddr($entry->object), refaddr($joe), "the right object" );

is( $joe->name, "joe", "name" );

ok( my $parents = $joe->parents, "parents" );
Expand Down

0 comments on commit b60fffb

Please sign in to comment.