4f964ebe25d005b0de1a95d97f081e9e3fe48ef7
[catagits/Catalyst-Runtime.git] / t / unit / core / mvc.t
1 use Test::More tests => 10;
2 use strict;
3 use warnings;
4
5 use_ok('Catalyst');
6
7 my @complist =
8   map { "MyApp::$_"; }
9   qw/C::Controller M::Model V::View Controller::C Model::M View::V Controller::Model::Dummy::Model Model::Dummy::Model/;
10
11 my $thingie={};
12 bless $thingie,'MyApp::Model::Test::Object';
13 push @complist,$thingie;
14 {
15
16     package MyApp;
17
18     use base qw/Catalyst/;
19
20     __PACKAGE__->components( { map { ( $_, $_ ) } @complist } );
21 }
22
23 is( MyApp->view('View'), 'MyApp::V::View', 'V::View ok' );
24
25 is( MyApp->controller('Controller'),
26     'MyApp::C::Controller', 'C::Controller ok' );
27
28 is( MyApp->model('Model'), 'MyApp::M::Model', 'M::Model ok' );
29
30 is( MyApp->model('Dummy::Model'), 'MyApp::Model::Dummy::Model', 'Model::Dummy::Model ok' );
31
32 isa_ok( MyApp->model('Test::Object'), 'MyApp::Model::Test::Object', 'Test::Object ok' );
33
34 is( MyApp->controller('Model::Dummy::Model'), 'MyApp::Controller::Model::Dummy::Model', 'Controller::Model::Dummy::Model ok' );
35
36 is( MyApp->view('V'), 'MyApp::View::V', 'View::V ok' );
37
38 is( MyApp->controller('C'), 'MyApp::Controller::C', 'Controller::C ok' );
39
40 is( MyApp->model('M'), 'MyApp::Model::M', 'Model::M ok' );