Laravel 5.6 updates

Travis config update

Removed HHVM script as Laravel no longer support HHVM after releasing 5.3
This commit is contained in:
Manish Verma
2018-08-06 20:08:55 +05:30
parent 126fbb0255
commit 1ac0f42a58
2464 changed files with 65239 additions and 46734 deletions

View File

@@ -13,7 +13,6 @@ namespace Symfony\Component\Debug\Tests;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Debug\DebugClassLoader;
use Symfony\Component\Debug\ErrorHandler;
class DebugClassLoaderTest extends TestCase
{
@@ -76,72 +75,8 @@ class DebugClassLoaderTest extends TestCase
class_exists(__NAMESPACE__.'\Fixtures\Throwing');
}
public function testUnsilencing()
{
if (\PHP_VERSION_ID >= 70000) {
$this->markTestSkipped('PHP7 throws exceptions, unsilencing is not required anymore.');
}
if (defined('HHVM_VERSION')) {
$this->markTestSkipped('HHVM is not handled in this test case.');
}
ob_start();
$this->iniSet('log_errors', 0);
$this->iniSet('display_errors', 1);
// See below: this will fail with parse error
// but this should not be @-silenced.
@class_exists(__NAMESPACE__.'\TestingUnsilencing', true);
$output = ob_get_clean();
$this->assertStringMatchesFormat('%aParse error%a', $output);
}
public function testStacking()
{
// the ContextErrorException must not be loaded to test the workaround
// for https://bugs.php.net/65322.
if (class_exists('Symfony\Component\Debug\Exception\ContextErrorException', false)) {
$this->markTestSkipped('The ContextErrorException class is already loaded.');
}
if (defined('HHVM_VERSION')) {
$this->markTestSkipped('HHVM is not handled in this test case.');
}
ErrorHandler::register();
try {
// Trigger autoloading + E_STRICT at compile time
// which in turn triggers $errorHandler->handle()
// that again triggers autoloading for ContextErrorException.
// Error stacking works around the bug above and everything is fine.
eval('
namespace '.__NAMESPACE__.';
class ChildTestingStacking extends TestingStacking { function foo($bar) {} }
');
$this->fail('ContextErrorException expected');
} catch (\ErrorException $exception) {
// if an exception is thrown, the test passed
$this->assertStringStartsWith(__FILE__, $exception->getFile());
if (\PHP_VERSION_ID < 70000) {
$this->assertRegExp('/^Runtime Notice: Declaration/', $exception->getMessage());
$this->assertEquals(E_STRICT, $exception->getSeverity());
} else {
$this->assertRegExp('/^Warning: Declaration/', $exception->getMessage());
$this->assertEquals(E_WARNING, $exception->getSeverity());
}
} finally {
restore_error_handler();
restore_exception_handler();
}
}
/**
* @expectedException \RuntimeException
* @expectedExceptionMessage Case mismatch between loaded and declared class names
*/
public function testNameCaseMismatch()
{
@@ -163,7 +98,6 @@ class DebugClassLoaderTest extends TestCase
/**
* @expectedException \RuntimeException
* @expectedExceptionMessage Case mismatch between loaded and declared class names
*/
public function testPsr4CaseMismatch()
{
@@ -262,32 +196,6 @@ class DebugClassLoaderTest extends TestCase
$this->assertSame($xError, $lastError);
}
public function testReservedForPhp7()
{
if (\PHP_VERSION_ID >= 70000) {
$this->markTestSkipped('PHP7 already prevents using reserved names.');
}
set_error_handler(function () { return false; });
$e = error_reporting(0);
trigger_error('', E_USER_NOTICE);
class_exists('Test\\'.__NAMESPACE__.'\\Float', true);
error_reporting($e);
restore_error_handler();
$lastError = error_get_last();
unset($lastError['file'], $lastError['line']);
$xError = array(
'type' => E_USER_DEPRECATED,
'message' => 'The "Test\Symfony\Component\Debug\Tests\Float" class uses the reserved name "Float", it will break on PHP 7 and higher',
);
$this->assertSame($xError, $lastError);
}
public function testExtendedFinalClass()
{
set_error_handler(function () { return false; });
@@ -304,7 +212,7 @@ class DebugClassLoaderTest extends TestCase
$xError = array(
'type' => E_USER_DEPRECATED,
'message' => 'The "Symfony\Component\Debug\Tests\Fixtures\FinalClass" class is considered final since version 3.3. It may change without further notice as of its next major version. You should not extend it from "Test\Symfony\Component\Debug\Tests\ExtendsFinalClass".',
'message' => 'The "Symfony\Component\Debug\Tests\Fixtures\FinalClass" class is considered final. It may change without further notice as of its next major version. You should not extend it from "Test\Symfony\Component\Debug\Tests\ExtendsFinalClass".',
);
$this->assertSame($xError, $lastError);
@@ -326,7 +234,7 @@ class DebugClassLoaderTest extends TestCase
$xError = array(
'type' => E_USER_DEPRECATED,
'message' => 'The "Symfony\Component\Debug\Tests\Fixtures\FinalMethod::finalMethod()" method is considered final since version 3.3. It may change without further notice as of its next major version. You should not extend it from "Symfony\Component\Debug\Tests\Fixtures\ExtendedFinalMethod".',
'message' => 'The "Symfony\Component\Debug\Tests\Fixtures\FinalMethod::finalMethod()" method is considered final. It may change without further notice as of its next major version. You should not extend it from "Symfony\Component\Debug\Tests\Fixtures\ExtendedFinalMethod".',
);
$this->assertSame($xError, $lastError);
@@ -361,10 +269,10 @@ class DebugClassLoaderTest extends TestCase
restore_error_handler();
$this->assertSame($deprecations, array(
'The "Symfony\Component\Debug\Tests\Fixtures\InternalClass" class is considered internal since version 3.4. It may change without further notice. You should not use it from "Test\Symfony\Component\Debug\Tests\ExtendsInternalsParent".',
'The "Symfony\Component\Debug\Tests\Fixtures\InternalClass" class is considered internal. It may change without further notice. You should not use it from "Test\Symfony\Component\Debug\Tests\ExtendsInternalsParent".',
'The "Symfony\Component\Debug\Tests\Fixtures\InternalInterface" interface is considered internal. It may change without further notice. You should not use it from "Test\Symfony\Component\Debug\Tests\ExtendsInternalsParent".',
'The "Symfony\Component\Debug\Tests\Fixtures\InternalTrait" trait is considered internal. It may change without further notice. You should not use it from "Test\Symfony\Component\Debug\Tests\ExtendsInternals".',
'The "Symfony\Component\Debug\Tests\Fixtures\InternalTrait2::internalMethod()" method is considered internal since version 3.4. It may change without further notice. You should not extend it from "Test\Symfony\Component\Debug\Tests\ExtendsInternals".',
'The "Symfony\Component\Debug\Tests\Fixtures\InternalTrait2::internalMethod()" method is considered internal. It may change without further notice. You should not extend it from "Test\Symfony\Component\Debug\Tests\ExtendsInternals".',
));
}
}

View File

@@ -323,9 +323,6 @@ class ErrorHandlerTest extends TestCase
@$handler->handleError(E_USER_DEPRECATED, 'Foo deprecation', __FILE__, __LINE__, array());
}
/**
* @group no-hhvm
*/
public function testHandleException()
{
try {
@@ -367,38 +364,6 @@ class ErrorHandlerTest extends TestCase
}
}
/**
* @group legacy
*/
public function testErrorStacking()
{
try {
$handler = ErrorHandler::register();
$handler->screamAt(E_USER_WARNING);
$logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock();
$logger
->expects($this->exactly(2))
->method('log')
->withConsecutive(
array($this->equalTo(LogLevel::WARNING), $this->equalTo('Dummy log')),
array($this->equalTo(LogLevel::DEBUG), $this->equalTo('User Warning: Silenced warning'))
)
;
$handler->setDefaultLogger($logger, array(E_USER_WARNING => LogLevel::WARNING));
ErrorHandler::stackErrors();
@trigger_error('Silenced warning', E_USER_WARNING);
$logger->log(LogLevel::WARNING, 'Dummy log');
ErrorHandler::unstackErrors();
} finally {
restore_error_handler();
restore_exception_handler();
}
}
public function testBootstrappingLogger()
{
$bootLogger = new BufferingLogger();
@@ -450,9 +415,6 @@ class ErrorHandlerTest extends TestCase
$handler->setLoggers(array(E_DEPRECATED => array($mockLogger, LogLevel::WARNING)));
}
/**
* @group no-hhvm
*/
public function testSettingLoggerWhenExceptionIsBuffered()
{
$bootLogger = new BufferingLogger();
@@ -472,9 +434,6 @@ class ErrorHandlerTest extends TestCase
$handler->handleException($exception);
}
/**
* @group no-hhvm
*/
public function testHandleFatalError()
{
try {
@@ -515,9 +474,6 @@ class ErrorHandlerTest extends TestCase
}
}
/**
* @requires PHP 7
*/
public function testHandleErrorException()
{
$exception = new \Error("Class 'Foo' not found");
@@ -533,46 +489,8 @@ class ErrorHandlerTest extends TestCase
$this->assertStringStartsWith("Attempted to load class \"Foo\" from the global namespace.\nDid you forget a \"use\" statement", $args[0]->getMessage());
}
/**
* @group no-hhvm
*/
public function testHandleFatalErrorOnHHVM()
{
try {
$handler = ErrorHandler::register();
$logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock();
$logger
->expects($this->once())
->method('log')
->with(
$this->equalTo(LogLevel::CRITICAL),
$this->equalTo('Fatal Error: foo')
)
;
$handler->setDefaultLogger($logger, E_ERROR);
$error = array(
'type' => E_ERROR + 0x1000000, // This error level is used by HHVM for fatal errors
'message' => 'foo',
'file' => 'bar',
'line' => 123,
'context' => array(123),
'backtrace' => array(456),
);
\call_user_func_array(array($handler, 'handleError'), $error);
$handler->handleFatalError($error);
} finally {
restore_error_handler();
restore_exception_handler();
}
}
/**
* @expectedException \Exception
* @group no-hhvm
*/
public function testCustomExceptionHandler()
{

View File

@@ -12,6 +12,7 @@
namespace Symfony\Component\Debug\Tests\Exception;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Debug\Exception\FatalThrowableError;
use Symfony\Component\Debug\Exception\FlattenException;
use Symfony\Component\HttpFoundation\Exception\SuspiciousOperationException;
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
@@ -39,6 +40,12 @@ class FlattenExceptionTest extends TestCase
$flattened = FlattenException::create(new \RuntimeException());
$this->assertEquals('500', $flattened->getStatusCode());
$flattened = FlattenException::createFromThrowable(new \DivisionByZeroError(), 403);
$this->assertEquals('403', $flattened->getStatusCode());
$flattened = FlattenException::createFromThrowable(new \DivisionByZeroError());
$this->assertEquals('500', $flattened->getStatusCode());
$flattened = FlattenException::create(new NotFoundHttpException());
$this->assertEquals('404', $flattened->getStatusCode());
@@ -111,10 +118,10 @@ class FlattenExceptionTest extends TestCase
/**
* @dataProvider flattenDataProvider
*/
public function testFlattenHttpException(\Exception $exception)
public function testFlattenHttpException(\Throwable $exception)
{
$flattened = FlattenException::create($exception);
$flattened2 = FlattenException::create($exception);
$flattened = FlattenException::createFromThrowable($exception);
$flattened2 = FlattenException::createFromThrowable($exception);
$flattened->setPrevious($flattened2);
@@ -123,13 +130,33 @@ class FlattenExceptionTest extends TestCase
$this->assertInstanceOf($flattened->getClass(), $exception, 'The class is set to the class of the original exception');
}
public function testWrappedThrowable()
{
$exception = new FatalThrowableError(new \DivisionByZeroError('Ouch', 42));
$flattened = FlattenException::create($exception);
$this->assertSame('Ouch', $flattened->getMessage(), 'The message is copied from the original error.');
$this->assertSame(42, $flattened->getCode(), 'The code is copied from the original error.');
$this->assertSame('DivisionByZeroError', $flattened->getClass(), 'The class is set to the class of the original error');
}
public function testThrowable()
{
$error = new \DivisionByZeroError('Ouch', 42);
$flattened = FlattenException::createFromThrowable($error);
$this->assertSame('Ouch', $flattened->getMessage(), 'The message is copied from the original error.');
$this->assertSame(42, $flattened->getCode(), 'The code is copied from the original error.');
$this->assertSame('DivisionByZeroError', $flattened->getClass(), 'The class is set to the class of the original error');
}
/**
* @dataProvider flattenDataProvider
*/
public function testPrevious(\Exception $exception)
public function testPrevious(\Throwable $exception)
{
$flattened = FlattenException::create($exception);
$flattened2 = FlattenException::create($exception);
$flattened = FlattenException::createFromThrowable($exception);
$flattened2 = FlattenException::createFromThrowable($exception);
$flattened->setPrevious($flattened2);
@@ -138,50 +165,47 @@ class FlattenExceptionTest extends TestCase
$this->assertSame(array($flattened2), $flattened->getAllPrevious());
}
/**
* @requires PHP 7.0
*/
public function testPreviousError()
{
$exception = new \Exception('test', 123, new \ParseError('Oh noes!', 42));
$flattened = FlattenException::create($exception)->getPrevious();
$this->assertEquals($flattened->getMessage(), 'Parse error: Oh noes!', 'The message is copied from the original exception.');
$this->assertEquals($flattened->getMessage(), 'Oh noes!', 'The message is copied from the original exception.');
$this->assertEquals($flattened->getCode(), 42, 'The code is copied from the original exception.');
$this->assertEquals($flattened->getClass(), 'Symfony\Component\Debug\Exception\FatalThrowableError', 'The class is set to the class of the original exception');
$this->assertEquals($flattened->getClass(), 'ParseError', 'The class is set to the class of the original exception');
}
/**
* @dataProvider flattenDataProvider
*/
public function testLine(\Exception $exception)
public function testLine(\Throwable $exception)
{
$flattened = FlattenException::create($exception);
$flattened = FlattenException::createFromThrowable($exception);
$this->assertSame($exception->getLine(), $flattened->getLine());
}
/**
* @dataProvider flattenDataProvider
*/
public function testFile(\Exception $exception)
public function testFile(\Throwable $exception)
{
$flattened = FlattenException::create($exception);
$flattened = FlattenException::createFromThrowable($exception);
$this->assertSame($exception->getFile(), $flattened->getFile());
}
/**
* @dataProvider flattenDataProvider
*/
public function testToArray(\Exception $exception)
public function testToArray(\Throwable $exception, string $expectedClass)
{
$flattened = FlattenException::create($exception);
$flattened = FlattenException::createFromThrowable($exception);
$flattened->setTrace(array(), 'foo.php', 123);
$this->assertEquals(array(
array(
'message' => 'test',
'class' => 'Exception',
'class' => $expectedClass,
'trace' => array(array(
'namespace' => '', 'short_class' => '', 'class' => '', 'type' => '', 'function' => '', 'file' => 'foo.php', 'line' => 123,
'args' => array(),
@@ -190,10 +214,24 @@ class FlattenExceptionTest extends TestCase
), $flattened->toArray());
}
public function testCreate()
{
$exception = new NotFoundHttpException(
'test',
new \RuntimeException('previous', 123)
);
$this->assertSame(
FlattenException::createFromThrowable($exception)->toArray(),
FlattenException::create($exception)->toArray()
);
}
public function flattenDataProvider()
{
return array(
array(new \Exception('test', 123)),
array(new \Exception('test', 123), 'Exception'),
array(new \Error('test', 123), 'Error'),
);
}
@@ -236,7 +274,7 @@ class FlattenExceptionTest extends TestCase
$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', \defined('HHVM_VERSION') ? 'Directory' : 'stream'), $array[$i++]);
$this->assertSame(array('resource', 'stream'), $array[$i++]);
$this->assertSame(array('resource', 'stream'), $array[$i++]);
$args = $array[$i++];

View File

@@ -26,7 +26,7 @@ class UndefinedFunctionFatalErrorHandlerTest extends TestCase
$exception = $handler->handleError($error, new FatalErrorException('', 0, $error['type'], $error['file'], $error['line']));
$this->assertInstanceOf('Symfony\Component\Debug\Exception\UndefinedFunctionException', $exception);
// class names are case insensitive and PHP/HHVM do not return the same
// class names are case insensitive and PHP do not return the same
$this->assertSame(strtolower($translatedMessage), strtolower($exception->getMessage()));
$this->assertSame($error['type'], $exception->getSeverity());
$this->assertSame($error['file'], $exception->getFile());

View File

@@ -5,7 +5,7 @@ namespace Symfony\Component\Debug\Tests\Fixtures;
class AnnotatedClass
{
/**
* @deprecated since version 3.4.
* @deprecated
*/
public function deprecatedMethod()
{

View File

@@ -3,7 +3,7 @@
namespace Symfony\Component\Debug\Tests\Fixtures;
/**
* @final since version 3.3.
* @final
*/
class FinalClass
{

View File

@@ -5,7 +5,7 @@ namespace Symfony\Component\Debug\Tests\Fixtures;
class FinalMethod
{
/**
* @final since version 3.3.
* @final
*/
public function finalMethod()
{

View File

@@ -3,7 +3,7 @@
namespace Symfony\Component\Debug\Tests\Fixtures;
/**
* @internal since version 3.4.
* @internal
*/
class InternalClass
{

View File

@@ -8,7 +8,7 @@ namespace Symfony\Component\Debug\Tests\Fixtures;
trait InternalTrait2
{
/**
* @internal since version 3.4
* @internal
*/
public function internalMethod()
{

View File

@@ -23,4 +23,4 @@ class_exists(ExtendedFinalMethod::class);
?>
--EXPECTF--
The "Symfony\Component\Debug\Tests\Fixtures\FinalMethod::finalMethod()" method is considered final since version 3.3. It may change without further notice as of its next major version. You should not extend it from "Symfony\Component\Debug\Tests\Fixtures\ExtendedFinalMethod".
The "Symfony\Component\Debug\Tests\Fixtures\FinalMethod::finalMethod()" method is considered final. It may change without further notice as of its next major version. You should not extend it from "Symfony\Component\Debug\Tests\Fixtures\ExtendedFinalMethod".