提交代码
This commit is contained in:
13
vendor/symfony/http-kernel/Tests/Exception/AccessDeniedHttpExceptionTest.php
vendored
Normal file
13
vendor/symfony/http-kernel/Tests/Exception/AccessDeniedHttpExceptionTest.php
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Symfony\Component\HttpKernel\Tests\Exception;
|
||||
|
||||
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
||||
|
||||
class AccessDeniedHttpExceptionTest extends HttpExceptionTest
|
||||
{
|
||||
protected function createException(string $message = null, \Throwable $previous = null, ?int $code = 0, array $headers = [])
|
||||
{
|
||||
return new AccessDeniedHttpException($message, $previous, $code, $headers);
|
||||
}
|
||||
}
|
||||
13
vendor/symfony/http-kernel/Tests/Exception/BadRequestHttpExceptionTest.php
vendored
Normal file
13
vendor/symfony/http-kernel/Tests/Exception/BadRequestHttpExceptionTest.php
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Symfony\Component\HttpKernel\Tests\Exception;
|
||||
|
||||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
||||
|
||||
class BadRequestHttpExceptionTest extends HttpExceptionTest
|
||||
{
|
||||
protected function createException(string $message = null, \Throwable $previous = null, ?int $code = 0, array $headers = [])
|
||||
{
|
||||
return new BadRequestHttpException($message, $previous, $code, $headers);
|
||||
}
|
||||
}
|
||||
13
vendor/symfony/http-kernel/Tests/Exception/ConflictHttpExceptionTest.php
vendored
Normal file
13
vendor/symfony/http-kernel/Tests/Exception/ConflictHttpExceptionTest.php
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Symfony\Component\HttpKernel\Tests\Exception;
|
||||
|
||||
use Symfony\Component\HttpKernel\Exception\ConflictHttpException;
|
||||
|
||||
class ConflictHttpExceptionTest extends HttpExceptionTest
|
||||
{
|
||||
protected function createException(string $message = null, \Throwable $previous = null, ?int $code = 0, array $headers = [])
|
||||
{
|
||||
return new ConflictHttpException($message, $previous, $code, $headers);
|
||||
}
|
||||
}
|
||||
13
vendor/symfony/http-kernel/Tests/Exception/GoneHttpExceptionTest.php
vendored
Normal file
13
vendor/symfony/http-kernel/Tests/Exception/GoneHttpExceptionTest.php
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Symfony\Component\HttpKernel\Tests\Exception;
|
||||
|
||||
use Symfony\Component\HttpKernel\Exception\GoneHttpException;
|
||||
|
||||
class GoneHttpExceptionTest extends HttpExceptionTest
|
||||
{
|
||||
protected function createException(string $message = null, \Throwable $previous = null, ?int $code = 0, array $headers = [])
|
||||
{
|
||||
return new GoneHttpException($message, $previous, $code, $headers);
|
||||
}
|
||||
}
|
||||
61
vendor/symfony/http-kernel/Tests/Exception/HttpExceptionTest.php
vendored
Normal file
61
vendor/symfony/http-kernel/Tests/Exception/HttpExceptionTest.php
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace Symfony\Component\HttpKernel\Tests\Exception;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\HttpKernel\Exception\HttpException;
|
||||
|
||||
class HttpExceptionTest extends TestCase
|
||||
{
|
||||
public function headerDataProvider()
|
||||
{
|
||||
return [
|
||||
[['X-Test' => 'Test']],
|
||||
[['X-Test' => 1]],
|
||||
[
|
||||
[
|
||||
['X-Test' => 'Test'],
|
||||
['X-Test-2' => 'Test-2'],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
public function testHeadersDefault()
|
||||
{
|
||||
$exception = $this->createException();
|
||||
$this->assertSame([], $exception->getHeaders());
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider headerDataProvider
|
||||
*/
|
||||
public function testHeadersConstructor($headers)
|
||||
{
|
||||
$exception = new HttpException(200, null, null, $headers);
|
||||
$this->assertSame($headers, $exception->getHeaders());
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider headerDataProvider
|
||||
*/
|
||||
public function testHeadersSetter($headers)
|
||||
{
|
||||
$exception = $this->createException();
|
||||
$exception->setHeaders($headers);
|
||||
$this->assertSame($headers, $exception->getHeaders());
|
||||
}
|
||||
|
||||
public function testThrowableIsAllowedForPrevious()
|
||||
{
|
||||
$previous = new class('Error of PHP 7+') extends \Error {
|
||||
};
|
||||
$exception = $this->createException(null, $previous);
|
||||
$this->assertSame($previous, $exception->getPrevious());
|
||||
}
|
||||
|
||||
protected function createException(string $message = null, \Throwable $previous = null, ?int $code = 0, array $headers = [])
|
||||
{
|
||||
return new HttpException(200, $message, $previous, $headers, $code);
|
||||
}
|
||||
}
|
||||
13
vendor/symfony/http-kernel/Tests/Exception/LengthRequiredHttpExceptionTest.php
vendored
Normal file
13
vendor/symfony/http-kernel/Tests/Exception/LengthRequiredHttpExceptionTest.php
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Symfony\Component\HttpKernel\Tests\Exception;
|
||||
|
||||
use Symfony\Component\HttpKernel\Exception\LengthRequiredHttpException;
|
||||
|
||||
class LengthRequiredHttpExceptionTest extends HttpExceptionTest
|
||||
{
|
||||
protected function createException(string $message = null, \Throwable $previous = null, ?int $code = 0, array $headers = [])
|
||||
{
|
||||
return new LengthRequiredHttpException($message, $previous, $code, $headers);
|
||||
}
|
||||
}
|
||||
42
vendor/symfony/http-kernel/Tests/Exception/MethodNotAllowedHttpExceptionTest.php
vendored
Normal file
42
vendor/symfony/http-kernel/Tests/Exception/MethodNotAllowedHttpExceptionTest.php
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace Symfony\Component\HttpKernel\Tests\Exception;
|
||||
|
||||
use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException;
|
||||
|
||||
class MethodNotAllowedHttpExceptionTest extends HttpExceptionTest
|
||||
{
|
||||
public function testHeadersDefault()
|
||||
{
|
||||
$exception = new MethodNotAllowedHttpException(['GET', 'PUT']);
|
||||
$this->assertSame(['Allow' => 'GET, PUT'], $exception->getHeaders());
|
||||
}
|
||||
|
||||
public function testWithHeaderConstruct()
|
||||
{
|
||||
$headers = [
|
||||
'Cache-Control' => 'public, s-maxage=1200',
|
||||
];
|
||||
|
||||
$exception = new MethodNotAllowedHttpException(['get'], null, null, null, $headers);
|
||||
|
||||
$headers['Allow'] = 'GET';
|
||||
|
||||
$this->assertSame($headers, $exception->getHeaders());
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider headerDataProvider
|
||||
*/
|
||||
public function testHeadersSetter($headers)
|
||||
{
|
||||
$exception = new MethodNotAllowedHttpException(['GET']);
|
||||
$exception->setHeaders($headers);
|
||||
$this->assertSame($headers, $exception->getHeaders());
|
||||
}
|
||||
|
||||
protected function createException(string $message = null, \Throwable $previous = null, ?int $code = 0, array $headers = [])
|
||||
{
|
||||
return new MethodNotAllowedHttpException(['get'], $message, $previous, $code, $headers);
|
||||
}
|
||||
}
|
||||
13
vendor/symfony/http-kernel/Tests/Exception/NotAcceptableHttpExceptionTest.php
vendored
Normal file
13
vendor/symfony/http-kernel/Tests/Exception/NotAcceptableHttpExceptionTest.php
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Symfony\Component\HttpKernel\Tests\Exception;
|
||||
|
||||
use Symfony\Component\HttpKernel\Exception\NotAcceptableHttpException;
|
||||
|
||||
class NotAcceptableHttpExceptionTest extends HttpExceptionTest
|
||||
{
|
||||
protected function createException(string $message = null, \Throwable $previous = null, ?int $code = 0, array $headers = [])
|
||||
{
|
||||
return new NotAcceptableHttpException($message, $previous, $code, $headers);
|
||||
}
|
||||
}
|
||||
13
vendor/symfony/http-kernel/Tests/Exception/NotFoundHttpExceptionTest.php
vendored
Normal file
13
vendor/symfony/http-kernel/Tests/Exception/NotFoundHttpExceptionTest.php
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Symfony\Component\HttpKernel\Tests\Exception;
|
||||
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
|
||||
class NotFoundHttpExceptionTest extends HttpExceptionTest
|
||||
{
|
||||
protected function createException(string $message = null, \Throwable $previous = null, ?int $code = 0, array $headers = [])
|
||||
{
|
||||
return new NotFoundHttpException($message, $previous, $code, $headers);
|
||||
}
|
||||
}
|
||||
13
vendor/symfony/http-kernel/Tests/Exception/PreconditionFailedHttpExceptionTest.php
vendored
Normal file
13
vendor/symfony/http-kernel/Tests/Exception/PreconditionFailedHttpExceptionTest.php
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Symfony\Component\HttpKernel\Tests\Exception;
|
||||
|
||||
use Symfony\Component\HttpKernel\Exception\PreconditionFailedHttpException;
|
||||
|
||||
class PreconditionFailedHttpExceptionTest extends HttpExceptionTest
|
||||
{
|
||||
protected function createException(string $message = null, \Throwable $previous = null, ?int $code = 0, array $headers = [])
|
||||
{
|
||||
return new PreconditionFailedHttpException($message, $previous, $code, $headers);
|
||||
}
|
||||
}
|
||||
13
vendor/symfony/http-kernel/Tests/Exception/PreconditionRequiredHttpExceptionTest.php
vendored
Normal file
13
vendor/symfony/http-kernel/Tests/Exception/PreconditionRequiredHttpExceptionTest.php
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Symfony\Component\HttpKernel\Tests\Exception;
|
||||
|
||||
use Symfony\Component\HttpKernel\Exception\PreconditionRequiredHttpException;
|
||||
|
||||
class PreconditionRequiredHttpExceptionTest extends HttpExceptionTest
|
||||
{
|
||||
protected function createException(string $message = null, \Throwable $previous = null, ?int $code = 0, array $headers = [])
|
||||
{
|
||||
return new PreconditionRequiredHttpException($message, $previous, $code, $headers);
|
||||
}
|
||||
}
|
||||
42
vendor/symfony/http-kernel/Tests/Exception/ServiceUnavailableHttpExceptionTest.php
vendored
Normal file
42
vendor/symfony/http-kernel/Tests/Exception/ServiceUnavailableHttpExceptionTest.php
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace Symfony\Component\HttpKernel\Tests\Exception;
|
||||
|
||||
use Symfony\Component\HttpKernel\Exception\ServiceUnavailableHttpException;
|
||||
|
||||
class ServiceUnavailableHttpExceptionTest extends HttpExceptionTest
|
||||
{
|
||||
public function testHeadersDefaultRetryAfter()
|
||||
{
|
||||
$exception = new ServiceUnavailableHttpException(10);
|
||||
$this->assertSame(['Retry-After' => 10], $exception->getHeaders());
|
||||
}
|
||||
|
||||
public function testWithHeaderConstruct()
|
||||
{
|
||||
$headers = [
|
||||
'Cache-Control' => 'public, s-maxage=1337',
|
||||
];
|
||||
|
||||
$exception = new ServiceUnavailableHttpException(1337, null, null, null, $headers);
|
||||
|
||||
$headers['Retry-After'] = 1337;
|
||||
|
||||
$this->assertSame($headers, $exception->getHeaders());
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider headerDataProvider
|
||||
*/
|
||||
public function testHeadersSetter($headers)
|
||||
{
|
||||
$exception = new ServiceUnavailableHttpException(10);
|
||||
$exception->setHeaders($headers);
|
||||
$this->assertSame($headers, $exception->getHeaders());
|
||||
}
|
||||
|
||||
protected function createException(string $message = null, \Throwable $previous = null, ?int $code = 0, array $headers = [])
|
||||
{
|
||||
return new ServiceUnavailableHttpException(null, $message, $previous, $code, $headers);
|
||||
}
|
||||
}
|
||||
42
vendor/symfony/http-kernel/Tests/Exception/TooManyRequestsHttpExceptionTest.php
vendored
Normal file
42
vendor/symfony/http-kernel/Tests/Exception/TooManyRequestsHttpExceptionTest.php
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace Symfony\Component\HttpKernel\Tests\Exception;
|
||||
|
||||
use Symfony\Component\HttpKernel\Exception\TooManyRequestsHttpException;
|
||||
|
||||
class TooManyRequestsHttpExceptionTest extends HttpExceptionTest
|
||||
{
|
||||
public function testHeadersDefaultRertyAfter()
|
||||
{
|
||||
$exception = new TooManyRequestsHttpException(10);
|
||||
$this->assertSame(['Retry-After' => 10], $exception->getHeaders());
|
||||
}
|
||||
|
||||
public function testWithHeaderConstruct()
|
||||
{
|
||||
$headers = [
|
||||
'Cache-Control' => 'public, s-maxage=69',
|
||||
];
|
||||
|
||||
$exception = new TooManyRequestsHttpException(69, null, null, null, $headers);
|
||||
|
||||
$headers['Retry-After'] = 69;
|
||||
|
||||
$this->assertSame($headers, $exception->getHeaders());
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider headerDataProvider
|
||||
*/
|
||||
public function testHeadersSetter($headers)
|
||||
{
|
||||
$exception = new TooManyRequestsHttpException(10);
|
||||
$exception->setHeaders($headers);
|
||||
$this->assertSame($headers, $exception->getHeaders());
|
||||
}
|
||||
|
||||
protected function createException(string $message = null, \Throwable $previous = null, ?int $code = 0, array $headers = [])
|
||||
{
|
||||
return new TooManyRequestsHttpException(null, $message, $previous, $code, $headers);
|
||||
}
|
||||
}
|
||||
42
vendor/symfony/http-kernel/Tests/Exception/UnauthorizedHttpExceptionTest.php
vendored
Normal file
42
vendor/symfony/http-kernel/Tests/Exception/UnauthorizedHttpExceptionTest.php
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace Symfony\Component\HttpKernel\Tests\Exception;
|
||||
|
||||
use Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException;
|
||||
|
||||
class UnauthorizedHttpExceptionTest extends HttpExceptionTest
|
||||
{
|
||||
public function testHeadersDefault()
|
||||
{
|
||||
$exception = new UnauthorizedHttpException('Challenge');
|
||||
$this->assertSame(['WWW-Authenticate' => 'Challenge'], $exception->getHeaders());
|
||||
}
|
||||
|
||||
public function testWithHeaderConstruct()
|
||||
{
|
||||
$headers = [
|
||||
'Cache-Control' => 'public, s-maxage=1200',
|
||||
];
|
||||
|
||||
$exception = new UnauthorizedHttpException('Challenge', null, null, null, $headers);
|
||||
|
||||
$headers['WWW-Authenticate'] = 'Challenge';
|
||||
|
||||
$this->assertSame($headers, $exception->getHeaders());
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider headerDataProvider
|
||||
*/
|
||||
public function testHeadersSetter($headers)
|
||||
{
|
||||
$exception = new UnauthorizedHttpException('Challenge');
|
||||
$exception->setHeaders($headers);
|
||||
$this->assertSame($headers, $exception->getHeaders());
|
||||
}
|
||||
|
||||
protected function createException(string $message = null, \Throwable $previous = null, ?int $code = 0, array $headers = [])
|
||||
{
|
||||
return new UnauthorizedHttpException('Challenge', $message, $previous, $code, $headers);
|
||||
}
|
||||
}
|
||||
13
vendor/symfony/http-kernel/Tests/Exception/UnprocessableEntityHttpExceptionTest.php
vendored
Normal file
13
vendor/symfony/http-kernel/Tests/Exception/UnprocessableEntityHttpExceptionTest.php
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Symfony\Component\HttpKernel\Tests\Exception;
|
||||
|
||||
use Symfony\Component\HttpKernel\Exception\UnprocessableEntityHttpException;
|
||||
|
||||
class UnprocessableEntityHttpExceptionTest extends HttpExceptionTest
|
||||
{
|
||||
protected function createException(string $message = null, \Throwable $previous = null, ?int $code = 0, array $headers = [])
|
||||
{
|
||||
return new UnprocessableEntityHttpException($message, $previous, $code, $headers);
|
||||
}
|
||||
}
|
||||
13
vendor/symfony/http-kernel/Tests/Exception/UnsupportedMediaTypeHttpExceptionTest.php
vendored
Normal file
13
vendor/symfony/http-kernel/Tests/Exception/UnsupportedMediaTypeHttpExceptionTest.php
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Symfony\Component\HttpKernel\Tests\Exception;
|
||||
|
||||
use Symfony\Component\HttpKernel\Exception\UnsupportedMediaTypeHttpException;
|
||||
|
||||
class UnsupportedMediaTypeHttpExceptionTest extends HttpExceptionTest
|
||||
{
|
||||
protected function createException(string $message = null, \Throwable $previous = null, ?int $code = 0, array $headers = [])
|
||||
{
|
||||
return new UnsupportedMediaTypeHttpException($message, $previous, $code, $headers);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user