Update to drupal 8.0.0-rc1. For more information, see https://www.drupal.org/node/2582663
This commit is contained in:
parent
eb34d130a8
commit
f32e58e4b1
8476 changed files with 211648 additions and 170042 deletions
60
vendor/stack/builder/tests/functional/SilexApplicationTest.php
vendored
Normal file
60
vendor/stack/builder/tests/functional/SilexApplicationTest.php
vendored
Normal file
|
@ -0,0 +1,60 @@
|
|||
<?php
|
||||
|
||||
namespace functional;
|
||||
|
||||
use Silex\Application;
|
||||
use Stack\Builder;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||
|
||||
class SilexApplicationTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
class Append implements HttpKernelInterface
|
||||
{
|
||||
private $app;
|
||||
private $appendix;
|
||||
|
||||
public function __construct(HttpKernelInterface $app, $appendix)
|
||||
{
|
||||
$this->app = $app;
|
||||
$this->appendix = $appendix;
|
||||
}
|
||||
|
||||
public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true)
|
||||
{
|
||||
$response = clone $this->app->handle($request, $type, $catch);
|
||||
$response->setContent($response->getContent().$this->appendix);
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
Reference in a new issue