Mercurial > pub > Impl
annotate _test/Test/Web/Application.pm @ 178:658a80d19d33
new constructor syntax
author | sourcer |
---|---|
date | Wed, 12 Oct 2011 00:06:07 +0300 |
parents | 4267a2ac3d46 |
children | d1676be8afcc |
rev | line source |
---|---|
60
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
1 package Test::Web::Application::Instance; |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
2 package Test::Web::Application; |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
3 use strict; |
166 | 4 use parent qw(IMPL::Test::Unit); |
60
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
5 |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
6 use IMPL::Test qw(test failed); |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
7 require IMPL::Web::Application; |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
8 |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
9 __PACKAGE__->PassThroughArgs; |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
10 |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
11 sub CTOR { |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
12 # simulate CGI environment |
63
76b878ad6596
Added serialization support for the IMPL::Object::List
wizard
parents:
61
diff
changeset
|
13 |
76b878ad6596
Added serialization support for the IMPL::Object::List
wizard
parents:
61
diff
changeset
|
14 $ENV{PATH_TRANSLATED} = "Resources/simple.tt"; |
60
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
15 } |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
16 |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
17 test SpawnApp => sub { |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
18 my $instance = spawn Test::Web::Application::Instance('Resources/app.xml'); |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
19 |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
20 return 1; |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
21 }; |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
22 |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
23 test ActivateOnDemand => sub { |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
24 my $instance = spawn Test::Web::Application::Instance('Resources/app.xml'); |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
25 |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
26 my $ds = $instance->dataSource; |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
27 |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
28 return 1; |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
29 }; |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
30 |
61 | 31 test SaveXml => sub { |
32 my $instance = spawn Test::Web::Application::Instance('Resources/app.xml'); | |
33 | |
63
76b878ad6596
Added serialization support for the IMPL::Object::List
wizard
parents:
61
diff
changeset
|
34 $instance->xml or failed "xml property is invalid"; |
76b878ad6596
Added serialization support for the IMPL::Object::List
wizard
parents:
61
diff
changeset
|
35 }; |
76b878ad6596
Added serialization support for the IMPL::Object::List
wizard
parents:
61
diff
changeset
|
36 |
76b878ad6596
Added serialization support for the IMPL::Object::List
wizard
parents:
61
diff
changeset
|
37 test Run => sub { |
76b878ad6596
Added serialization support for the IMPL::Object::List
wizard
parents:
61
diff
changeset
|
38 my $instance = spawn Test::Web::Application::Instance('Resources/app.xml'); |
76b878ad6596
Added serialization support for the IMPL::Object::List
wizard
parents:
61
diff
changeset
|
39 $instance->Run(); |
61 | 40 }; |
41 | |
60
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
42 package Test::Web::Application::Instance; |
166 | 43 use parent qw(IMPL::Web::Application); |
60
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
44 |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
45 __PACKAGE__->PassThroughArgs; |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
46 |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
47 use IMPL::Class::Property; |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
48 |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
49 BEGIN { |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
50 public property name => prop_all; |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
51 public property options => prop_all; |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
52 public property dataSource => prop_all; |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
53 public property securityMod => prop_all; |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
54 } |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
55 |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
56 |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
57 1; |