Initial Commit

This commit is contained in:
2018-10-15 00:37:28 -05:00
commit b0bd5569c0
7508 changed files with 849336 additions and 0 deletions

View 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()
{
return new AccessDeniedHttpException();
}
}

View 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()
{
return new BadRequestHttpException();
}
}

View 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()
{
return new ConflictHttpException();
}
}

View 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()
{
return new GoneHttpException();
}
}

View File

@@ -0,0 +1,53 @@
<?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 array(
array(array('X-Test' => 'Test')),
array(array('X-Test' => 1)),
array(
array(
array('X-Test' => 'Test'),
array('X-Test-2' => 'Test-2'),
),
),
);
}
public function testHeadersDefault()
{
$exception = $this->createException();
$this->assertSame(array(), $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());
}
protected function createException()
{
return new HttpException(200);
}
}

View 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()
{
return new LengthRequiredHttpException();
}
}

View File

@@ -0,0 +1,37 @@
<?php
namespace Symfony\Component\HttpKernel\Tests\Exception;
use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException;
class MethodNotAllowedHttpExceptionTest extends HttpExceptionTest
{
public function testHeadersDefault()
{
$exception = new MethodNotAllowedHttpException(array('GET', 'PUT'));
$this->assertSame(array('Allow' => 'GET, PUT'), $exception->getHeaders());
}
public function testWithHeaderConstruct()
{
$headers = array(
'Cache-Control' => 'public, s-maxage=1200',
);
$exception = new MethodNotAllowedHttpException(array('get'), null, null, null, $headers);
$headers['Allow'] = 'GET';
$this->assertSame($headers, $exception->getHeaders());
}
/**
* @dataProvider headerDataProvider
*/
public function testHeadersSetter($headers)
{
$exception = new MethodNotAllowedHttpException(array('GET'));
$exception->setHeaders($headers);
$this->assertSame($headers, $exception->getHeaders());
}
}

View 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()
{
return new NotAcceptableHttpException();
}
}

View 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()
{
return new NotFoundHttpException();
}
}

View 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()
{
return new PreconditionFailedHttpException();
}
}

View 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()
{
return new PreconditionRequiredHttpException();
}
}

View 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(array('Retry-After' => 10), $exception->getHeaders());
}
public function testWithHeaderConstruct()
{
$headers = array(
'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()
{
return new ServiceUnavailableHttpException();
}
}

View 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(array('Retry-After' => 10), $exception->getHeaders());
}
public function testWithHeaderConstruct()
{
$headers = array(
'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()
{
return new TooManyRequestsHttpException();
}
}

View File

@@ -0,0 +1,37 @@
<?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(array('WWW-Authenticate' => 'Challenge'), $exception->getHeaders());
}
public function testWithHeaderConstruct()
{
$headers = array(
'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());
}
}

View 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()
{
return new UnprocessableEntityHttpException();
}
}

View 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()
{
return new UnsupportedMediaTypeHttpException();
}
}