add some tests to t/cat_test.t
[catagits/Catalyst-Plugin-Session.git] / t / lib / SessionTestApp / Controller / Root.pm
index 948adc6..0afc633 100644 (file)
@@ -13,6 +13,14 @@ sub login : Global {
     $c->res->output("logged in");
 }
 
+sub login_without_address : Global {
+    my ( $self, $c ) = @_;
+    $c->session;
+    $c->log->debug($c->request->address);
+    delete $c->session->{__address};
+    $c->res->output("logged in (without address)");
+}
+
 sub logout : Global {
     my ( $self, $c ) = @_;
     $c->res->output(
@@ -20,6 +28,19 @@ sub logout : Global {
     $c->delete_session("logout");
 }
 
+sub logout_redirect : Global {
+    my ( $self, $c ) = @_;
+
+    $c->logout;
+    $c->res->output("redirect from here");
+    $c->res->redirect( $c->uri_for('from_logout_redirect') );
+}
+
+sub from_logout_redirect : Global {
+    my ( $self, $c ) = @_;
+    $c->res->output( "got here from logout_redirect" );
+}
+
 sub set_session_variable : Global {
     my ( $self, $c, $var, $val ) = @_;
     $c->session->{$var} = $val;
@@ -67,4 +88,49 @@ sub user_agent : Global {
     $c->res->output('UA=' . $c->req->user_agent);
 }
 
+sub accessor_test : Global {
+    my ( $self, $c ) = @_;
+
+    $c->session(
+        one => 1,
+        two => 2,
+    );
+
+    $c->session( {
+            three => 3,
+            four => 4,
+        },
+    );
+
+    $c->session->{five} = 5;
+
+    for my $key (keys %{ $c->session }) {
+        $c->res->write("$key: " . $c->session->{$key} . "\n");
+    }
+}
+
+sub dump_these_loads_session : Global {
+    my ($self, $c) = @_;
+
+    $c->dump_these();
+    if ($c->_session) {
+        $c->res->write('LOADED')
+    }
+    else {
+        $c->res->write('NOT');
+    }
+}
+
+sub change_session_expires : Global {
+    my ($self, $c) = @_;
+    $c->change_session_expires(31536000);
+    $c->res->output($c->session_expires);
+}
+
+sub reset_session_expires : Global {
+    my ($self, $c) = @_;
+    $c->reset_session_expires;
+    $c->res->output($c->session_expires);
+}
+
 1;