plack/Plack — pull request #420 by miyagawa (2013-07-12 09:45:46+00:00)
Title: Simple interface for Plack::Test

Plack::Test has been criticized a bit about the callback-centric interface e.g. #180

This was originally due to the lack of OO interface in Test::TCP, but now that Test::TCP implemented it a while ago, there's no reason that Plack::Test also has to follow the functional interface.

This simple patch adds (but keeps the existing `test_psgi` as a wrapper) a new simple OO interface to test PSGI application using HTTP::Request/HTTP::Response interface.

```
my $test = Plack::Test->create($app);
my $res = $test->request($req);
```

see also https://metacpan.org/release/Plack-Test-Simple, which uses `test_psgi` internally for each request, and can be improved a lot by switching to this new interface.

All tests pass.

- [ ] Plack::Test::ExternalServer (for Catalyst) needs to be updated, and older subclass implementation might have to be supported unless it can do a version bump @rafl
- [ ] Documentation is a bit rough and could use an overhaul. There are some undocumented options such as `ua` to persist agent and client cookies

cc @plack/core @alnewkirk @chromatic