File tree Expand file tree Collapse file tree 2 files changed +40
-9
lines changed Expand file tree Collapse file tree 2 files changed +40
-9
lines changed Original file line number Diff line number Diff line change @@ -2,22 +2,22 @@ package BlogDB::Web::Test;
2
2
use Import::Into;
3
3
use Test::More;
4
4
use Test::Deep;
5
- use Test::Mojo;
5
+ use Test::Mojo::BlogDB ;
6
6
use Test::Postgresql58;
7
7
8
8
push our @ISA , qw( Exporter ) ;
9
- push our @EXPORT , qw( ) ;
9
+ push our @EXPORT , qw( $run_code ) ;
10
10
11
11
sub import {
12
12
shift -> export_to_level(1);
13
13
my $target = caller ;
14
14
15
- Mojo::Base-> import ::into($target , ' -strict' );
16
- warnings -> import ::into($target );
17
- strict -> import ::into($target );
18
- Test::More-> import ::into($target );
19
- Test::Deep-> import ::into($target );
20
- Test::Mojo-> import ::into($target );
15
+ Mojo::Base -> import ::into($target , ' -strict' , ' -signatures ' );
16
+ warnings -> import ::into($target );
17
+ strict -> import ::into($target );
18
+ Test::More -> import ::into($target );
19
+ Test::Deep -> import ::into($target );
20
+ Test::Mojo::BlogDB -> import ::into($target );
21
21
}
22
22
23
23
our $pgsql = Test::Postgresql58-> new()
@@ -49,4 +49,4 @@ sub load_psql_file {
49
49
undef $dbh ;
50
50
}
51
51
52
- 1;
52
+ 1;
Original file line number Diff line number Diff line change
1
+ package Test::Mojo::BlogDB ;
2
+ use parent ' Test::Mojo' ;
3
+ use Data::Dumper;
4
+
5
+ sub new {
6
+ my $class = shift ;
7
+ my $self = $class -> SUPER::new(@_ );
8
+
9
+ $self -> app-> hook( after_dispatch => sub {
10
+ my ( $c ) = @_ ;
11
+ $self -> stash( $c -> stash );
12
+ });
13
+
14
+ return $self ;
15
+ }
16
+
17
+ sub stash {
18
+ my $self = shift ;
19
+ $self -> {stash } = shift if @_ ;
20
+ return $self -> {stash };
21
+ }
22
+
23
+ sub code_block {
24
+ my ( $t , $code ) = @_ ;
25
+
26
+ $code -> ($t );
27
+
28
+ return $t ;
29
+ }
30
+
31
+ 1;
You can’t perform that action at this time.
0 commit comments