summaryrefslogtreecommitdiff
path: root/vendor/symfony/debug/Tests
diff options
context:
space:
mode:
authorGreg Roach <fisharebest@webtrees.net>2019-09-07 08:17:24 +0100
committerGreg Roach <fisharebest@webtrees.net>2019-09-07 08:17:24 +0100
commit43e2cc54543d9f79c9805f752e78e25c351646ff (patch)
treef8f252a8f0f6ff6061c177456865102c50a04810 /vendor/symfony/debug/Tests
parent4e96702fabf715ae955aafd54002fb5c57a109cf (diff)
downloadwebtrees-43e2cc54543d9f79c9805f752e78e25c351646ff.tar.gz
webtrees-43e2cc54543d9f79c9805f752e78e25c351646ff.tar.bz2
webtrees-43e2cc54543d9f79c9805f752e78e25c351646ff.zip
Update vendor dependencies
Diffstat (limited to 'vendor/symfony/debug/Tests')
-rw-r--r--vendor/symfony/debug/Tests/DebugClassLoaderTest.php28
-rw-r--r--vendor/symfony/debug/Tests/ErrorHandlerTest.php8
-rw-r--r--vendor/symfony/debug/Tests/Exception/FlattenExceptionTest.php8
-rw-r--r--vendor/symfony/debug/Tests/ExceptionHandlerTest.php22
-rw-r--r--vendor/symfony/debug/Tests/FatalErrorHandler/ClassNotFoundFatalErrorHandlerTest.php2
5 files changed, 33 insertions, 35 deletions
diff --git a/vendor/symfony/debug/Tests/DebugClassLoaderTest.php b/vendor/symfony/debug/Tests/DebugClassLoaderTest.php
index 6ee20ae8a7..30cf4a3326 100644
--- a/vendor/symfony/debug/Tests/DebugClassLoaderTest.php
+++ b/vendor/symfony/debug/Tests/DebugClassLoaderTest.php
@@ -23,7 +23,7 @@ class DebugClassLoaderTest extends TestCase
private $loader;
- protected function setUp()
+ protected function setUp(): void
{
$this->errorReporting = error_reporting(E_ALL);
$this->loader = new ClassLoader();
@@ -31,7 +31,7 @@ class DebugClassLoaderTest extends TestCase
DebugClassLoader::enable();
}
- protected function tearDown()
+ protected function tearDown(): void
{
DebugClassLoader::disable();
spl_autoload_unregister([$this->loader, 'loadClass']);
@@ -58,12 +58,10 @@ class DebugClassLoaderTest extends TestCase
$this->fail('DebugClassLoader did not register');
}
- /**
- * @expectedException \Exception
- * @expectedExceptionMessage boo
- */
public function testThrowingClass()
{
+ $this->expectException('Exception');
+ $this->expectExceptionMessage('boo');
try {
class_exists(__NAMESPACE__.'\Fixtures\Throwing');
$this->fail('Exception expected');
@@ -75,20 +73,17 @@ class DebugClassLoaderTest extends TestCase
class_exists(__NAMESPACE__.'\Fixtures\Throwing');
}
- /**
- * @expectedException \RuntimeException
- */
public function testNameCaseMismatch()
{
+ $this->expectException('RuntimeException');
+ $this->expectExceptionMessage('Case mismatch between loaded and declared class names');
class_exists(__NAMESPACE__.'\TestingCaseMismatch', true);
}
- /**
- * @expectedException \RuntimeException
- * @expectedExceptionMessage Case mismatch between class and real file names
- */
public function testFileCaseMismatch()
{
+ $this->expectException('RuntimeException');
+ $this->expectExceptionMessage('Case mismatch between class and real file names');
if (!file_exists(__DIR__.'/Fixtures/CaseMismatch.php')) {
$this->markTestSkipped('Can only be run on case insensitive filesystems');
}
@@ -96,11 +91,10 @@ class DebugClassLoaderTest extends TestCase
class_exists(__NAMESPACE__.'\Fixtures\CaseMismatch', true);
}
- /**
- * @expectedException \RuntimeException
- */
public function testPsr4CaseMismatch()
{
+ $this->expectException('RuntimeException');
+ $this->expectExceptionMessage('Case mismatch between loaded and declared class names');
class_exists(__NAMESPACE__.'\Fixtures\Psr4CaseMismatch', true);
}
@@ -444,5 +438,7 @@ class ClassLoader
eval('namespace Test\\'.__NAMESPACE__.'; class ExtendsVirtualMagicCall extends \\'.__NAMESPACE__.'\Fixtures\VirtualClassMagicCall implements \\'.__NAMESPACE__.'\Fixtures\VirtualInterface {
}');
}
+
+ return null;
}
}
diff --git a/vendor/symfony/debug/Tests/ErrorHandlerTest.php b/vendor/symfony/debug/Tests/ErrorHandlerTest.php
index 9ceeb0f097..54e656b3f8 100644
--- a/vendor/symfony/debug/Tests/ErrorHandlerTest.php
+++ b/vendor/symfony/debug/Tests/ErrorHandlerTest.php
@@ -283,6 +283,10 @@ class ErrorHandlerTest extends TestCase
public function testHandleUserError()
{
+ if (\PHP_VERSION_ID >= 70400) {
+ $this->markTestSkipped('PHP 7.4 allows __toString to throw exceptions');
+ }
+
try {
$handler = ErrorHandler::register();
$handler->throwAt(0, true);
@@ -491,11 +495,9 @@ class ErrorHandlerTest extends TestCase
$this->assertStringStartsWith("Attempted to load class \"IReallyReallyDoNotExistAnywhereInTheRepositoryISwear\" from the global namespace.\nDid you forget a \"use\" statement", $args[0]->getMessage());
}
- /**
- * @expectedException \Exception
- */
public function testCustomExceptionHandler()
{
+ $this->expectException('Exception');
$handler = new ErrorHandler();
$handler->setExceptionHandler(function ($e) use ($handler) {
$handler->handleException($e);
diff --git a/vendor/symfony/debug/Tests/Exception/FlattenExceptionTest.php b/vendor/symfony/debug/Tests/Exception/FlattenExceptionTest.php
index e86210b903..994a5efca1 100644
--- a/vendor/symfony/debug/Tests/Exception/FlattenExceptionTest.php
+++ b/vendor/symfony/debug/Tests/Exception/FlattenExceptionTest.php
@@ -294,7 +294,7 @@ class FlattenExceptionTest extends TestCase
// assertEquals() does not like NAN values.
$this->assertEquals($array[$i][0], 'float');
- $this->assertTrue(is_nan($array[$i++][1]));
+ $this->assertNan($array[$i++][1]);
}
public function testRecursionInArguments()
@@ -305,7 +305,7 @@ class FlattenExceptionTest extends TestCase
$flattened = FlattenException::create($exception);
$trace = $flattened->getTrace();
- $this->assertContains('*DEEP NESTED ARRAY*', serialize($trace));
+ $this->assertStringContainsString('*DEEP NESTED ARRAY*', serialize($trace));
}
public function testTooBigArray()
@@ -329,8 +329,8 @@ class FlattenExceptionTest extends TestCase
$serializeTrace = serialize($trace);
- $this->assertContains('*SKIPPED over 10000 entries*', $serializeTrace);
- $this->assertNotContains('*value1*', $serializeTrace);
+ $this->assertStringContainsString('*SKIPPED over 10000 entries*', $serializeTrace);
+ $this->assertStringNotContainsString('*value1*', $serializeTrace);
}
public function testAnonymousClass()
diff --git a/vendor/symfony/debug/Tests/ExceptionHandlerTest.php b/vendor/symfony/debug/Tests/ExceptionHandlerTest.php
index 3a9af8b6b8..ab6da5fb5e 100644
--- a/vendor/symfony/debug/Tests/ExceptionHandlerTest.php
+++ b/vendor/symfony/debug/Tests/ExceptionHandlerTest.php
@@ -21,12 +21,12 @@ require_once __DIR__.'/HeaderMock.php';
class ExceptionHandlerTest extends TestCase
{
- protected function setUp()
+ protected function setUp(): void
{
testHeader();
}
- protected function tearDown()
+ protected function tearDown(): void
{
testHeader();
}
@@ -39,8 +39,8 @@ class ExceptionHandlerTest extends TestCase
$handler->sendPhpResponse(new \RuntimeException('Foo'));
$response = ob_get_clean();
- $this->assertContains('Whoops, looks like something went wrong.', $response);
- $this->assertNotContains('<div class="trace trace-as-html">', $response);
+ $this->assertStringContainsString('Whoops, looks like something went wrong.', $response);
+ $this->assertStringNotContainsString('<div class="trace trace-as-html">', $response);
$handler = new ExceptionHandler(true);
@@ -48,8 +48,8 @@ class ExceptionHandlerTest extends TestCase
$handler->sendPhpResponse(new \RuntimeException('Foo'));
$response = ob_get_clean();
- $this->assertContains('<h1 class="break-long-words exception-message">Foo</h1>', $response);
- $this->assertContains('<div class="trace trace-as-html">', $response);
+ $this->assertStringContainsString('<h1 class="break-long-words exception-message">Foo</h1>', $response);
+ $this->assertStringContainsString('<div class="trace trace-as-html">', $response);
// taken from https://www.owasp.org/index.php/Cross-site_Scripting_(XSS)
$htmlWithXss = '<body onload=alert(\'test1\')> <b onmouseover=alert(\'Wufff!\')>click me!</b> <img src="j&#X41vascript:alert(\'test2\')"> <meta http-equiv="refresh"
@@ -58,7 +58,7 @@ content="0;url=data:text/html;base64,PHNjcmlwdD5hbGVydCgndGVzdDMnKTwvc2NyaXB0Pg"
$handler->sendPhpResponse(new \RuntimeException($htmlWithXss));
$response = ob_get_clean();
- $this->assertContains(sprintf('<h1 class="break-long-words exception-message">%s</h1>', htmlspecialchars($htmlWithXss, ENT_COMPAT | ENT_SUBSTITUTE, 'UTF-8')), $response);
+ $this->assertStringContainsString(sprintf('<h1 class="break-long-words exception-message">%s</h1>', htmlspecialchars($htmlWithXss, ENT_COMPAT | ENT_SUBSTITUTE, 'UTF-8')), $response);
}
public function testStatusCode()
@@ -69,7 +69,7 @@ content="0;url=data:text/html;base64,PHNjcmlwdD5hbGVydCgndGVzdDMnKTwvc2NyaXB0Pg"
$handler->sendPhpResponse(new NotFoundHttpException('Foo'));
$response = ob_get_clean();
- $this->assertContains('Sorry, the page you are looking for could not be found.', $response);
+ $this->assertStringContainsString('Sorry, the page you are looking for could not be found.', $response);
$expectedHeaders = [
['HTTP/1.0 404', true, null],
@@ -125,7 +125,7 @@ content="0;url=data:text/html;base64,PHNjcmlwdD5hbGVydCgndGVzdDMnKTwvc2NyaXB0Pg"
});
$handler->handle(new \Exception());
- ob_end_flush(); // Necessary because of this PHP bug : https://bugs.php.net/bug.php?id=76563
+ ob_end_flush(); // Necessary because of this PHP bug : https://bugs.php.net/76563
$this->assertSame('ccc', ob_get_clean());
}
@@ -166,7 +166,7 @@ content="0;url=data:text/html;base64,PHNjcmlwdD5hbGVydCgndGVzdDMnKTwvc2NyaXB0Pg"
private function assertThatTheExceptionWasOutput($content, $expectedClass, $expectedTitle, $expectedMessage)
{
- $this->assertContains(sprintf('<span class="exception_title"><abbr title="%s">%s</abbr></span>', $expectedClass, $expectedTitle), $content);
- $this->assertContains(sprintf('<p class="break-long-words trace-message">%s</p>', $expectedMessage), $content);
+ $this->assertStringContainsString(sprintf('<span class="exception_title"><abbr title="%s">%s</abbr></span>', $expectedClass, $expectedTitle), $content);
+ $this->assertStringContainsString(sprintf('<p class="break-long-words trace-message">%s</p>', $expectedMessage), $content);
}
}
diff --git a/vendor/symfony/debug/Tests/FatalErrorHandler/ClassNotFoundFatalErrorHandlerTest.php b/vendor/symfony/debug/Tests/FatalErrorHandler/ClassNotFoundFatalErrorHandlerTest.php
index 9a56b3b4ec..7287fa7735 100644
--- a/vendor/symfony/debug/Tests/FatalErrorHandler/ClassNotFoundFatalErrorHandlerTest.php
+++ b/vendor/symfony/debug/Tests/FatalErrorHandler/ClassNotFoundFatalErrorHandlerTest.php
@@ -19,7 +19,7 @@ use Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandler;
class ClassNotFoundFatalErrorHandlerTest extends TestCase
{
- public static function setUpBeforeClass()
+ public static function setUpBeforeClass(): void
{
foreach (spl_autoload_functions() as $function) {
if (!\is_array($function)) {