/usr/share/perl5/KiokuDB/Test/Fixture/Small.pm is in libkiokudb-perl 0.56-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | package KiokuDB::Test::Fixture::Small;
BEGIN {
$KiokuDB::Test::Fixture::Small::AUTHORITY = 'cpan:NUFFIN';
}
{
$KiokuDB::Test::Fixture::Small::VERSION = '0.56';
}
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;
sub p;
use namespace::clean -except => 'meta';
sub p {
my @args = @_;
unshift @args, "name" if @args % 2;
KiokuDB::Test::Person->new(@args);
}
with qw(KiokuDB::Test::Fixture) => { -excludes => [qw/populate sort/] };
sub sort { -100 }
has [qw(joe oscar)] => (
isa => "Str",
is => "rw",
);
sub create {
return (
KiokuDB::Test::Employee->new(
name => "joe",
age => 52,
parents => [ KiokuDB::Test::Person->new(
name => "mum",
age => 78,
) ],
company => KiokuDB::Test::Company->new(
name => "OHSOME SOFTWARE KTHX"
),
),
KiokuDB::Test::Person->new(
name => "oscar",
age => 3,
),
);
}
sub populate {
my $self = shift;
{
my $s = $self->new_scope;
my ( $joe, $oscar ) = $self->create;
isa_ok( $joe, "KiokuDB::Test::Person" );
isa_ok( $joe, "KiokuDB::Test::Employee" );
isa_ok( $oscar, "KiokuDB::Test::Person" );
my ( $joe_id, $oscar_id ) = $self->store_ok($joe, $oscar);
$self->joe($joe_id);
$self->oscar($oscar_id);
$self->live_objects_are($joe, $joe->company, @{ $joe->parents }, $oscar);
}
$self->no_live_objects;
}
sub verify {
my $self = shift;
$self->txn_lives(sub {
my ( $joe, $oscar ) = my @objs = $self->lookup_ok( $self->joe, $self->oscar );
isa_ok( $joe, "KiokuDB::Test::Person" );
isa_ok( $joe, "KiokuDB::Test::Employee" );
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" );
is( ref($parents), "ARRAY", "array ref" );
is( scalar(@$parents), 1, "one parent" );
isa_ok( $parents->[0], "KiokuDB::Test::Person" );
is( $parents->[0]->name, "mum", "parent name" );
ok( my $company = $joe->company, "company" );
isa_ok( $company, "KiokuDB::Test::Company" );
is( $oscar->name, "oscar", "name" );
lives_ok { $self->directory->lookup("no_such_id") } "lookup of nonexistent ID is nonfatal";
});
}
__PACKAGE__
__END__
=pod
=head1 NAME
KiokuDB::Test::Fixture::Small
=head1 VERSION
version 0.56
=head1 AUTHOR
Yuval Kogman <nothingmuch@woobling.org>
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2013 by Yuval Kogman, Infinity Interactive.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut
|