Commit | Line | Data |
0421e89a |
1 | #!/usr/bin/perl |
2 | |
3 | use strict; |
4 | use warnings; |
5 | |
6 | use Test::More; |
7 | |
8 | BEGIN { |
9 | eval { require Catalyst::Plugin::Session::State::Cookie; Catalyst::Plugin::Session::State::Cookie->VERSION(0.03) } |
10 | or plan skip_all => |
11 | "Catalyst::Plugin::Session::State::Cookie 0.03 or higher is required for this test"; |
12 | |
13 | eval { |
14 | require Test::WWW::Mechanize::Catalyst; |
15 | Test::WWW::Mechanize::Catalyst->VERSION(0.51); |
16 | } |
17 | or plan skip_all => |
18 | 'Test::WWW::Mechanize::Catalyst >= 0.51 is required for this test'; |
19 | } |
20 | |
21 | use lib "t/lib"; |
22 | use Test::WWW::Mechanize::Catalyst "SessionTestApp"; |
23 | |
24 | my $ua = Test::WWW::Mechanize::Catalyst->new; |
25 | |
26 | my $res = $ua->get( "http://localhost/get_expires" ); |
27 | ok($res->is_success, "get expires"); |
28 | |
29 | my $expiry = $res->decoded_content; |
30 | |
31 | sleep(1); |
32 | |
33 | $res = $ua->get( "http://localhost/get_expires" ); |
34 | ok($res->is_success, "get expires"); |
35 | |
36 | is($res->decoded_content, $expiry, "expiration not updated"); |
37 | |
38 | sleep(10); |
39 | |
40 | $res = $ua->get( "http://localhost/get_expires" ); |
41 | ok($res->is_success, "get expires"); |
42 | |
43 | isnt($res->decoded_content, $expiry, "expiration updated"); |
44 | |
45 | done_testing; |