« blib/lib/auto/share/dist/Dist-Zilla-MintingProfile-FB11/profiles/FB11X/skel/t/lib/TestApp.pm
↑ Summary
blib/lib/auto/share/dist/Dist-Zilla-MintingProfile-FB11/profiles/FB11X/skel/t/lib/script/testapp_server.pl »
| 1 | package TestApp::Builder; | ||
| 2 | use Test::PostgreSQL; | ||
| 3 | |||
| 4 | use Moose; | ||
| 5 | extends 'OpusVL::FB11::Builder'; | ||
| 6 | |||
| 7 | # Just keep it in scope until the process ends. | ||
| 8 | our $PSQL; | ||
| 9 | |||
| 10 | override _build_superclasses => sub | ||
| 11 | { | ||
| 12 | return [ 'OpusVL::FB11' ] | ||
| 13 | }; | ||
| 14 | |||
| 15 | override _build_plugins => sub { | ||
| 16 | my $plugins = super(); # Get what CatalystX::AppBuilder gives you | ||
| 17 | |||
| 18 | push @$plugins, qw( | ||
| 19 | +{{ $dist->name =~ s/-/::/gr }} | ||
| 20 | ); | ||
| 21 | |||
| 22 | return $plugins; | ||
| 23 | }; | ||
| 24 | |||
| 25 | override _build_config => sub { | ||
| 26 | my $self = shift; | ||
| 27 | my $config = super(); # Get what CatalystX::AppBuilder gives you | ||
| 28 | |||
| 29 | $PSQL = Test::PostgreSQL->new | ||
| 30 | or die $Test::PostgreSQL::errstr; | ||
| 31 | |||
| 32 | # Point the models to the correct DB files | ||
| 33 | my %models = ( | ||
| 34 | 'Model::FB11AuthDB' => 'OpusVL::FB11::Schema::FB11AuthDB', | ||
| 35 | ); | ||
| 36 | while (my ($model, $schema_class) = each %models) { | ||
| 37 | $config->{$model} = { | ||
| 38 | schema_class => $schema_class, | ||
| 39 | connect_info => [ $PSQL->dsn ], | ||
| 40 | }; | ||
| 41 | } | ||
| 42 | |||
| 43 | # .. add static dir into the config for Static::Simple.. | ||
| 44 | { | ||
| 45 | my $static_simple_conf = $config->{'Plugin::Static::Simple'}; | ||
| 46 | my $static_dirs = $static_simple_conf->{include_path}; | ||
| 47 | unshift(@$static_dirs, TestApp->path_to('root')); | ||
| 48 | $static_simple_conf->{include_path} = $static_dirs; | ||
| 49 | } | ||
| 50 | |||
| 51 | # .. allow access regardless of ACL rules... | ||
| 52 | $config->{'fb11_can_access_actionpaths'} = ['custom/custom']; | ||
| 53 | |||
| 54 | # DEBUGIN!!!! | ||
| 55 | $config->{'fb11_can_access_everything'} = 1; | ||
| 56 | |||
| 57 | $config->{application_name} = 'FB11 TestApp'; | ||
| 58 | $config->{default_view} = 'FB11TT'; | ||
| 59 | |||
| 60 | return $config; | ||
| 61 | }; | ||
| 62 | |||
| 63 | 1; |