summaryrefslogtreecommitdiff
path: root/vendor/symfony/http-kernel/Tests/Exception
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/symfony/http-kernel/Tests/Exception')
-rw-r--r--vendor/symfony/http-kernel/Tests/Exception/AccessDeniedHttpExceptionTest.php13
-rw-r--r--vendor/symfony/http-kernel/Tests/Exception/BadRequestHttpExceptionTest.php13
-rw-r--r--vendor/symfony/http-kernel/Tests/Exception/ConflictHttpExceptionTest.php13
-rw-r--r--vendor/symfony/http-kernel/Tests/Exception/GoneHttpExceptionTest.php13
-rw-r--r--vendor/symfony/http-kernel/Tests/Exception/HttpExceptionTest.php53
-rw-r--r--vendor/symfony/http-kernel/Tests/Exception/LengthRequiredHttpExceptionTest.php13
-rw-r--r--vendor/symfony/http-kernel/Tests/Exception/MethodNotAllowedHttpExceptionTest.php24
-rw-r--r--vendor/symfony/http-kernel/Tests/Exception/NotAcceptableHttpExceptionTest.php13
-rw-r--r--vendor/symfony/http-kernel/Tests/Exception/NotFoundHttpExceptionTest.php13
-rw-r--r--vendor/symfony/http-kernel/Tests/Exception/PreconditionFailedHttpExceptionTest.php13
-rw-r--r--vendor/symfony/http-kernel/Tests/Exception/PreconditionRequiredHttpExceptionTest.php13
-rw-r--r--vendor/symfony/http-kernel/Tests/Exception/ServiceUnavailableHttpExceptionTest.php29
-rw-r--r--vendor/symfony/http-kernel/Tests/Exception/TooManyRequestsHttpExceptionTest.php29
-rw-r--r--vendor/symfony/http-kernel/Tests/Exception/UnauthorizedHttpExceptionTest.php24
-rw-r--r--vendor/symfony/http-kernel/Tests/Exception/UnprocessableEntityHttpExceptionTest.php28
-rw-r--r--vendor/symfony/http-kernel/Tests/Exception/UnsupportedMediaTypeHttpExceptionTest.php23
16 files changed, 327 insertions, 0 deletions
diff --git a/vendor/symfony/http-kernel/Tests/Exception/AccessDeniedHttpExceptionTest.php b/vendor/symfony/http-kernel/Tests/Exception/AccessDeniedHttpExceptionTest.php
new file mode 100644
index 0000000000..2bfcb2bf80
--- /dev/null
+++ b/vendor/symfony/http-kernel/Tests/Exception/AccessDeniedHttpExceptionTest.php
@@ -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();
+ }
+}
diff --git a/vendor/symfony/http-kernel/Tests/Exception/BadRequestHttpExceptionTest.php b/vendor/symfony/http-kernel/Tests/Exception/BadRequestHttpExceptionTest.php
new file mode 100644
index 0000000000..5fd54ccf44
--- /dev/null
+++ b/vendor/symfony/http-kernel/Tests/Exception/BadRequestHttpExceptionTest.php
@@ -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();
+ }
+}
diff --git a/vendor/symfony/http-kernel/Tests/Exception/ConflictHttpExceptionTest.php b/vendor/symfony/http-kernel/Tests/Exception/ConflictHttpExceptionTest.php
new file mode 100644
index 0000000000..63cb49e6e0
--- /dev/null
+++ b/vendor/symfony/http-kernel/Tests/Exception/ConflictHttpExceptionTest.php
@@ -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();
+ }
+}
diff --git a/vendor/symfony/http-kernel/Tests/Exception/GoneHttpExceptionTest.php b/vendor/symfony/http-kernel/Tests/Exception/GoneHttpExceptionTest.php
new file mode 100644
index 0000000000..ec5339d2af
--- /dev/null
+++ b/vendor/symfony/http-kernel/Tests/Exception/GoneHttpExceptionTest.php
@@ -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();
+ }
+}
diff --git a/vendor/symfony/http-kernel/Tests/Exception/HttpExceptionTest.php b/vendor/symfony/http-kernel/Tests/Exception/HttpExceptionTest.php
new file mode 100644
index 0000000000..b64773551e
--- /dev/null
+++ b/vendor/symfony/http-kernel/Tests/Exception/HttpExceptionTest.php
@@ -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);
+ }
+}
diff --git a/vendor/symfony/http-kernel/Tests/Exception/LengthRequiredHttpExceptionTest.php b/vendor/symfony/http-kernel/Tests/Exception/LengthRequiredHttpExceptionTest.php
new file mode 100644
index 0000000000..462d3ca4fc
--- /dev/null
+++ b/vendor/symfony/http-kernel/Tests/Exception/LengthRequiredHttpExceptionTest.php
@@ -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();
+ }
+}
diff --git a/vendor/symfony/http-kernel/Tests/Exception/MethodNotAllowedHttpExceptionTest.php b/vendor/symfony/http-kernel/Tests/Exception/MethodNotAllowedHttpExceptionTest.php
new file mode 100644
index 0000000000..b5def13ce3
--- /dev/null
+++ b/vendor/symfony/http-kernel/Tests/Exception/MethodNotAllowedHttpExceptionTest.php
@@ -0,0 +1,24 @@
+<?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());
+ }
+
+ /**
+ * @dataProvider headerDataProvider
+ */
+ public function testHeadersSetter($headers)
+ {
+ $exception = new MethodNotAllowedHttpException(array('GET'));
+ $exception->setHeaders($headers);
+ $this->assertSame($headers, $exception->getHeaders());
+ }
+}
diff --git a/vendor/symfony/http-kernel/Tests/Exception/NotAcceptableHttpExceptionTest.php b/vendor/symfony/http-kernel/Tests/Exception/NotAcceptableHttpExceptionTest.php
new file mode 100644
index 0000000000..4c0db7a3cb
--- /dev/null
+++ b/vendor/symfony/http-kernel/Tests/Exception/NotAcceptableHttpExceptionTest.php
@@ -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();
+ }
+}
diff --git a/vendor/symfony/http-kernel/Tests/Exception/NotFoundHttpExceptionTest.php b/vendor/symfony/http-kernel/Tests/Exception/NotFoundHttpExceptionTest.php
new file mode 100644
index 0000000000..62ede5b4b8
--- /dev/null
+++ b/vendor/symfony/http-kernel/Tests/Exception/NotFoundHttpExceptionTest.php
@@ -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();
+ }
+}
diff --git a/vendor/symfony/http-kernel/Tests/Exception/PreconditionFailedHttpExceptionTest.php b/vendor/symfony/http-kernel/Tests/Exception/PreconditionFailedHttpExceptionTest.php
new file mode 100644
index 0000000000..809252b757
--- /dev/null
+++ b/vendor/symfony/http-kernel/Tests/Exception/PreconditionFailedHttpExceptionTest.php
@@ -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();
+ }
+}
diff --git a/vendor/symfony/http-kernel/Tests/Exception/PreconditionRequiredHttpExceptionTest.php b/vendor/symfony/http-kernel/Tests/Exception/PreconditionRequiredHttpExceptionTest.php
new file mode 100644
index 0000000000..69d362e3f6
--- /dev/null
+++ b/vendor/symfony/http-kernel/Tests/Exception/PreconditionRequiredHttpExceptionTest.php
@@ -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();
+ }
+}
diff --git a/vendor/symfony/http-kernel/Tests/Exception/ServiceUnavailableHttpExceptionTest.php b/vendor/symfony/http-kernel/Tests/Exception/ServiceUnavailableHttpExceptionTest.php
new file mode 100644
index 0000000000..e41a23d4e7
--- /dev/null
+++ b/vendor/symfony/http-kernel/Tests/Exception/ServiceUnavailableHttpExceptionTest.php
@@ -0,0 +1,29 @@
+<?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());
+ }
+
+ /**
+ * @dataProvider headerDataProvider
+ */
+ public function testHeadersSetter($headers)
+ {
+ $exception = new ServiceUnavailableHttpException(10);
+ $exception->setHeaders($headers);
+ $this->assertSame($headers, $exception->getHeaders());
+ }
+
+ protected function createException()
+ {
+ return new ServiceUnavailableHttpException();
+ }
+}
diff --git a/vendor/symfony/http-kernel/Tests/Exception/TooManyRequestsHttpExceptionTest.php b/vendor/symfony/http-kernel/Tests/Exception/TooManyRequestsHttpExceptionTest.php
new file mode 100644
index 0000000000..2079bb3380
--- /dev/null
+++ b/vendor/symfony/http-kernel/Tests/Exception/TooManyRequestsHttpExceptionTest.php
@@ -0,0 +1,29 @@
+<?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());
+ }
+
+ /**
+ * @dataProvider headerDataProvider
+ */
+ public function testHeadersSetter($headers)
+ {
+ $exception = new TooManyRequestsHttpException(10);
+ $exception->setHeaders($headers);
+ $this->assertSame($headers, $exception->getHeaders());
+ }
+
+ protected function createException()
+ {
+ return new TooManyRequestsHttpException();
+ }
+}
diff --git a/vendor/symfony/http-kernel/Tests/Exception/UnauthorizedHttpExceptionTest.php b/vendor/symfony/http-kernel/Tests/Exception/UnauthorizedHttpExceptionTest.php
new file mode 100644
index 0000000000..37a0028dc8
--- /dev/null
+++ b/vendor/symfony/http-kernel/Tests/Exception/UnauthorizedHttpExceptionTest.php
@@ -0,0 +1,24 @@
+<?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());
+ }
+
+ /**
+ * @dataProvider headerDataProvider
+ */
+ public function testHeadersSetter($headers)
+ {
+ $exception = new UnauthorizedHttpException('Challenge');
+ $exception->setHeaders($headers);
+ $this->assertSame($headers, $exception->getHeaders());
+ }
+}
diff --git a/vendor/symfony/http-kernel/Tests/Exception/UnprocessableEntityHttpExceptionTest.php b/vendor/symfony/http-kernel/Tests/Exception/UnprocessableEntityHttpExceptionTest.php
new file mode 100644
index 0000000000..760366c694
--- /dev/null
+++ b/vendor/symfony/http-kernel/Tests/Exception/UnprocessableEntityHttpExceptionTest.php
@@ -0,0 +1,28 @@
+<?php
+
+namespace Symfony\Component\HttpKernel\Tests\Exception;
+
+use Symfony\Component\HttpKernel\Exception\UnprocessableEntityHttpException;
+
+class UnprocessableEntityHttpExceptionTest extends HttpExceptionTest
+{
+ /**
+ * Test that setting the headers using the setter function
+ * is working as expected.
+ *
+ * @param array $headers The headers to set
+ *
+ * @dataProvider headerDataProvider
+ */
+ public function testHeadersSetter($headers)
+ {
+ $exception = new UnprocessableEntityHttpException(10);
+ $exception->setHeaders($headers);
+ $this->assertSame($headers, $exception->getHeaders());
+ }
+
+ protected function createException()
+ {
+ return new UnprocessableEntityHttpException();
+ }
+}
diff --git a/vendor/symfony/http-kernel/Tests/Exception/UnsupportedMediaTypeHttpExceptionTest.php b/vendor/symfony/http-kernel/Tests/Exception/UnsupportedMediaTypeHttpExceptionTest.php
new file mode 100644
index 0000000000..d47287a1fb
--- /dev/null
+++ b/vendor/symfony/http-kernel/Tests/Exception/UnsupportedMediaTypeHttpExceptionTest.php
@@ -0,0 +1,23 @@
+<?php
+
+namespace Symfony\Component\HttpKernel\Tests\Exception;
+
+use Symfony\Component\HttpKernel\Exception\UnsupportedMediaTypeHttpException;
+
+class UnsupportedMediaTypeHttpExceptionTest extends HttpExceptionTest
+{
+ /**
+ * @dataProvider headerDataProvider
+ */
+ public function testHeadersSetter($headers)
+ {
+ $exception = new UnsupportedMediaTypeHttpException(10);
+ $exception->setHeaders($headers);
+ $this->assertSame($headers, $exception->getHeaders());
+ }
+
+ protected function createException($headers = array())
+ {
+ return new UnsupportedMediaTypeHttpException();
+ }
+}