[Catalyst] setting/getting session data from within tests
Matt S Trout
dbix-class at trout.me.uk
Mon Jun 5 19:11:06 CEST 2006
Daniel McBrearty wrote:
> but sometimes you have to, to get a reasonable level of usability ... eg:
>
> In my app, the user selects his language. Either language is stored in
> the session once selected, or you make him select anew every visit,
> and pass the value back and fore every request. My current
> implementation of engoi does this, but it's not pretty.
>
> Same for any app where you have a members system with a persistent login.
>
> Anyhow, I'm thinking that there is a persistent store for this
> *somewhere* under the guts of cat. It's just a case of making an
> interface to it which is accessible to the test framework.
Why bother?
t/lib/MyApp/Controller/Test.pm
sub dump_stuff :Local {
<lob contents of session etc. into $c->res->body here>
}
in your test
use lib qw(t/lib);
then get the data via a mech request to /test/dump_stuff ...
More information about the Catalyst
mailing list