You are here

public function SilexApplicationTest::testWithAppendMiddlewares in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/stack/builder/tests/functional/SilexApplicationTest.php \functional\SilexApplicationTest::testWithAppendMiddlewares()

File

vendor/stack/builder/tests/functional/SilexApplicationTest.php, line 12

Class

SilexApplicationTest

Namespace

functional

Code

public function testWithAppendMiddlewares() {
  $app = new Application();
  $app
    ->get('/foo', function () {
    return 'bar';
  });
  $finished = false;
  $app
    ->finish(function () use (&$finished) {
    $finished = true;
  });
  $stack = new Builder();
  $stack
    ->push('functional\\Append', '.A')
    ->push('functional\\Append', '.B');
  $app = $stack
    ->resolve($app);
  $request = Request::create('/foo');
  $response = $app
    ->handle($request);
  $app
    ->terminate($request, $response);
  $this
    ->assertSame('bar.B.A', $response
    ->getContent());
  $this
    ->assertTrue($finished);
}