composeer update
This commit is contained in:
187
vendor/symfony/http-kernel/Client.php
vendored
187
vendor/symfony/http-kernel/Client.php
vendored
@@ -11,8 +11,191 @@
|
||||
|
||||
namespace Symfony\Component\HttpKernel;
|
||||
|
||||
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.3, use "%s" instead.', Client::class, HttpKernelBrowser::class), E_USER_DEPRECATED);
|
||||
use Symfony\Component\BrowserKit\AbstractBrowser;
|
||||
use Symfony\Component\BrowserKit\CookieJar;
|
||||
use Symfony\Component\BrowserKit\History;
|
||||
use Symfony\Component\BrowserKit\Request as DomRequest;
|
||||
use Symfony\Component\BrowserKit\Response as DomResponse;
|
||||
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
class Client extends HttpKernelBrowser
|
||||
/**
|
||||
* Client simulates a browser and makes requests to an HttpKernel instance.
|
||||
*
|
||||
* @deprecated since Symfony 4.3, use HttpKernelBrowser instead.
|
||||
*/
|
||||
class Client extends AbstractBrowser
|
||||
{
|
||||
protected $kernel;
|
||||
private $catchExceptions = true;
|
||||
|
||||
/**
|
||||
* @param HttpKernelInterface $kernel An HttpKernel instance
|
||||
* @param array $server The server parameters (equivalent of $_SERVER)
|
||||
* @param History $history A History instance to store the browser history
|
||||
* @param CookieJar $cookieJar A CookieJar instance to store the cookies
|
||||
*/
|
||||
public function __construct(HttpKernelInterface $kernel, array $server = [], History $history = null, CookieJar $cookieJar = null)
|
||||
{
|
||||
// These class properties must be set before calling the parent constructor, as it may depend on it.
|
||||
$this->kernel = $kernel;
|
||||
$this->followRedirects = false;
|
||||
|
||||
parent::__construct($server, $history, $cookieJar);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether to catch exceptions when the kernel is handling a request.
|
||||
*
|
||||
* @param bool $catchExceptions Whether to catch exceptions
|
||||
*/
|
||||
public function catchExceptions($catchExceptions)
|
||||
{
|
||||
$this->catchExceptions = $catchExceptions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes a request.
|
||||
*
|
||||
* @return Response A Response instance
|
||||
*/
|
||||
protected function doRequest($request)
|
||||
{
|
||||
$response = $this->kernel->handle($request, HttpKernelInterface::MASTER_REQUEST, $this->catchExceptions);
|
||||
|
||||
if ($this->kernel instanceof TerminableInterface) {
|
||||
$this->kernel->terminate($request, $response);
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the script to execute when the request must be insulated.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getScript($request)
|
||||
{
|
||||
$kernel = var_export(serialize($this->kernel), true);
|
||||
$request = var_export(serialize($request), true);
|
||||
|
||||
$errorReporting = error_reporting();
|
||||
|
||||
$requires = '';
|
||||
foreach (get_declared_classes() as $class) {
|
||||
if (0 === strpos($class, 'ComposerAutoloaderInit')) {
|
||||
$r = new \ReflectionClass($class);
|
||||
$file = \dirname(\dirname($r->getFileName())).'/autoload.php';
|
||||
if (file_exists($file)) {
|
||||
$requires .= 'require_once '.var_export($file, true).";\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$requires) {
|
||||
throw new \RuntimeException('Composer autoloader not found.');
|
||||
}
|
||||
|
||||
$code = <<<EOF
|
||||
<?php
|
||||
|
||||
error_reporting($errorReporting);
|
||||
|
||||
$requires
|
||||
|
||||
\$kernel = unserialize($kernel);
|
||||
\$request = unserialize($request);
|
||||
EOF;
|
||||
|
||||
return $code.$this->getHandleScript();
|
||||
}
|
||||
|
||||
protected function getHandleScript()
|
||||
{
|
||||
return <<<'EOF'
|
||||
$response = $kernel->handle($request);
|
||||
|
||||
if ($kernel instanceof Symfony\Component\HttpKernel\TerminableInterface) {
|
||||
$kernel->terminate($request, $response);
|
||||
}
|
||||
|
||||
echo serialize($response);
|
||||
EOF;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts the BrowserKit request to a HttpKernel request.
|
||||
*
|
||||
* @return Request A Request instance
|
||||
*/
|
||||
protected function filterRequest(DomRequest $request)
|
||||
{
|
||||
$httpRequest = Request::create($request->getUri(), $request->getMethod(), $request->getParameters(), $request->getCookies(), $request->getFiles(), $request->getServer(), $request->getContent());
|
||||
|
||||
foreach ($this->filterFiles($httpRequest->files->all()) as $key => $value) {
|
||||
$httpRequest->files->set($key, $value);
|
||||
}
|
||||
|
||||
return $httpRequest;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters an array of files.
|
||||
*
|
||||
* This method created test instances of UploadedFile so that the move()
|
||||
* method can be called on those instances.
|
||||
*
|
||||
* If the size of a file is greater than the allowed size (from php.ini) then
|
||||
* an invalid UploadedFile is returned with an error set to UPLOAD_ERR_INI_SIZE.
|
||||
*
|
||||
* @see UploadedFile
|
||||
*
|
||||
* @return array An array with all uploaded files marked as already moved
|
||||
*/
|
||||
protected function filterFiles(array $files)
|
||||
{
|
||||
$filtered = [];
|
||||
foreach ($files as $key => $value) {
|
||||
if (\is_array($value)) {
|
||||
$filtered[$key] = $this->filterFiles($value);
|
||||
} elseif ($value instanceof UploadedFile) {
|
||||
if ($value->isValid() && $value->getSize() > UploadedFile::getMaxFilesize()) {
|
||||
$filtered[$key] = new UploadedFile(
|
||||
'',
|
||||
$value->getClientOriginalName(),
|
||||
$value->getClientMimeType(),
|
||||
UPLOAD_ERR_INI_SIZE,
|
||||
true
|
||||
);
|
||||
} else {
|
||||
$filtered[$key] = new UploadedFile(
|
||||
$value->getPathname(),
|
||||
$value->getClientOriginalName(),
|
||||
$value->getClientMimeType(),
|
||||
$value->getError(),
|
||||
true
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $filtered;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts the HttpKernel response to a BrowserKit response.
|
||||
*
|
||||
* @return DomResponse A DomResponse instance
|
||||
*/
|
||||
protected function filterResponse($response)
|
||||
{
|
||||
// this is needed to support StreamedResponse
|
||||
ob_start();
|
||||
$response->sendContent();
|
||||
$content = ob_get_clean();
|
||||
|
||||
return new DomResponse($content, $response->getStatusCode(), $response->headers->all());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ class FileLinkFormatter
|
||||
*/
|
||||
public function __sleep(): array
|
||||
{
|
||||
$this->getFileLinkFormat();
|
||||
$this->fileLinkFormat = $this->getFileLinkFormat();
|
||||
|
||||
return ['fileLinkFormat'];
|
||||
}
|
||||
@@ -87,17 +87,19 @@ class FileLinkFormatter
|
||||
|
||||
private function getFileLinkFormat()
|
||||
{
|
||||
if ($this->fileLinkFormat) {
|
||||
return $this->fileLinkFormat;
|
||||
}
|
||||
|
||||
if ($this->requestStack && $this->baseDir && $this->urlFormat) {
|
||||
$request = $this->requestStack->getMasterRequest();
|
||||
|
||||
if ($request instanceof Request && (!$this->urlFormat instanceof \Closure || $this->urlFormat = ($this->urlFormat)())) {
|
||||
$this->fileLinkFormat = [
|
||||
return [
|
||||
$request->getSchemeAndHttpHost().$request->getBasePath().$this->urlFormat,
|
||||
$this->baseDir.\DIRECTORY_SEPARATOR, '',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
return $this->fileLinkFormat;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,10 @@ use Symfony\Component\Debug\ErrorHandler;
|
||||
use Symfony\Component\Debug\ExceptionHandler;
|
||||
use Symfony\Component\EventDispatcher\Event;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Debug\FileLinkFormatter;
|
||||
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
|
||||
use Symfony\Component\HttpKernel\Event\KernelEvent;
|
||||
use Symfony\Component\HttpKernel\KernelEvents;
|
||||
|
||||
@@ -37,6 +40,7 @@ class DebugHandlersListener implements EventSubscriberInterface
|
||||
private $scream;
|
||||
private $fileLinkFormat;
|
||||
private $scope;
|
||||
private $charset;
|
||||
private $firstCall = true;
|
||||
private $hasTerminatedWithException;
|
||||
|
||||
@@ -49,7 +53,7 @@ class DebugHandlersListener implements EventSubscriberInterface
|
||||
* @param string|FileLinkFormatter|null $fileLinkFormat The format for links to source files
|
||||
* @param bool $scope Enables/disables scoping mode
|
||||
*/
|
||||
public function __construct(callable $exceptionHandler = null, LoggerInterface $logger = null, $levels = E_ALL, ?int $throwAt = E_ALL, bool $scream = true, $fileLinkFormat = null, bool $scope = true)
|
||||
public function __construct(callable $exceptionHandler = null, LoggerInterface $logger = null, $levels = E_ALL, ?int $throwAt = E_ALL, bool $scream = true, $fileLinkFormat = null, bool $scope = true, string $charset = null)
|
||||
{
|
||||
$this->exceptionHandler = $exceptionHandler;
|
||||
$this->logger = $logger;
|
||||
@@ -58,6 +62,7 @@ class DebugHandlersListener implements EventSubscriberInterface
|
||||
$this->scream = $scream;
|
||||
$this->fileLinkFormat = $fileLinkFormat;
|
||||
$this->scope = $scope;
|
||||
$this->charset = $charset;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -144,6 +149,26 @@ class DebugHandlersListener implements EventSubscriberInterface
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
public function onKernelException(GetResponseForExceptionEvent $event)
|
||||
{
|
||||
if (!$this->hasTerminatedWithException || !$event->isMasterRequest()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$debug = $this->scream && $this->scope;
|
||||
$controller = function (Request $request) use ($debug) {
|
||||
$e = $request->attributes->get('exception');
|
||||
$handler = new ExceptionHandler($debug, $this->charset, $this->fileLinkFormat);
|
||||
|
||||
return new Response($handler->getHtml($e), $e->getStatusCode(), $e->getHeaders());
|
||||
};
|
||||
|
||||
(new ExceptionListener($controller, $this->logger, $debug))->onKernelException($event);
|
||||
}
|
||||
|
||||
public static function getSubscribedEvents()
|
||||
{
|
||||
$events = [KernelEvents::REQUEST => ['configure', 2048]];
|
||||
@@ -152,6 +177,8 @@ class DebugHandlersListener implements EventSubscriberInterface
|
||||
$events[ConsoleEvents::COMMAND] = ['configure', 2048];
|
||||
}
|
||||
|
||||
$events[KernelEvents::EXCEPTION] = ['onKernelException', -2048];
|
||||
|
||||
return $events;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ namespace Symfony\Component\HttpKernel\EventListener;
|
||||
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\Debug\Exception\FlattenException;
|
||||
use Symfony\Component\Debug\ExceptionHandler;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
@@ -34,17 +33,12 @@ class ExceptionListener implements EventSubscriberInterface
|
||||
protected $controller;
|
||||
protected $logger;
|
||||
protected $debug;
|
||||
private $charset;
|
||||
private $fileLinkFormat;
|
||||
private $isTerminating = false;
|
||||
|
||||
public function __construct($controller, LoggerInterface $logger = null, $debug = false, string $charset = null, $fileLinkFormat = null)
|
||||
public function __construct($controller, LoggerInterface $logger = null, $debug = false)
|
||||
{
|
||||
$this->controller = $controller;
|
||||
$this->logger = $logger;
|
||||
$this->debug = $debug;
|
||||
$this->charset = $charset;
|
||||
$this->fileLinkFormat = $fileLinkFormat;
|
||||
}
|
||||
|
||||
public function logKernelException(GetResponseForExceptionEvent $event)
|
||||
@@ -61,16 +55,9 @@ class ExceptionListener implements EventSubscriberInterface
|
||||
public function onKernelException(GetResponseForExceptionEvent $event)
|
||||
{
|
||||
if (null === $this->controller) {
|
||||
if (!$event->isMasterRequest()) {
|
||||
return;
|
||||
}
|
||||
if (!$this->isTerminating) {
|
||||
$this->isTerminating = true;
|
||||
|
||||
return;
|
||||
}
|
||||
$this->isTerminating = false;
|
||||
return;
|
||||
}
|
||||
|
||||
$exception = $event->getException();
|
||||
$request = $this->duplicateRequest($exception, $event->getRequest());
|
||||
$eventDispatcher = \func_num_args() > 2 ? func_get_arg(2) : null;
|
||||
@@ -107,11 +94,6 @@ class ExceptionListener implements EventSubscriberInterface
|
||||
}
|
||||
}
|
||||
|
||||
public function reset()
|
||||
{
|
||||
$this->isTerminating = false;
|
||||
}
|
||||
|
||||
public static function getSubscribedEvents()
|
||||
{
|
||||
return [
|
||||
@@ -150,12 +132,8 @@ class ExceptionListener implements EventSubscriberInterface
|
||||
protected function duplicateRequest(\Exception $exception, Request $request)
|
||||
{
|
||||
$attributes = [
|
||||
'exception' => $exception = FlattenException::create($exception),
|
||||
'_controller' => $this->controller ?: function () use ($exception) {
|
||||
$handler = new ExceptionHandler($this->debug, $this->charset, $this->fileLinkFormat);
|
||||
|
||||
return new Response($handler->getHtml($exception), $exception->getStatusCode(), $exception->getHeaders());
|
||||
},
|
||||
'_controller' => $this->controller,
|
||||
'exception' => FlattenException::create($exception),
|
||||
'logger' => $this->logger instanceof DebugLoggerInterface ? $this->logger : null,
|
||||
];
|
||||
$request = $request->duplicate(null, null, $attributes);
|
||||
|
||||
182
vendor/symfony/http-kernel/HttpKernelBrowser.php
vendored
182
vendor/symfony/http-kernel/HttpKernelBrowser.php
vendored
@@ -11,15 +11,6 @@
|
||||
|
||||
namespace Symfony\Component\HttpKernel;
|
||||
|
||||
use Symfony\Component\BrowserKit\AbstractBrowser;
|
||||
use Symfony\Component\BrowserKit\CookieJar;
|
||||
use Symfony\Component\BrowserKit\History;
|
||||
use Symfony\Component\BrowserKit\Request as DomRequest;
|
||||
use Symfony\Component\BrowserKit\Response as DomResponse;
|
||||
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
/**
|
||||
* Client simulates a browser and makes requests to an HttpKernel instance.
|
||||
*
|
||||
@@ -28,177 +19,6 @@ use Symfony\Component\HttpFoundation\Response;
|
||||
* @method Request getRequest() A Request instance
|
||||
* @method Response getResponse() A Response instance
|
||||
*/
|
||||
class HttpKernelBrowser extends AbstractBrowser
|
||||
class HttpKernelBrowser extends Client
|
||||
{
|
||||
protected $kernel;
|
||||
private $catchExceptions = true;
|
||||
|
||||
/**
|
||||
* @param HttpKernelInterface $kernel An HttpKernel instance
|
||||
* @param array $server The server parameters (equivalent of $_SERVER)
|
||||
* @param History $history A History instance to store the browser history
|
||||
* @param CookieJar $cookieJar A CookieJar instance to store the cookies
|
||||
*/
|
||||
public function __construct(HttpKernelInterface $kernel, array $server = [], History $history = null, CookieJar $cookieJar = null)
|
||||
{
|
||||
// These class properties must be set before calling the parent constructor, as it may depend on it.
|
||||
$this->kernel = $kernel;
|
||||
$this->followRedirects = false;
|
||||
|
||||
parent::__construct($server, $history, $cookieJar);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether to catch exceptions when the kernel is handling a request.
|
||||
*
|
||||
* @param bool $catchExceptions Whether to catch exceptions
|
||||
*/
|
||||
public function catchExceptions($catchExceptions)
|
||||
{
|
||||
$this->catchExceptions = $catchExceptions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes a request.
|
||||
*
|
||||
* @return Response A Response instance
|
||||
*/
|
||||
protected function doRequest($request)
|
||||
{
|
||||
$response = $this->kernel->handle($request, HttpKernelInterface::MASTER_REQUEST, $this->catchExceptions);
|
||||
|
||||
if ($this->kernel instanceof TerminableInterface) {
|
||||
$this->kernel->terminate($request, $response);
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the script to execute when the request must be insulated.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getScript($request)
|
||||
{
|
||||
$kernel = var_export(serialize($this->kernel), true);
|
||||
$request = var_export(serialize($request), true);
|
||||
|
||||
$errorReporting = error_reporting();
|
||||
|
||||
$requires = '';
|
||||
foreach (get_declared_classes() as $class) {
|
||||
if (0 === strpos($class, 'ComposerAutoloaderInit')) {
|
||||
$r = new \ReflectionClass($class);
|
||||
$file = \dirname(\dirname($r->getFileName())).'/autoload.php';
|
||||
if (file_exists($file)) {
|
||||
$requires .= 'require_once '.var_export($file, true).";\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$requires) {
|
||||
throw new \RuntimeException('Composer autoloader not found.');
|
||||
}
|
||||
|
||||
$code = <<<EOF
|
||||
<?php
|
||||
|
||||
error_reporting($errorReporting);
|
||||
|
||||
$requires
|
||||
|
||||
\$kernel = unserialize($kernel);
|
||||
\$request = unserialize($request);
|
||||
EOF;
|
||||
|
||||
return $code.$this->getHandleScript();
|
||||
}
|
||||
|
||||
protected function getHandleScript()
|
||||
{
|
||||
return <<<'EOF'
|
||||
$response = $kernel->handle($request);
|
||||
|
||||
if ($kernel instanceof Symfony\Component\HttpKernel\TerminableInterface) {
|
||||
$kernel->terminate($request, $response);
|
||||
}
|
||||
|
||||
echo serialize($response);
|
||||
EOF;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts the BrowserKit request to a HttpKernel request.
|
||||
*
|
||||
* @return Request A Request instance
|
||||
*/
|
||||
protected function filterRequest(DomRequest $request)
|
||||
{
|
||||
$httpRequest = Request::create($request->getUri(), $request->getMethod(), $request->getParameters(), $request->getCookies(), $request->getFiles(), $request->getServer(), $request->getContent());
|
||||
|
||||
foreach ($this->filterFiles($httpRequest->files->all()) as $key => $value) {
|
||||
$httpRequest->files->set($key, $value);
|
||||
}
|
||||
|
||||
return $httpRequest;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters an array of files.
|
||||
*
|
||||
* This method created test instances of UploadedFile so that the move()
|
||||
* method can be called on those instances.
|
||||
*
|
||||
* If the size of a file is greater than the allowed size (from php.ini) then
|
||||
* an invalid UploadedFile is returned with an error set to UPLOAD_ERR_INI_SIZE.
|
||||
*
|
||||
* @see UploadedFile
|
||||
*
|
||||
* @return array An array with all uploaded files marked as already moved
|
||||
*/
|
||||
protected function filterFiles(array $files)
|
||||
{
|
||||
$filtered = [];
|
||||
foreach ($files as $key => $value) {
|
||||
if (\is_array($value)) {
|
||||
$filtered[$key] = $this->filterFiles($value);
|
||||
} elseif ($value instanceof UploadedFile) {
|
||||
if ($value->isValid() && $value->getSize() > UploadedFile::getMaxFilesize()) {
|
||||
$filtered[$key] = new UploadedFile(
|
||||
'',
|
||||
$value->getClientOriginalName(),
|
||||
$value->getClientMimeType(),
|
||||
UPLOAD_ERR_INI_SIZE,
|
||||
true
|
||||
);
|
||||
} else {
|
||||
$filtered[$key] = new UploadedFile(
|
||||
$value->getPathname(),
|
||||
$value->getClientOriginalName(),
|
||||
$value->getClientMimeType(),
|
||||
$value->getError(),
|
||||
true
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $filtered;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts the HttpKernel response to a BrowserKit response.
|
||||
*
|
||||
* @return DomResponse A DomResponse instance
|
||||
*/
|
||||
protected function filterResponse($response)
|
||||
{
|
||||
// this is needed to support StreamedResponse
|
||||
ob_start();
|
||||
$response->sendContent();
|
||||
$content = ob_get_clean();
|
||||
|
||||
return new DomResponse($content, $response->getStatusCode(), $response->headers->all());
|
||||
}
|
||||
}
|
||||
|
||||
8
vendor/symfony/http-kernel/Kernel.php
vendored
8
vendor/symfony/http-kernel/Kernel.php
vendored
@@ -73,11 +73,11 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
|
||||
private $requestStackSize = 0;
|
||||
private $resetServices = false;
|
||||
|
||||
const VERSION = '4.3.0';
|
||||
const VERSION_ID = 40300;
|
||||
const VERSION = '4.3.1';
|
||||
const VERSION_ID = 40301;
|
||||
const MAJOR_VERSION = 4;
|
||||
const MINOR_VERSION = 3;
|
||||
const RELEASE_VERSION = 0;
|
||||
const RELEASE_VERSION = 1;
|
||||
const EXTRA_VERSION = '';
|
||||
|
||||
const END_OF_MAINTENANCE = '01/2020';
|
||||
@@ -494,7 +494,6 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
|
||||
$fresh = true;
|
||||
}
|
||||
} catch (\Throwable $e) {
|
||||
} catch (\Exception $e) {
|
||||
} finally {
|
||||
error_reporting($errorLevel);
|
||||
}
|
||||
@@ -563,7 +562,6 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
|
||||
try {
|
||||
$oldContainer = include $cache->getPath();
|
||||
} catch (\Throwable $e) {
|
||||
} catch (\Exception $e) {
|
||||
} finally {
|
||||
error_reporting($errorLevel);
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ class CacheWarmerAggregateTest extends TestCase
|
||||
$warmer
|
||||
->expects($this->once())
|
||||
->method('isOptional')
|
||||
->will($this->returnValue(true));
|
||||
->willReturn(true);
|
||||
$warmer
|
||||
->expects($this->never())
|
||||
->method('warmUp');
|
||||
|
||||
@@ -23,7 +23,7 @@ class FileLocatorTest extends TestCase
|
||||
->expects($this->atLeastOnce())
|
||||
->method('locateResource')
|
||||
->with('@BundleName/some/path', null, true)
|
||||
->will($this->returnValue('/bundle-name/some/path'));
|
||||
->willReturn('/bundle-name/some/path');
|
||||
$locator = new FileLocator($kernel);
|
||||
$this->assertEquals('/bundle-name/some/path', $locator->locate('@BundleName/some/path'));
|
||||
|
||||
|
||||
@@ -27,11 +27,11 @@ class ContainerControllerResolverTest extends ControllerResolverTest
|
||||
$container->expects($this->once())
|
||||
->method('has')
|
||||
->with('foo')
|
||||
->will($this->returnValue(true));
|
||||
->willReturn(true);
|
||||
$container->expects($this->once())
|
||||
->method('get')
|
||||
->with('foo')
|
||||
->will($this->returnValue($service))
|
||||
->willReturn($service)
|
||||
;
|
||||
|
||||
$resolver = $this->createControllerResolver(null, $container);
|
||||
@@ -52,11 +52,11 @@ class ContainerControllerResolverTest extends ControllerResolverTest
|
||||
$container->expects($this->once())
|
||||
->method('has')
|
||||
->with('foo')
|
||||
->will($this->returnValue(true));
|
||||
->willReturn(true);
|
||||
$container->expects($this->once())
|
||||
->method('get')
|
||||
->with('foo')
|
||||
->will($this->returnValue($service))
|
||||
->willReturn($service)
|
||||
;
|
||||
|
||||
$resolver = $this->createControllerResolver(null, $container);
|
||||
@@ -77,12 +77,12 @@ class ContainerControllerResolverTest extends ControllerResolverTest
|
||||
$container->expects($this->once())
|
||||
->method('has')
|
||||
->with('foo')
|
||||
->will($this->returnValue(true))
|
||||
->willReturn(true)
|
||||
;
|
||||
$container->expects($this->once())
|
||||
->method('get')
|
||||
->with('foo')
|
||||
->will($this->returnValue($service))
|
||||
->willReturn($service)
|
||||
;
|
||||
|
||||
$resolver = $this->createControllerResolver(null, $container);
|
||||
@@ -102,12 +102,12 @@ class ContainerControllerResolverTest extends ControllerResolverTest
|
||||
$container->expects($this->once())
|
||||
->method('has')
|
||||
->with(InvokableControllerService::class)
|
||||
->will($this->returnValue(true))
|
||||
->willReturn(true)
|
||||
;
|
||||
$container->expects($this->once())
|
||||
->method('get')
|
||||
->with(InvokableControllerService::class)
|
||||
->will($this->returnValue($service))
|
||||
->willReturn($service)
|
||||
;
|
||||
|
||||
$resolver = $this->createControllerResolver(null, $container);
|
||||
@@ -131,13 +131,13 @@ class ContainerControllerResolverTest extends ControllerResolverTest
|
||||
$container->expects($this->once())
|
||||
->method('has')
|
||||
->with(ControllerTestService::class)
|
||||
->will($this->returnValue(false))
|
||||
->willReturn(false)
|
||||
;
|
||||
|
||||
$container->expects($this->atLeastOnce())
|
||||
->method('getRemovedIds')
|
||||
->with()
|
||||
->will($this->returnValue([ControllerTestService::class => true]))
|
||||
->willReturn([ControllerTestService::class => true])
|
||||
;
|
||||
|
||||
$resolver = $this->createControllerResolver(null, $container);
|
||||
@@ -159,13 +159,13 @@ class ContainerControllerResolverTest extends ControllerResolverTest
|
||||
$container->expects($this->once())
|
||||
->method('has')
|
||||
->with('app.my_controller')
|
||||
->will($this->returnValue(false))
|
||||
->willReturn(false)
|
||||
;
|
||||
|
||||
$container->expects($this->atLeastOnce())
|
||||
->method('getRemovedIds')
|
||||
->with()
|
||||
->will($this->returnValue(['app.my_controller' => true]))
|
||||
->willReturn(['app.my_controller' => true])
|
||||
;
|
||||
|
||||
$resolver = $this->createControllerResolver(null, $container);
|
||||
|
||||
@@ -27,8 +27,8 @@ class LoggerDataCollectorTest extends TestCase
|
||||
->getMockBuilder('Symfony\Component\HttpKernel\Log\DebugLoggerInterface')
|
||||
->setMethods(['countErrors', 'getLogs', 'clear'])
|
||||
->getMock();
|
||||
$logger->expects($this->once())->method('countErrors')->will($this->returnValue('foo'));
|
||||
$logger->expects($this->exactly(2))->method('getLogs')->will($this->returnValue([]));
|
||||
$logger->expects($this->once())->method('countErrors')->willReturn('foo');
|
||||
$logger->expects($this->exactly(2))->method('getLogs')->willReturn([]);
|
||||
|
||||
$c = new LoggerDataCollector($logger, __DIR__.'/');
|
||||
$c->lateCollect();
|
||||
@@ -56,7 +56,7 @@ class LoggerDataCollectorTest extends TestCase
|
||||
->setMethods(['countErrors', 'getLogs', 'clear'])
|
||||
->getMock();
|
||||
$logger->expects($this->once())->method('countErrors')->with(null);
|
||||
$logger->expects($this->exactly(2))->method('getLogs')->with(null)->will($this->returnValue([]));
|
||||
$logger->expects($this->exactly(2))->method('getLogs')->with(null)->willReturn([]);
|
||||
|
||||
$c = new LoggerDataCollector($logger, __DIR__.'/', $stack);
|
||||
|
||||
@@ -77,7 +77,7 @@ class LoggerDataCollectorTest extends TestCase
|
||||
->setMethods(['countErrors', 'getLogs', 'clear'])
|
||||
->getMock();
|
||||
$logger->expects($this->once())->method('countErrors')->with($subRequest);
|
||||
$logger->expects($this->exactly(2))->method('getLogs')->with($subRequest)->will($this->returnValue([]));
|
||||
$logger->expects($this->exactly(2))->method('getLogs')->with($subRequest)->willReturn([]);
|
||||
|
||||
$c = new LoggerDataCollector($logger, __DIR__.'/', $stack);
|
||||
|
||||
@@ -94,8 +94,8 @@ class LoggerDataCollectorTest extends TestCase
|
||||
->getMockBuilder('Symfony\Component\HttpKernel\Log\DebugLoggerInterface')
|
||||
->setMethods(['countErrors', 'getLogs', 'clear'])
|
||||
->getMock();
|
||||
$logger->expects($this->once())->method('countErrors')->will($this->returnValue($nb));
|
||||
$logger->expects($this->exactly(2))->method('getLogs')->will($this->returnValue($logs));
|
||||
$logger->expects($this->once())->method('countErrors')->willReturn($nb);
|
||||
$logger->expects($this->exactly(2))->method('getLogs')->willReturn($logs);
|
||||
|
||||
$c = new LoggerDataCollector($logger);
|
||||
$c->lateCollect();
|
||||
|
||||
@@ -44,7 +44,7 @@ class TimeDataCollectorTest extends TestCase
|
||||
$this->assertEquals(0, $c->getStartTime());
|
||||
|
||||
$kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\KernelInterface')->getMock();
|
||||
$kernel->expects($this->once())->method('getStartTime')->will($this->returnValue(123456));
|
||||
$kernel->expects($this->once())->method('getStartTime')->willReturn(123456);
|
||||
|
||||
$c = new TimeDataCollector($kernel);
|
||||
$request = new Request();
|
||||
|
||||
@@ -50,7 +50,7 @@ class TraceableEventDispatcherTest extends TestCase
|
||||
->getMock();
|
||||
$stopwatch->expects($this->once())
|
||||
->method('isStarted')
|
||||
->will($this->returnValue(false));
|
||||
->willReturn(false);
|
||||
|
||||
$dispatcher = new TraceableEventDispatcher(new EventDispatcher(), $stopwatch);
|
||||
|
||||
@@ -66,7 +66,7 @@ class TraceableEventDispatcherTest extends TestCase
|
||||
->getMock();
|
||||
$stopwatch->expects($this->once())
|
||||
->method('isStarted')
|
||||
->will($this->returnValue(true));
|
||||
->willReturn(true);
|
||||
$stopwatch->expects($this->once())
|
||||
->method('stop');
|
||||
$stopwatch->expects($this->once())
|
||||
@@ -113,9 +113,9 @@ class TraceableEventDispatcherTest extends TestCase
|
||||
protected function getHttpKernel($dispatcher, $controller)
|
||||
{
|
||||
$controllerResolver = $this->getMockBuilder('Symfony\Component\HttpKernel\Controller\ControllerResolverInterface')->getMock();
|
||||
$controllerResolver->expects($this->once())->method('getController')->will($this->returnValue($controller));
|
||||
$controllerResolver->expects($this->once())->method('getController')->willReturn($controller);
|
||||
$argumentResolver = $this->getMockBuilder('Symfony\Component\HttpKernel\Controller\ArgumentResolverInterface')->getMock();
|
||||
$argumentResolver->expects($this->once())->method('getArguments')->will($this->returnValue([]));
|
||||
$argumentResolver->expects($this->once())->method('getArguments')->willReturn([]);
|
||||
|
||||
return new HttpKernel($dispatcher, $controllerResolver, new RequestStack(), $argumentResolver);
|
||||
}
|
||||
|
||||
@@ -21,15 +21,15 @@ class LazyLoadingFragmentHandlerTest extends TestCase
|
||||
public function testRender()
|
||||
{
|
||||
$renderer = $this->getMockBuilder('Symfony\Component\HttpKernel\Fragment\FragmentRendererInterface')->getMock();
|
||||
$renderer->expects($this->once())->method('getName')->will($this->returnValue('foo'));
|
||||
$renderer->expects($this->any())->method('render')->will($this->returnValue(new Response()));
|
||||
$renderer->expects($this->once())->method('getName')->willReturn('foo');
|
||||
$renderer->expects($this->any())->method('render')->willReturn(new Response());
|
||||
|
||||
$requestStack = $this->getMockBuilder('Symfony\Component\HttpFoundation\RequestStack')->getMock();
|
||||
$requestStack->expects($this->any())->method('getCurrentRequest')->will($this->returnValue(Request::create('/')));
|
||||
$requestStack->expects($this->any())->method('getCurrentRequest')->willReturn(Request::create('/'));
|
||||
|
||||
$container = $this->getMockBuilder('Psr\Container\ContainerInterface')->getMock();
|
||||
$container->expects($this->once())->method('has')->with('foo')->willReturn(true);
|
||||
$container->expects($this->once())->method('get')->will($this->returnValue($renderer));
|
||||
$container->expects($this->once())->method('get')->willReturn($renderer);
|
||||
|
||||
$handler = new LazyLoadingFragmentHandler($container, $requestStack, false);
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ class AddRequestFormatsListenerTest extends TestCase
|
||||
|
||||
$event->expects($this->any())
|
||||
->method('getRequest')
|
||||
->will($this->returnValue($request));
|
||||
->willReturn($request);
|
||||
|
||||
return $event;
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ class DebugHandlersListenerTest extends TestCase
|
||||
$dispatcher = new EventDispatcher();
|
||||
$listener = new DebugHandlersListener(null);
|
||||
$app = $this->getMockBuilder('Symfony\Component\Console\Application')->getMock();
|
||||
$app->expects($this->once())->method('getHelperSet')->will($this->returnValue(new HelperSet()));
|
||||
$app->expects($this->once())->method('getHelperSet')->willReturn(new HelperSet());
|
||||
$command = new Command(__FUNCTION__);
|
||||
$command->setApplication($app);
|
||||
$event = new ConsoleEvent($command, new ArgvInput(), new ConsoleOutput());
|
||||
@@ -104,6 +104,7 @@ class DebugHandlersListenerTest extends TestCase
|
||||
$xListeners = [
|
||||
KernelEvents::REQUEST => [[$listener, 'configure']],
|
||||
ConsoleEvents::COMMAND => [[$listener, 'configure']],
|
||||
KernelEvents::EXCEPTION => [[$listener, 'onKernelException']],
|
||||
];
|
||||
$this->assertSame($xListeners, $dispatcher->getListeners());
|
||||
|
||||
|
||||
@@ -116,9 +116,9 @@ class ExceptionListenerTest extends TestCase
|
||||
$listener = new ExceptionListener('foo', $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock());
|
||||
|
||||
$kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock();
|
||||
$kernel->expects($this->once())->method('handle')->will($this->returnCallback(function (Request $request) {
|
||||
$kernel->expects($this->once())->method('handle')->willReturnCallback(function (Request $request) {
|
||||
return new Response($request->getRequestFormat());
|
||||
}));
|
||||
});
|
||||
|
||||
$request = Request::create('/');
|
||||
$request->setRequestFormat('xml');
|
||||
@@ -134,9 +134,9 @@ class ExceptionListenerTest extends TestCase
|
||||
{
|
||||
$dispatcher = new EventDispatcher();
|
||||
$kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock();
|
||||
$kernel->expects($this->once())->method('handle')->will($this->returnCallback(function (Request $request) {
|
||||
$kernel->expects($this->once())->method('handle')->willReturnCallback(function (Request $request) {
|
||||
return new Response($request->getRequestFormat());
|
||||
}));
|
||||
});
|
||||
|
||||
$listener = new ExceptionListener('foo', $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock(), true);
|
||||
|
||||
@@ -155,25 +155,6 @@ class ExceptionListenerTest extends TestCase
|
||||
$this->assertFalse($response->headers->has('content-security-policy'), 'CSP header has been removed');
|
||||
$this->assertFalse($dispatcher->hasListeners(KernelEvents::RESPONSE), 'CSP removal listener has been removed');
|
||||
}
|
||||
|
||||
public function testNullController()
|
||||
{
|
||||
$listener = new ExceptionListener(null);
|
||||
$kernel = $this->getMockBuilder(HttpKernelInterface::class)->getMock();
|
||||
$kernel->expects($this->once())->method('handle')->will($this->returnCallback(function (Request $request) {
|
||||
$controller = $request->attributes->get('_controller');
|
||||
|
||||
return $controller();
|
||||
}));
|
||||
$request = Request::create('/');
|
||||
$event = new ExceptionEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST, new \Exception('foo'));
|
||||
|
||||
$listener->onKernelException($event);
|
||||
$this->assertNull($event->getResponse());
|
||||
|
||||
$listener->onKernelException($event);
|
||||
$this->assertContains('Whoops, looks like something went wrong.', $event->getResponse()->getContent());
|
||||
}
|
||||
}
|
||||
|
||||
class TestLogger extends Logger implements DebugLoggerInterface
|
||||
|
||||
@@ -73,7 +73,7 @@ class LocaleListenerTest extends TestCase
|
||||
$context->expects($this->once())->method('setParameter')->with('_locale', 'es');
|
||||
|
||||
$router = $this->getMockBuilder('Symfony\Component\Routing\Router')->setMethods(['getContext'])->disableOriginalConstructor()->getMock();
|
||||
$router->expects($this->once())->method('getContext')->will($this->returnValue($context));
|
||||
$router->expects($this->once())->method('getContext')->willReturn($context);
|
||||
|
||||
$request = Request::create('/');
|
||||
|
||||
@@ -89,12 +89,12 @@ class LocaleListenerTest extends TestCase
|
||||
$context->expects($this->once())->method('setParameter')->with('_locale', 'es');
|
||||
|
||||
$router = $this->getMockBuilder('Symfony\Component\Routing\Router')->setMethods(['getContext'])->disableOriginalConstructor()->getMock();
|
||||
$router->expects($this->once())->method('getContext')->will($this->returnValue($context));
|
||||
$router->expects($this->once())->method('getContext')->willReturn($context);
|
||||
|
||||
$parentRequest = Request::create('/');
|
||||
$parentRequest->setLocale('es');
|
||||
|
||||
$this->requestStack->expects($this->once())->method('getParentRequest')->will($this->returnValue($parentRequest));
|
||||
$this->requestStack->expects($this->once())->method('getParentRequest')->willReturn($parentRequest);
|
||||
|
||||
$event = $this->getMockBuilder('Symfony\Component\HttpKernel\Event\FinishRequestEvent')->disableOriginalConstructor()->getMock();
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ class ProfilerListenerTest extends TestCase
|
||||
|
||||
$profiler->expects($this->once())
|
||||
->method('collect')
|
||||
->will($this->returnValue($profile));
|
||||
->willReturn($profile);
|
||||
|
||||
$kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock();
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ class RouterListenerTest extends TestCase
|
||||
$context->setHttpsPort($defaultHttpsPort);
|
||||
$urlMatcher->expects($this->any())
|
||||
->method('getContext')
|
||||
->will($this->returnValue($context));
|
||||
->willReturn($context);
|
||||
|
||||
$listener = new RouterListener($urlMatcher, $this->requestStack);
|
||||
$event = $this->createRequestEventForUri($uri);
|
||||
@@ -97,7 +97,7 @@ class RouterListenerTest extends TestCase
|
||||
$requestMatcher->expects($this->once())
|
||||
->method('matchRequest')
|
||||
->with($this->isInstanceOf('Symfony\Component\HttpFoundation\Request'))
|
||||
->will($this->returnValue([]));
|
||||
->willReturn([]);
|
||||
|
||||
$listener = new RouterListener($requestMatcher, $this->requestStack, new RequestContext());
|
||||
$listener->onKernelRequest($event);
|
||||
@@ -113,7 +113,7 @@ class RouterListenerTest extends TestCase
|
||||
$requestMatcher->expects($this->any())
|
||||
->method('matchRequest')
|
||||
->with($this->isInstanceOf('Symfony\Component\HttpFoundation\Request'))
|
||||
->will($this->returnValue([]));
|
||||
->willReturn([]);
|
||||
|
||||
$context = new RequestContext();
|
||||
|
||||
@@ -138,7 +138,7 @@ class RouterListenerTest extends TestCase
|
||||
$requestMatcher = $this->getMockBuilder('Symfony\Component\Routing\Matcher\RequestMatcherInterface')->getMock();
|
||||
$requestMatcher->expects($this->once())
|
||||
->method('matchRequest')
|
||||
->will($this->returnValue($parameter));
|
||||
->willReturn($parameter);
|
||||
|
||||
$logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock();
|
||||
$logger->expects($this->once())
|
||||
|
||||
@@ -46,7 +46,7 @@ class TestSessionListenerTest extends TestCase
|
||||
$this->session = $this->getSession();
|
||||
$this->listener->expects($this->any())
|
||||
->method('getSession')
|
||||
->will($this->returnValue($this->session));
|
||||
->willReturn($this->session);
|
||||
}
|
||||
|
||||
public function testShouldSaveMasterRequestSession()
|
||||
@@ -183,28 +183,28 @@ class TestSessionListenerTest extends TestCase
|
||||
{
|
||||
$this->session->expects($this->once())
|
||||
->method('isStarted')
|
||||
->will($this->returnValue(true));
|
||||
->willReturn(true);
|
||||
}
|
||||
|
||||
private function sessionHasNotBeenStarted()
|
||||
{
|
||||
$this->session->expects($this->once())
|
||||
->method('isStarted')
|
||||
->will($this->returnValue(false));
|
||||
->willReturn(false);
|
||||
}
|
||||
|
||||
private function sessionIsEmpty()
|
||||
{
|
||||
$this->session->expects($this->once())
|
||||
->method('isEmpty')
|
||||
->will($this->returnValue(true));
|
||||
->willReturn(true);
|
||||
}
|
||||
|
||||
private function fixSessionId($sessionId)
|
||||
{
|
||||
$this->session->expects($this->any())
|
||||
->method('getId')
|
||||
->will($this->returnValue($sessionId));
|
||||
->willReturn($sessionId);
|
||||
}
|
||||
|
||||
private function getSession()
|
||||
@@ -214,7 +214,7 @@ class TestSessionListenerTest extends TestCase
|
||||
->getMock();
|
||||
|
||||
// set return value for getName()
|
||||
$mock->expects($this->any())->method('getName')->will($this->returnValue('MOCKSESSID'));
|
||||
$mock->expects($this->any())->method('getName')->willReturn('MOCKSESSID');
|
||||
|
||||
return $mock;
|
||||
}
|
||||
|
||||
@@ -117,6 +117,6 @@ class TranslatorListenerTest extends TestCase
|
||||
$this->requestStack
|
||||
->expects($this->any())
|
||||
->method('getParentRequest')
|
||||
->will($this->returnValue($request));
|
||||
->willReturn($request);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ class FragmentHandlerTest extends TestCase
|
||||
$this->requestStack
|
||||
->expects($this->any())
|
||||
->method('getCurrentRequest')
|
||||
->will($this->returnValue(Request::create('/')))
|
||||
->willReturn(Request::create('/'))
|
||||
;
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ class FragmentHandlerTest extends TestCase
|
||||
$renderer
|
||||
->expects($this->any())
|
||||
->method('getName')
|
||||
->will($this->returnValue('foo'))
|
||||
->willReturn('foo')
|
||||
;
|
||||
$e = $renderer
|
||||
->expects($this->any())
|
||||
|
||||
@@ -124,18 +124,18 @@ class InlineFragmentRendererTest extends TestCase
|
||||
$controllerResolver
|
||||
->expects($this->once())
|
||||
->method('getController')
|
||||
->will($this->returnValue(function () {
|
||||
->willReturn(function () {
|
||||
ob_start();
|
||||
echo 'bar';
|
||||
throw new \RuntimeException();
|
||||
}))
|
||||
})
|
||||
;
|
||||
|
||||
$argumentResolver = $this->getMockBuilder('Symfony\\Component\\HttpKernel\\Controller\\ArgumentResolverInterface')->getMock();
|
||||
$argumentResolver
|
||||
->expects($this->once())
|
||||
->method('getArguments')
|
||||
->will($this->returnValue([]))
|
||||
->willReturn([])
|
||||
;
|
||||
|
||||
$kernel = new HttpKernel(new EventDispatcher(), $controllerResolver, new RequestStack(), $argumentResolver);
|
||||
|
||||
@@ -229,7 +229,7 @@ class EsiTest extends TestCase
|
||||
$cache = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpCache\HttpCache')->setMethods(['getRequest', 'handle'])->disableOriginalConstructor()->getMock();
|
||||
$cache->expects($this->any())
|
||||
->method('getRequest')
|
||||
->will($this->returnValue($request))
|
||||
->willReturn($request)
|
||||
;
|
||||
if (\is_array($response)) {
|
||||
$cache->expects($this->any())
|
||||
@@ -239,7 +239,7 @@ class EsiTest extends TestCase
|
||||
} else {
|
||||
$cache->expects($this->any())
|
||||
->method('handle')
|
||||
->will($this->returnValue($response))
|
||||
->willReturn($response)
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
@@ -196,7 +196,7 @@ class SsiTest extends TestCase
|
||||
$cache = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpCache\HttpCache')->setMethods(['getRequest', 'handle'])->disableOriginalConstructor()->getMock();
|
||||
$cache->expects($this->any())
|
||||
->method('getRequest')
|
||||
->will($this->returnValue($request))
|
||||
->willReturn($request)
|
||||
;
|
||||
if (\is_array($response)) {
|
||||
$cache->expects($this->any())
|
||||
@@ -206,7 +206,7 @@ class SsiTest extends TestCase
|
||||
} else {
|
||||
$cache->expects($this->any())
|
||||
->method('handle')
|
||||
->will($this->returnValue($response))
|
||||
->willReturn($response)
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
@@ -156,11 +156,11 @@ class HttpKernelBrowserTest extends TestCase
|
||||
/* should be modified when the getClientSize will be removed */
|
||||
$file->expects($this->any())
|
||||
->method('getSize')
|
||||
->will($this->returnValue(INF))
|
||||
->willReturn(INF)
|
||||
;
|
||||
$file->expects($this->any())
|
||||
->method('getClientSize')
|
||||
->will($this->returnValue(INF))
|
||||
->willReturn(INF)
|
||||
;
|
||||
|
||||
$client->request('POST', '/', [], [$file]);
|
||||
|
||||
@@ -351,13 +351,13 @@ class HttpKernelTest extends TestCase
|
||||
$controllerResolver
|
||||
->expects($this->any())
|
||||
->method('getController')
|
||||
->will($this->returnValue($controller));
|
||||
->willReturn($controller);
|
||||
|
||||
$argumentResolver = $this->getMockBuilder(ArgumentResolverInterface::class)->getMock();
|
||||
$argumentResolver
|
||||
->expects($this->any())
|
||||
->method('getArguments')
|
||||
->will($this->returnValue($arguments));
|
||||
->willReturn($arguments);
|
||||
|
||||
return new HttpKernel($eventDispatcher, $controllerResolver, $requestStack, $argumentResolver);
|
||||
}
|
||||
|
||||
30
vendor/symfony/http-kernel/Tests/KernelTest.php
vendored
30
vendor/symfony/http-kernel/Tests/KernelTest.php
vendored
@@ -123,7 +123,7 @@ class KernelTest extends TestCase
|
||||
$kernel = $this->getKernel(['initializeBundles', 'initializeContainer', 'getBundles']);
|
||||
$kernel->expects($this->once())
|
||||
->method('getBundles')
|
||||
->will($this->returnValue([$bundle]));
|
||||
->willReturn([$bundle]);
|
||||
|
||||
$kernel->boot();
|
||||
}
|
||||
@@ -178,7 +178,7 @@ class KernelTest extends TestCase
|
||||
$kernel = $this->getKernel(['getBundles']);
|
||||
$kernel->expects($this->any())
|
||||
->method('getBundles')
|
||||
->will($this->returnValue([$bundle]));
|
||||
->willReturn([$bundle]);
|
||||
|
||||
$kernel->boot();
|
||||
$kernel->shutdown();
|
||||
@@ -201,7 +201,7 @@ class KernelTest extends TestCase
|
||||
$kernel = $this->getKernel(['getHttpKernel']);
|
||||
$kernel->expects($this->once())
|
||||
->method('getHttpKernel')
|
||||
->will($this->returnValue($httpKernelMock));
|
||||
->willReturn($httpKernelMock);
|
||||
|
||||
$kernel->handle($request, $type, $catch);
|
||||
}
|
||||
@@ -219,7 +219,7 @@ class KernelTest extends TestCase
|
||||
$kernel = $this->getKernel(['getHttpKernel', 'boot']);
|
||||
$kernel->expects($this->once())
|
||||
->method('getHttpKernel')
|
||||
->will($this->returnValue($httpKernelMock));
|
||||
->willReturn($httpKernelMock);
|
||||
|
||||
$kernel->expects($this->once())
|
||||
->method('boot');
|
||||
@@ -381,7 +381,7 @@ EOF;
|
||||
$kernel
|
||||
->expects($this->once())
|
||||
->method('getBundle')
|
||||
->will($this->returnValue($this->getBundle(__DIR__.'/Fixtures/Bundle1Bundle')))
|
||||
->willReturn($this->getBundle(__DIR__.'/Fixtures/Bundle1Bundle'))
|
||||
;
|
||||
|
||||
$kernel->locateResource('@Bundle1Bundle/config/routing.xml');
|
||||
@@ -393,7 +393,7 @@ EOF;
|
||||
$kernel
|
||||
->expects($this->once())
|
||||
->method('getBundle')
|
||||
->will($this->returnValue($this->getBundle(__DIR__.'/Fixtures/Bundle1Bundle')))
|
||||
->willReturn($this->getBundle(__DIR__.'/Fixtures/Bundle1Bundle'))
|
||||
;
|
||||
|
||||
$this->assertEquals(__DIR__.'/Fixtures/Bundle1Bundle/foo.txt', $kernel->locateResource('@Bundle1Bundle/foo.txt'));
|
||||
@@ -405,7 +405,7 @@ EOF;
|
||||
$kernel
|
||||
->expects($this->once())
|
||||
->method('getBundle')
|
||||
->will($this->returnValue($this->getBundle(__DIR__.'/Fixtures/Bundle1Bundle')))
|
||||
->willReturn($this->getBundle(__DIR__.'/Fixtures/Bundle1Bundle'))
|
||||
;
|
||||
|
||||
$this->assertEquals(
|
||||
@@ -420,7 +420,7 @@ EOF;
|
||||
$kernel
|
||||
->expects($this->once())
|
||||
->method('getBundle')
|
||||
->will($this->returnValue($this->getBundle(__DIR__.'/Fixtures/FooBundle', null, null, 'FooBundle')))
|
||||
->willReturn($this->getBundle(__DIR__.'/Fixtures/FooBundle', null, null, 'FooBundle'))
|
||||
;
|
||||
|
||||
$this->assertEquals(
|
||||
@@ -435,7 +435,7 @@ EOF;
|
||||
$kernel
|
||||
->expects($this->exactly(2))
|
||||
->method('getBundle')
|
||||
->will($this->returnValue($this->getBundle(__DIR__.'/Fixtures/FooBundle', null, null, 'FooBundle')))
|
||||
->willReturn($this->getBundle(__DIR__.'/Fixtures/FooBundle', null, null, 'FooBundle'))
|
||||
;
|
||||
|
||||
$this->assertEquals(
|
||||
@@ -451,7 +451,7 @@ EOF;
|
||||
$kernel
|
||||
->expects($this->exactly(2))
|
||||
->method('getBundle')
|
||||
->will($this->returnValue($this->getBundle(__DIR__.'/Fixtures/Bundle1Bundle', null, null, 'Bundle1Bundle')))
|
||||
->willReturn($this->getBundle(__DIR__.'/Fixtures/Bundle1Bundle', null, null, 'Bundle1Bundle'))
|
||||
;
|
||||
|
||||
$this->assertEquals(
|
||||
@@ -514,7 +514,7 @@ EOF;
|
||||
$kernel = $this->getKernel(['getHttpKernel']);
|
||||
$kernel->expects($this->exactly(2))
|
||||
->method('getHttpKernel')
|
||||
->will($this->returnValue($httpKernelMock));
|
||||
->willReturn($httpKernelMock);
|
||||
|
||||
$kernel->boot();
|
||||
$kernel->terminate(Request::create('/'), new Response());
|
||||
@@ -640,19 +640,19 @@ EOF;
|
||||
$bundle
|
||||
->expects($this->any())
|
||||
->method('getName')
|
||||
->will($this->returnValue(null === $bundleName ? \get_class($bundle) : $bundleName))
|
||||
->willReturn(null === $bundleName ? \get_class($bundle) : $bundleName)
|
||||
;
|
||||
|
||||
$bundle
|
||||
->expects($this->any())
|
||||
->method('getPath')
|
||||
->will($this->returnValue($dir))
|
||||
->willReturn($dir)
|
||||
;
|
||||
|
||||
$bundle
|
||||
->expects($this->any())
|
||||
->method('getParent')
|
||||
->will($this->returnValue($parent))
|
||||
->willReturn($parent)
|
||||
;
|
||||
|
||||
return $bundle;
|
||||
@@ -678,7 +678,7 @@ EOF;
|
||||
;
|
||||
$kernel->expects($this->any())
|
||||
->method('registerBundles')
|
||||
->will($this->returnValue($bundles))
|
||||
->willReturn($bundles)
|
||||
;
|
||||
$p = new \ReflectionProperty($kernel, 'rootDir');
|
||||
$p->setAccessible(true);
|
||||
|
||||
@@ -149,7 +149,7 @@ class LoggerTest extends TestCase
|
||||
}
|
||||
$dummy->expects($this->atLeastOnce())
|
||||
->method('__toString')
|
||||
->will($this->returnValue('DUMMY'));
|
||||
->willReturn('DUMMY');
|
||||
|
||||
$this->logger->warning($dummy);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user