updated packages
This commit is contained in:
@@ -61,7 +61,7 @@ class FlattenExceptionTest extends TestCase
|
||||
$flattened = FlattenException::create(new ConflictHttpException());
|
||||
$this->assertEquals('409', $flattened->getStatusCode());
|
||||
|
||||
$flattened = FlattenException::create(new MethodNotAllowedHttpException(array('POST')));
|
||||
$flattened = FlattenException::create(new MethodNotAllowedHttpException(['POST']));
|
||||
$this->assertEquals('405', $flattened->getStatusCode());
|
||||
|
||||
$flattened = FlattenException::create(new AccessDeniedHttpException());
|
||||
@@ -96,23 +96,23 @@ class FlattenExceptionTest extends TestCase
|
||||
|
||||
public function testHeadersForHttpException()
|
||||
{
|
||||
$flattened = FlattenException::create(new MethodNotAllowedHttpException(array('POST')));
|
||||
$this->assertEquals(array('Allow' => 'POST'), $flattened->getHeaders());
|
||||
$flattened = FlattenException::create(new MethodNotAllowedHttpException(['POST']));
|
||||
$this->assertEquals(['Allow' => 'POST'], $flattened->getHeaders());
|
||||
|
||||
$flattened = FlattenException::create(new UnauthorizedHttpException('Basic realm="My Realm"'));
|
||||
$this->assertEquals(array('WWW-Authenticate' => 'Basic realm="My Realm"'), $flattened->getHeaders());
|
||||
$this->assertEquals(['WWW-Authenticate' => 'Basic realm="My Realm"'], $flattened->getHeaders());
|
||||
|
||||
$flattened = FlattenException::create(new ServiceUnavailableHttpException('Fri, 31 Dec 1999 23:59:59 GMT'));
|
||||
$this->assertEquals(array('Retry-After' => 'Fri, 31 Dec 1999 23:59:59 GMT'), $flattened->getHeaders());
|
||||
$this->assertEquals(['Retry-After' => 'Fri, 31 Dec 1999 23:59:59 GMT'], $flattened->getHeaders());
|
||||
|
||||
$flattened = FlattenException::create(new ServiceUnavailableHttpException(120));
|
||||
$this->assertEquals(array('Retry-After' => 120), $flattened->getHeaders());
|
||||
$this->assertEquals(['Retry-After' => 120], $flattened->getHeaders());
|
||||
|
||||
$flattened = FlattenException::create(new TooManyRequestsHttpException('Fri, 31 Dec 1999 23:59:59 GMT'));
|
||||
$this->assertEquals(array('Retry-After' => 'Fri, 31 Dec 1999 23:59:59 GMT'), $flattened->getHeaders());
|
||||
$this->assertEquals(['Retry-After' => 'Fri, 31 Dec 1999 23:59:59 GMT'], $flattened->getHeaders());
|
||||
|
||||
$flattened = FlattenException::create(new TooManyRequestsHttpException(120));
|
||||
$this->assertEquals(array('Retry-After' => 120), $flattened->getHeaders());
|
||||
$this->assertEquals(['Retry-After' => 120], $flattened->getHeaders());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -162,7 +162,7 @@ class FlattenExceptionTest extends TestCase
|
||||
|
||||
$this->assertSame($flattened2, $flattened->getPrevious());
|
||||
|
||||
$this->assertSame(array($flattened2), $flattened->getAllPrevious());
|
||||
$this->assertSame([$flattened2], $flattened->getAllPrevious());
|
||||
}
|
||||
|
||||
public function testPreviousError()
|
||||
@@ -200,18 +200,18 @@ class FlattenExceptionTest extends TestCase
|
||||
public function testToArray(\Throwable $exception, string $expectedClass)
|
||||
{
|
||||
$flattened = FlattenException::createFromThrowable($exception);
|
||||
$flattened->setTrace(array(), 'foo.php', 123);
|
||||
$flattened->setTrace([], 'foo.php', 123);
|
||||
|
||||
$this->assertEquals(array(
|
||||
array(
|
||||
$this->assertEquals([
|
||||
[
|
||||
'message' => 'test',
|
||||
'class' => $expectedClass,
|
||||
'trace' => array(array(
|
||||
'trace' => [[
|
||||
'namespace' => '', 'short_class' => '', 'class' => '', 'type' => '', 'function' => '', 'file' => 'foo.php', 'line' => 123,
|
||||
'args' => array(),
|
||||
)),
|
||||
),
|
||||
), $flattened->toArray());
|
||||
'args' => [],
|
||||
]],
|
||||
],
|
||||
], $flattened->toArray());
|
||||
}
|
||||
|
||||
public function testCreate()
|
||||
@@ -229,10 +229,10 @@ class FlattenExceptionTest extends TestCase
|
||||
|
||||
public function flattenDataProvider()
|
||||
{
|
||||
return array(
|
||||
array(new \Exception('test', 123), 'Exception'),
|
||||
array(new \Error('test', 123), 'Error'),
|
||||
);
|
||||
return [
|
||||
[new \Exception('test', 123), 'Exception'],
|
||||
[new \Error('test', 123), 'Error'],
|
||||
];
|
||||
}
|
||||
|
||||
public function testArguments()
|
||||
@@ -242,15 +242,15 @@ class FlattenExceptionTest extends TestCase
|
||||
|
||||
$incomplete = unserialize('O:14:"BogusTestClass":0:{}');
|
||||
|
||||
$exception = $this->createException(array(
|
||||
(object) array('foo' => 1),
|
||||
$exception = $this->createException([
|
||||
(object) ['foo' => 1],
|
||||
new NotFoundHttpException(),
|
||||
$incomplete,
|
||||
$dh,
|
||||
$fh,
|
||||
function () {},
|
||||
array(1, 2),
|
||||
array('foo' => 123),
|
||||
[1, 2],
|
||||
['foo' => 123],
|
||||
null,
|
||||
true,
|
||||
false,
|
||||
@@ -260,7 +260,7 @@ class FlattenExceptionTest extends TestCase
|
||||
'',
|
||||
INF,
|
||||
NAN,
|
||||
));
|
||||
]);
|
||||
|
||||
$flattened = FlattenException::create($exception);
|
||||
$trace = $flattened->getTrace();
|
||||
@@ -271,26 +271,26 @@ class FlattenExceptionTest extends TestCase
|
||||
fclose($fh);
|
||||
|
||||
$i = 0;
|
||||
$this->assertSame(array('object', 'stdClass'), $array[$i++]);
|
||||
$this->assertSame(array('object', 'Symfony\Component\HttpKernel\Exception\NotFoundHttpException'), $array[$i++]);
|
||||
$this->assertSame(array('incomplete-object', 'BogusTestClass'), $array[$i++]);
|
||||
$this->assertSame(array('resource', 'stream'), $array[$i++]);
|
||||
$this->assertSame(array('resource', 'stream'), $array[$i++]);
|
||||
$this->assertSame(['object', 'stdClass'], $array[$i++]);
|
||||
$this->assertSame(['object', 'Symfony\Component\HttpKernel\Exception\NotFoundHttpException'], $array[$i++]);
|
||||
$this->assertSame(['incomplete-object', 'BogusTestClass'], $array[$i++]);
|
||||
$this->assertSame(['resource', 'stream'], $array[$i++]);
|
||||
$this->assertSame(['resource', 'stream'], $array[$i++]);
|
||||
|
||||
$args = $array[$i++];
|
||||
$this->assertSame($args[0], 'object');
|
||||
$this->assertTrue('Closure' === $args[1] || is_subclass_of($args[1], '\Closure'), 'Expect object class name to be Closure or a subclass of Closure.');
|
||||
|
||||
$this->assertSame(array('array', array(array('integer', 1), array('integer', 2))), $array[$i++]);
|
||||
$this->assertSame(array('array', array('foo' => array('integer', 123))), $array[$i++]);
|
||||
$this->assertSame(array('null', null), $array[$i++]);
|
||||
$this->assertSame(array('boolean', true), $array[$i++]);
|
||||
$this->assertSame(array('boolean', false), $array[$i++]);
|
||||
$this->assertSame(array('integer', 0), $array[$i++]);
|
||||
$this->assertSame(array('float', 0.0), $array[$i++]);
|
||||
$this->assertSame(array('string', '0'), $array[$i++]);
|
||||
$this->assertSame(array('string', ''), $array[$i++]);
|
||||
$this->assertSame(array('float', INF), $array[$i++]);
|
||||
$this->assertSame(['array', [['integer', 1], ['integer', 2]]], $array[$i++]);
|
||||
$this->assertSame(['array', ['foo' => ['integer', 123]]], $array[$i++]);
|
||||
$this->assertSame(['null', null], $array[$i++]);
|
||||
$this->assertSame(['boolean', true], $array[$i++]);
|
||||
$this->assertSame(['boolean', false], $array[$i++]);
|
||||
$this->assertSame(['integer', 0], $array[$i++]);
|
||||
$this->assertSame(['float', 0.0], $array[$i++]);
|
||||
$this->assertSame(['string', '0'], $array[$i++]);
|
||||
$this->assertSame(['string', ''], $array[$i++]);
|
||||
$this->assertSame(['float', INF], $array[$i++]);
|
||||
|
||||
// assertEquals() does not like NAN values.
|
||||
$this->assertEquals($array[$i][0], 'float');
|
||||
@@ -300,7 +300,7 @@ class FlattenExceptionTest extends TestCase
|
||||
public function testRecursionInArguments()
|
||||
{
|
||||
$a = null;
|
||||
$a = array('foo', array(2, &$a));
|
||||
$a = ['foo', [2, &$a]];
|
||||
$exception = $this->createException($a);
|
||||
|
||||
$flattened = FlattenException::create($exception);
|
||||
@@ -310,7 +310,7 @@ class FlattenExceptionTest extends TestCase
|
||||
|
||||
public function testTooBigArray()
|
||||
{
|
||||
$a = array();
|
||||
$a = [];
|
||||
for ($i = 0; $i < 20; ++$i) {
|
||||
for ($j = 0; $j < 50; ++$j) {
|
||||
for ($k = 0; $k < 10; ++$k) {
|
||||
@@ -325,7 +325,7 @@ class FlattenExceptionTest extends TestCase
|
||||
$flattened = FlattenException::create($exception);
|
||||
$trace = $flattened->getTrace();
|
||||
|
||||
$this->assertSame($trace[1]['args'][0], array('array', array('array', '*SKIPPED over 10000 entries*')));
|
||||
$this->assertSame($trace[1]['args'][0], ['array', ['array', '*SKIPPED over 10000 entries*']]);
|
||||
|
||||
$serializeTrace = serialize($trace);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user