File: 01-basic.t

package info (click to toggle)
libcatalystx-injectcomponent-perl 0.025-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 84 kB
  • sloc: perl: 135; makefile: 2
file content (45 lines) | stat: -rw-r--r-- 1,031 bytes parent folder | download | duplicates (4)
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
#!/usr/bin/perl -w

use strict;
use warnings;

use Test::Most;

plan qw/no_plan/;

use CatalystX::InjectComponent;

BEGIN {
package Model::Banana;

use parent qw/Catalyst::Model/;

package TestCatalyst; $INC{'TestCatalyst.pm'} = 1;

use Catalyst::Runtime '5.70';

use Moose;
BEGIN { extends qw/Catalyst/ }

use Catalyst;

after 'setup_components' => sub {
    my $self = shift;
    CatalystX::InjectComponent->inject( into => __PACKAGE__, component => 'Model::Banana' );
    CatalystX::InjectComponent->inject( into => __PACKAGE__, component => 't::Test::Apple' );
    CatalystX::InjectComponent->inject( into => __PACKAGE__, component => 'Model::Banana', as => 'Cherry' );
    CatalystX::InjectComponent->inject( into => __PACKAGE__, component => 't::Test::Apple', as => 'Apple' );
};

TestCatalyst->config( 'home' => '.' );

TestCatalyst->setup;

}

package main;

use Catalyst::Test qw/TestCatalyst/;

ok( TestCatalyst->controller( $_ ) ) for qw/ Apple t::Test::Apple /;
ok( TestCatalyst->model( $_ ) ) for qw/ Banana Cherry /;