From 7e4f88a9f02cf3b0679ab4313f03d734edbc0798 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Mon, 27 Jun 2022 15:16:42 +0200 Subject: [PATCH 1/4] CS fixes --- bin/simple-phpunit.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/simple-phpunit.php b/bin/simple-phpunit.php index e7c3da2..fe776b9 100644 --- a/bin/simple-phpunit.php +++ b/bin/simple-phpunit.php @@ -66,14 +66,14 @@ $phpunitConfigFilename = $phpunitConfigFilename ?: $getPhpUnitConfig('phpunit.xml'); if ($phpunitConfigFilename) { - $phpunitConfig = new DomDocument(); + $phpunitConfig = new DOMDocument(); $phpunitConfig->load($phpunitConfigFilename); } else { $phpunitConfig = false; } } if (false !== $phpunitConfig) { - $var = new DOMXpath($phpunitConfig); + $var = new DOMXPath($phpunitConfig); foreach ($var->query('//php/server[@name="'.$name.'"]') as $var) { return $var->getAttribute('value'); } From 102da63aeb7547e04be813a84eeab5a2f49b3706 Mon Sep 17 00:00:00 2001 From: Chris W Jones Date: Mon, 27 Jun 2022 14:04:51 -0400 Subject: [PATCH 2/4] [Bridge] Corrects bug in test listener trait --- Legacy/SymfonyTestsListenerTrait.php | 2 +- Tests/FailTests/NoAssertionsTestNotRisky.php | 32 ++++++++++++++++++++ Tests/expectnotrisky.phpt | 18 +++++++++++ 3 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 Tests/FailTests/NoAssertionsTestNotRisky.php create mode 100644 Tests/expectnotrisky.phpt diff --git a/Legacy/SymfonyTestsListenerTrait.php b/Legacy/SymfonyTestsListenerTrait.php index c84ec1b..0fc2f2d 100644 --- a/Legacy/SymfonyTestsListenerTrait.php +++ b/Legacy/SymfonyTestsListenerTrait.php @@ -271,7 +271,7 @@ public function endTest($test, $time) $assertions = \count(self::$expectedDeprecations) + $test->getNumAssertions(); if ($test->doesNotPerformAssertions() && $assertions > 0) { $test->getTestResultObject()->addFailure($test, new RiskyTestError(sprintf('This test is annotated with "@doesNotPerformAssertions", but performed %s assertions', $assertions)), $time); - } elseif ($assertions === 0 && $test->getTestResultObject()->noneSkipped()) { + } elseif ($assertions === 0 && !$test->doesNotPerformAssertions() && $test->getTestResultObject()->noneSkipped()) { $test->getTestResultObject()->addFailure($test, new RiskyTestError('This test did not perform any assertions'), $time); } diff --git a/Tests/FailTests/NoAssertionsTestNotRisky.php b/Tests/FailTests/NoAssertionsTestNotRisky.php new file mode 100644 index 0000000..2c5832e --- /dev/null +++ b/Tests/FailTests/NoAssertionsTestNotRisky.php @@ -0,0 +1,32 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bridge\PhpUnit\Tests\FailTests; + +use PHPUnit\Framework\TestCase; +use Symfony\Bridge\PhpUnit\ExpectDeprecationTrait; + +/** + * This class is deliberately suffixed with *TestRisky.php so that it is ignored + * by PHPUnit. This test is designed to fail. See ../expectnotrisky.phpt. + */ +final class NoAssertionsTestNotRisky extends TestCase +{ + use ExpectDeprecationTrait; + + /** + * Do not remove this test in the next major version. + */ + public function testOne() + { + $this->expectNotToPerformAssertions(); + } +} diff --git a/Tests/expectnotrisky.phpt b/Tests/expectnotrisky.phpt new file mode 100644 index 0000000..2005adf --- /dev/null +++ b/Tests/expectnotrisky.phpt @@ -0,0 +1,18 @@ +--TEST-- +Test NoAssertionsTestNotRisky not risky test +--SKIPIF-- + +--EXPECTF-- +PHPUnit %s + +%ATesting Symfony\Bridge\PhpUnit\Tests\FailTests\NoAssertionsTestNotRisky +. 1 / 1 (100%) + +Time: %s, Memory: %s + +OK (1 test, 0 assertions) From a226ce5a5a5326febc57a41534bc0a1370411a08 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Wed, 20 Jul 2022 13:50:25 +0200 Subject: [PATCH 3/4] Fix CS --- bin/simple-phpunit.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/simple-phpunit.php b/bin/simple-phpunit.php index 2747096..54f9818 100644 --- a/bin/simple-phpunit.php +++ b/bin/simple-phpunit.php @@ -149,9 +149,9 @@ $COMPOSER = ($COMPOSER = getenv('COMPOSER_BINARY')) || file_exists($COMPOSER = $oldPwd.'/composer.phar') - || ($COMPOSER = rtrim((string) ('\\' === \DIRECTORY_SEPARATOR ? preg_replace('/[\r\n].*/', '', `where.exe composer.phar 2> NUL`) : `which composer.phar 2> /dev/null`))) - || ($COMPOSER = rtrim((string) ('\\' === \DIRECTORY_SEPARATOR ? preg_replace('/[\r\n].*/', '', `where.exe composer 2> NUL`) : `which composer 2> /dev/null`))) - || file_exists($COMPOSER = rtrim((string) ('\\' === \DIRECTORY_SEPARATOR ? `git rev-parse --show-toplevel 2> NUL` : `git rev-parse --show-toplevel 2> /dev/null`)).\DIRECTORY_SEPARATOR.'composer.phar') + || ($COMPOSER = rtrim((string) ('\\' === \DIRECTORY_SEPARATOR ? preg_replace('/[\r\n].*/', '', shell_exec('where.exe composer.phar 2> NUL')) : shell_exec('which composer.phar 2> /dev/null')))) + || ($COMPOSER = rtrim((string) ('\\' === \DIRECTORY_SEPARATOR ? preg_replace('/[\r\n].*/', '', shell_exec('where.exe composer 2> NUL')) : shell_exec('which composer 2> /dev/null')))) + || file_exists($COMPOSER = rtrim((string) ('\\' === \DIRECTORY_SEPARATOR ? shell_exec('git rev-parse --show-toplevel 2> NUL') : shell_exec('git rev-parse --show-toplevel 2> /dev/null'))).\DIRECTORY_SEPARATOR.'composer.phar') ? ('#!/usr/bin/env php' === file_get_contents($COMPOSER, false, null, 0, 18) ? $PHP : '').' '.escapeshellarg($COMPOSER) // detect shell wrappers by looking at the shebang : 'composer'; From 03ee09e2a8d6c3a7d2502c5e47d1468b06583b95 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 27 Jul 2022 18:05:11 +0200 Subject: [PATCH 4/4] Workaround disabled "var_dump" --- DeprecationErrorHandler.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DeprecationErrorHandler.php b/DeprecationErrorHandler.php index 00fb4bc..68d8d8e 100644 --- a/DeprecationErrorHandler.php +++ b/DeprecationErrorHandler.php @@ -196,7 +196,7 @@ public function shutdown() if (class_exists(DebugClassLoader::class, false)) { DebugClassLoader::checkClasses(); } - $currErrorHandler = set_error_handler('var_dump'); + $currErrorHandler = set_error_handler('is_int'); restore_error_handler(); if ($currErrorHandler !== [$this, 'handleError']) { pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy