Merge branch 'master' into topic/simple_image_upload
[sgn.git] / t / lib / SimulateC.pm
blob8a29a5b11f2b9e55135ca510a17f06fef36c75f4
1 package SimulateC;
3 use Moose;
5 use Catalyst::Authentication::User;
6 use CXGN::People::Person;
8 has 'dbh' => ( isa => 'Ref',
9 is => 'rw',
10 required => 1,
13 has 'sp_person_id' => ( isa => 'Int',
14 is => 'rw',
15 required => 1,
18 has 'user' => ( isa => 'Object',
19 is => 'rw',
23 has 'bcs_schema' => (isa => 'Bio::Chado::Schema',
24 is => 'rw',
25 required => 1,
28 has 'metadata_schema' => (isa => 'CXGN::Metadata::Schema',
29 is => 'rw',
32 has 'phenome_schema' => ( isa => 'CXGN::Phenome::Schema',
33 is => 'rw',
36 has 'sgn_schema' => ( isa => 'SGN::Schema',
37 is => 'rw',
40 sub BUILD {
41 my $self = shift;
42 my $args = shift;
43 my $catalyst_user = Catalyst::Authentication::User->new();
44 my $sgn_user = CXGN::People::Person->new($args->{dbh}, $args->{sp_person_id});
45 $catalyst_user->set_object($sgn_user);
46 $self->user($catalyst_user);
53 sub dbic_schema {
54 my $self = shift;
55 my $name = shift;
57 if ($name eq 'Bio::Chado::Schema') {
58 return $self->bcs_schema();
60 if ($name eq 'CXGN::Phenome::Schema') {
61 return $self->phenome_schema();
63 if ($name eq 'SGN::Schema') {
64 return $self->sgn_schema();
66 if ($name eq 'CXGN::Metadata::Schema') {
67 return $self->metadata_schema();
70 return undef;