Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: symfony/phpunit-bridge
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v5.4.10
Choose a base ref
...
head repository: symfony/phpunit-bridge
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v5.4.11
Choose a head ref
  • 6 commits
  • 5 files changed
  • 4 contributors

Commits on Jun 27, 2022

  1. CS fixes

    nicolas-grekas committed Jun 27, 2022
    Copy the full SHA
    7e4f88a View commit details
  2. Merge branch '4.4' into 5.4

    * 4.4:
      CS fixes
      Bump Symfony version to 4.4.44
      Update VERSION for 4.4.43
      Update CONTRIBUTORS for 4.4.43
      Update CHANGELOG for 4.4.43
    nicolas-grekas committed Jun 27, 2022
    Copy the full SHA
    614dbcd View commit details

Commits on Jul 20, 2022

  1. Copy the full SHA
    102da63 View commit details
  2. Fix CS

    fabpot committed Jul 20, 2022
    Copy the full SHA
    a226ce5 View commit details

Commits on Jul 27, 2022

  1. Copy the full SHA
    03ee09e View commit details

Commits on Jul 28, 2022

  1. Merge branch '4.4' into 5.4

    * 4.4:
      [HttpClient] Fix the CS fix
      Workaround disabled "var_dump"
      [Serializer] Respect default context in DateTimeNormalizer::denormalize
    
    # Conflicts:
    #	src/Symfony/Component/Debug/ErrorHandler.php
    #	src/Symfony/Component/HttpClient/HttpClientTrait.php
    #	src/Symfony/Component/HttpKernel/EventListener/DebugHandlersListener.php
    ogizanagi committed Jul 28, 2022
    Copy the full SHA
    31b1549 View commit details
Showing with 57 additions and 7 deletions.
  1. +1 −1 DeprecationErrorHandler.php
  2. +1 −1 Legacy/SymfonyTestsListenerTrait.php
  3. +32 −0 Tests/FailTests/NoAssertionsTestNotRisky.php
  4. +18 −0 Tests/expectnotrisky.phpt
  5. +5 −5 bin/simple-phpunit.php
2 changes: 1 addition & 1 deletion DeprecationErrorHandler.php
Original file line number Diff line number Diff line change
@@ -188,7 +188,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']) {
2 changes: 1 addition & 1 deletion Legacy/SymfonyTestsListenerTrait.php
Original file line number Diff line number Diff line change
@@ -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);
}

32 changes: 32 additions & 0 deletions Tests/FailTests/NoAssertionsTestNotRisky.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* 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();
}
}
18 changes: 18 additions & 0 deletions Tests/expectnotrisky.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
--TEST--
Test NoAssertionsTestNotRisky not risky test
--SKIPIF--
<?php if ('\\' === DIRECTORY_SEPARATOR && !extension_loaded('mbstring')) die('Skipping on Windows without mbstring');
--FILE--
<?php
$test = realpath(__DIR__.'/FailTests/NoAssertionsTestNotRisky.php');
passthru('php '.getenv('SYMFONY_SIMPLE_PHPUNIT_BIN_DIR').'/simple-phpunit.php --fail-on-risky --colors=never '.$test);
?>
--EXPECTF--
PHPUnit %s

%ATesting Symfony\Bridge\PhpUnit\Tests\FailTests\NoAssertionsTestNotRisky
. 1 / 1 (100%)

Time: %s, Memory: %s

OK (1 test, 0 assertions)
10 changes: 5 additions & 5 deletions bin/simple-phpunit.php
Original file line number Diff line number Diff line change
@@ -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');
}
@@ -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';