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: v4.4.15
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: v4.4.16
Choose a head ref

Commits on Sep 14, 2020

  1. Copy the full SHA
    260a244 View commit details

Commits on Oct 6, 2020

  1. Merge branch '3.4' into 4.4

    * 3.4:
      Remove "branch-alias", populate "version"
    nicolas-grekas committed Oct 6, 2020
    Copy the full SHA
    d2119bc View commit details
  2. Copy the full SHA
    3d765c6 View commit details
  3. Merge branch '3.4' into 4.4

    * 3.4:
      Update versions in composer.json
    nicolas-grekas committed Oct 6, 2020
    Copy the full SHA
    4f84800 View commit details
  4. Copy the full SHA
    1313d3c View commit details

Commits on Oct 7, 2020

  1. bug #38444 [PhpUnitBridge] fix running parallel tests with phpunit 9 …

    …(nicolas-grekas)
    
    This PR was merged into the 3.4 branch.
    
    Discussion
    ----------
    
    [PhpUnitBridge] fix running parallel tests with phpunit 9
    
    | Q             | A
    | ------------- | ---
    | Branch?       | 3.4
    | Bug fix?      | yes
    | New feature?  | no
    | Deprecations? | no
    | Tickets       | Fix #38337
    | License       | MIT
    | Doc PR        | -
    
    Commits
    -------
    
    6b13ffaef2 [PhpUnitBridge] fix running parallel tests with phpunit 9
    fabpot committed Oct 7, 2020
    Copy the full SHA
    f69f18f View commit details

Commits on Oct 12, 2020

  1. Merge branch '3.4' into 4.4

    * 3.4:
      Disable the PhpUnit bridge when testing it
      [PropertyInfo] Support for the mixed type.
      [Form] Add Bosnian (bs) validators translation
      [Form] Add missing Serbian (latn & cyrl) validators translation
      [Form] [Validator] added pt_BR translations
      Estonian update
      [PhpUnitBridge] fix running parallel tests with phpunit 9
      [VarDumper] fix truncating big arrays
    nicolas-grekas committed Oct 12, 2020
    Copy the full SHA
    88f44e4 View commit details

Commits on Oct 13, 2020

  1. Copy the full SHA
    7389acf View commit details
  2. Merge branch '3.4' into 4.4

    * 3.4:
      Remove "version" from composer.json files, use "branch-version" instead
    nicolas-grekas committed Oct 13, 2020
    Copy the full SHA
    514676a View commit details
  3. Fix branch-version

    nicolas-grekas committed Oct 13, 2020
    Copy the full SHA
    385f640 View commit details
  4. Merge branch '3.4' into 4.4

    * 3.4:
      Fix branch-version
    nicolas-grekas committed Oct 13, 2020
    Copy the full SHA
    83a1178 View commit details

Commits on Oct 22, 2020

  1. Unverified

    This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
    Copy the full SHA
    c4eed56 View commit details
  2. Unverified

    This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
    Copy the full SHA
    83fc0dd View commit details
  3. Unverified

    This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
    Copy the full SHA
    a7b22e8 View commit details

Commits on Oct 23, 2020

  1. bug #38681 [PHPUnitBridge] Support PHPUnit 8 and PHPUnit 9 in constra…

    …int compatibility trait (alcaeus)
    
    This PR was merged into the 4.4 branch.
    
    Discussion
    ----------
    
    [PHPUnitBridge] Support PHPUnit 8 and PHPUnit 9 in constraint compatibility trait
    
    | Q             | A
    | ------------- | ---
    | Branch?       | 5.x
    | Bug fix?      | not really
    | New feature?  | yes
    | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
    | License       | MIT
    
    This expands the compatibility layer for PHPUnit constraints by supporting PHPUnit 8 and PHPUnit 9. Support for the latter requires also adding the `evaluate` method to the trait, as this method gets a signature change in PHPUnit 9.
    
    Commits
    -------
    
    f79ad80009 Support PHPUnit 8 and PHPUnit 9 in constraint compatibility trait
    fabpot committed Oct 23, 2020
    Copy the full SHA
    d5477cd View commit details
  2. bug #38680 [PhpUnitBridge] Support new expect methods in test case po…

    …lyfill (alcaeus)
    
    This PR was merged into the 4.4 branch.
    
    Discussion
    ----------
    
    [PhpUnitBridge] Support new expect methods in test case polyfill
    
    | Q             | A
    | ------------- | ---
    | Branch?       | 5.x
    | Bug fix?      | no
    | New feature?  | yes
    | Deprecations? | no
    | License       | MIT
    
    This PR adds the `expectError`, `expectWarning`, `expectNotice`, ~and `expectDeprecation`~ methods to the test case polyfill.
    
    ~Note that I saw a `expectDeprecation` message in `ExpectDeprecationTrait`, but I couldn't quite figure out what it's supposed to do. Please let me know if the `expectDeprecation` method needs to be removed from the test polyfill.~
    
    Commits
    -------
    
    8a49a263a2 Add expectDeprecation, expectNotice, expectWarning, and expectError to TestCase polyfill
    fabpot committed Oct 23, 2020
    Copy the full SHA
    05b1d00 View commit details

Commits on Oct 24, 2020

  1. Copy the full SHA
    64fe24c View commit details
  2. Copy the full SHA
    8d05c61 View commit details
  3. Merge branch '3.4' into 4.4

    * 3.4:
      Remove branch-version (keep them for contracts only)
      [Serializer] fix decoding float XML attributes starting with 0
      add missing dutch translations
      [Validator] Add missing romanian translations
      do not translate null placeholders or titles
    nicolas-grekas committed Oct 24, 2020
    Copy the full SHA
    0517712 View commit details
  4. fix merge

    nicolas-grekas committed Oct 24, 2020
    Copy the full SHA
    e283912 View commit details
  5. Copy the full SHA
    d53f4e6 View commit details
12 changes: 11 additions & 1 deletion ConstraintTrait.php
Original file line number Diff line number Diff line change
@@ -20,9 +20,19 @@ trait ConstraintTrait
{
use Legacy\ConstraintTraitForV6;
}
} else {
} elseif ($r->getProperty('exporter')->isProtected()) {
trait ConstraintTrait
{
use Legacy\ConstraintTraitForV7;
}
} elseif (\PHP_VERSION < 70100 || !$r->getMethod('evaluate')->hasReturnType()) {
trait ConstraintTrait
{
use Legacy\ConstraintTraitForV8;
}
} else {
trait ConstraintTrait
{
use Legacy\ConstraintTraitForV9;
}
}
62 changes: 62 additions & 0 deletions Legacy/ConstraintLogicTrait.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?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\Legacy;

/**
* @internal
*/
trait ConstraintLogicTrait
{
private function doEvaluate($other, $description, $returnResult)
{
$success = false;

if ($this->matches($other)) {
$success = true;
}

if ($returnResult) {
return $success;
}

if (!$success) {
$this->fail($other, $description);
}

return null;
}

private function doAdditionalFailureDescription($other): string
{
return '';
}

private function doCount(): int
{
return 1;
}

private function doFailureDescription($other): string
{
return $this->exporter()->export($other).' '.$this->toString();
}

private function doMatches($other): bool
{
return false;
}

private function doToString(): string
{
return '';
}
}
27 changes: 27 additions & 0 deletions Legacy/ConstraintTraitForV6.php
Original file line number Diff line number Diff line change
@@ -18,6 +18,14 @@
*/
trait ConstraintTraitForV6
{
/**
* @return bool|null
*/
public function evaluate($other, $description = '', $returnResult = false)
{
return $this->doEvaluate($other, $description, $returnResult);
}

/**
* @return int
*/
@@ -86,6 +94,25 @@ private function doCount()
return 1;
}

private function doEvaluate($other, $description, $returnResult)
{
$success = false;

if ($this->matches($other)) {
$success = true;
}

if ($returnResult) {
return $success;
}

if (!$success) {
$this->fail($other, $description);
}

return null;
}

private function doFailureDescription($other)
{
return $this->exporter()->export($other).' '.$this->toString();
46 changes: 21 additions & 25 deletions Legacy/ConstraintTraitForV7.php
Original file line number Diff line number Diff line change
@@ -11,11 +11,23 @@

namespace Symfony\Bridge\PhpUnit\Legacy;

use SebastianBergmann\Exporter\Exporter;

/**
* @internal
*/
trait ConstraintTraitForV7
{
use ConstraintLogicTrait;

/**
* @return bool|null
*/
public function evaluate($other, $description = '', $returnResult = false)
{
return $this->doEvaluate($other, $description, $returnResult);
}

public function count(): int
{
return $this->doCount();
@@ -31,38 +43,22 @@ protected function additionalFailureDescription($other): string
return $this->doAdditionalFailureDescription($other);
}

protected function failureDescription($other): string
{
return $this->doFailureDescription($other);
}

protected function matches($other): bool
{
return $this->doMatches($other);
}

private function doAdditionalFailureDescription($other): string
{
return '';
}

private function doCount(): int
protected function exporter(): Exporter
{
return 1;
}
if (null !== $this->exporter) {
$this->exporter = new Exporter();
}

private function doFailureDescription($other): string
{
return $this->exporter()->export($other).' '.$this->toString();
return $this->exporter;
}

private function doMatches($other): bool
protected function failureDescription($other): string
{
return false;
return $this->doFailureDescription($other);
}

private function doToString(): string
protected function matches($other): bool
{
return '';
return $this->doMatches($other);
}
}
53 changes: 53 additions & 0 deletions Legacy/ConstraintTraitForV8.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?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\Legacy;

/**
* @internal
*/
trait ConstraintTraitForV8
{
use ConstraintLogicTrait;

/**
* @return bool|null
*/
public function evaluate($other, $description = '', $returnResult = false)
{
return $this->doEvaluate($other, $description, $returnResult);
}

public function count(): int
{
return $this->doCount();
}

public function toString(): string
{
return $this->doToString();
}

protected function additionalFailureDescription($other): string
{
return $this->doAdditionalFailureDescription($other);
}

protected function failureDescription($other): string
{
return $this->doFailureDescription($other);
}

protected function matches($other): bool
{
return $this->doMatches($other);
}
}
50 changes: 50 additions & 0 deletions Legacy/ConstraintTraitForV9.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?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\Legacy;

/**
* @internal
*/
trait ConstraintTraitForV9
{
use ConstraintLogicTrait;

public function evaluate($other, string $description = '', bool $returnResult = false): ?bool
{
return $this->doEvaluate($other, $description, $returnResult);
}

public function count(): int
{
return $this->doCount();
}

public function toString(): string
{
return $this->doToString();
}

protected function additionalFailureDescription($other): string
{
return $this->doAdditionalFailureDescription($other);
}

protected function failureDescription($other): string
{
return $this->doFailureDescription($other);
}

protected function matches($other): bool
{
return $this->doMatches($other);
}
}
98 changes: 95 additions & 3 deletions Legacy/PolyfillTestCaseTrait.php
Original file line number Diff line number Diff line change
@@ -11,6 +11,9 @@

namespace Symfony\Bridge\PhpUnit\Legacy;

use PHPUnit\Framework\Error\Error;
use PHPUnit\Framework\Error\Notice;
use PHPUnit\Framework\Error\Warning;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;

@@ -66,9 +69,7 @@ protected function createPartialMock($originalClassName, array $methods)
*/
public function expectException($exception)
{
$property = new \ReflectionProperty(TestCase::class, 'expectedException');
$property->setAccessible(true);
$property->setValue($this, $exception);
$this->doExpectException($exception);
}

/**
@@ -116,4 +117,95 @@ public function expectExceptionMessageRegExp($messageRegExp)
$property->setAccessible(true);
$property->setValue($this, $messageRegExp);
}

/**
* @return void
*/
public function expectNotice()
{
$this->doExpectException(Notice::class);
}

/**
* @param string $message
*
* @return void
*/
public function expectNoticeMessage($message)
{
$this->expectExceptionMessage($message);
}

/**
* @param string $regularExpression
*
* @return void
*/
public function expectNoticeMessageMatches($regularExpression)
{
$this->expectExceptionMessageMatches($regularExpression);
}

/**
* @return void
*/
public function expectWarning()
{
$this->doExpectException(Warning::class);
}

/**
* @param string $message
*
* @return void
*/
public function expectWarningMessage($message)
{
$this->expectExceptionMessage($message);
}

/**
* @param string $regularExpression
*
* @return void
*/
public function expectWarningMessageMatches($regularExpression)
{
$this->expectExceptionMessageMatches($regularExpression);
}

/**
* @return void
*/
public function expectError()
{
$this->doExpectException(Error::class);
}

/**
* @param string $message
*
* @return void
*/
public function expectErrorMessage($message)
{
$this->expectExceptionMessage($message);
}

/**
* @param string $regularExpression
*
* @return void
*/
public function expectErrorMessageMatches($regularExpression)
{
$this->expectExceptionMessageMatches($regularExpression);
}

private function doExpectException($exception)
{
$property = new \ReflectionProperty(TestCase::class, 'expectedException');
$property->setAccessible(true);
$property->setValue($this, $exception);
}
}
2 changes: 1 addition & 1 deletion Tests/DeprecationErrorHandler/DeprecationTest.php
Original file line number Diff line number Diff line change
@@ -41,7 +41,7 @@ private static function getVendorDir()
}

self::$vendorDir = $vendorDir;
mkdir($vendorDir.'/myfakevendor/myfakepackage2');
@mkdir($vendorDir.'/myfakevendor/myfakepackage2');
touch($vendorDir.'/myfakevendor/myfakepackage1/MyFakeFile1.php');
touch($vendorDir.'/myfakevendor/myfakepackage1/MyFakeFile2.php');
touch($vendorDir.'/myfakevendor/myfakepackage2/MyFakeFile.php');
8 changes: 4 additions & 4 deletions bin/simple-phpunit.php
Original file line number Diff line number Diff line change
@@ -95,7 +95,7 @@

if (\PHP_VERSION_ID >= 80000) {
// PHP 8 requires PHPUnit 9.3+
$PHPUNIT_VERSION = $getEnvVar('SYMFONY_PHPUNIT_VERSION', '9.3');
$PHPUNIT_VERSION = $getEnvVar('SYMFONY_PHPUNIT_VERSION', '9.4');
} elseif (\PHP_VERSION_ID >= 70200) {
// PHPUnit 8 requires PHP 7.2+
$PHPUNIT_VERSION = $getEnvVar('SYMFONY_PHPUNIT_VERSION', '8.3');
@@ -196,7 +196,7 @@
'requires' => ['php' => '*'],
];

$stableVersions = array_filter($info['versions'], function($v) {
$stableVersions = array_filter($info['versions'], function ($v) {
return !preg_match('/-dev$|^dev-/', $v);
});

@@ -264,11 +264,11 @@ class SymfonyExcludeListPhpunit {}
if (method_exists('PHPUnit\Util\ExcludeList', 'addDirectory')) {
(new PHPUnit\Util\Excludelist())->getExcludedDirectories();
PHPUnit\Util\ExcludeList::addDirectory(\dirname((new \ReflectionClass('SymfonyExcludeListPhpunit'))->getFileName()));
PHPUnit\Util\ExcludeList::addDirectory(\dirname((new \ReflectionClass('SymfonyExcludeListSimplePhpunit'))->getFileName()));
class_exists('SymfonyExcludeListSimplePhpunit', false) && PHPUnit\Util\ExcludeList::addDirectory(\dirname((new \ReflectionClass('SymfonyExcludeListSimplePhpunit'))->getFileName()));
} elseif (method_exists('PHPUnit\Util\Blacklist', 'addDirectory')) {
(new PHPUnit\Util\BlackList())->getBlacklistedDirectories();
PHPUnit\Util\Blacklist::addDirectory(\dirname((new \ReflectionClass('SymfonyExcludeListPhpunit'))->getFileName()));
PHPUnit\Util\Blacklist::addDirectory(\dirname((new \ReflectionClass('SymfonyExcludeListSimplePhpunit'))->getFileName()));
class_exists('SymfonyExcludeListSimplePhpunit', false) && PHPUnit\Util\Blacklist::addDirectory(\dirname((new \ReflectionClass('SymfonyExcludeListSimplePhpunit'))->getFileName()));
} else {
PHPUnit\Util\Blacklist::$blacklistedClassNames['SymfonyExcludeListPhpunit'] = 1;
PHPUnit\Util\Blacklist::$blacklistedClassNames['SymfonyExcludeListSimplePhpunit'] = 1;
3 changes: 0 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
@@ -38,9 +38,6 @@
],
"minimum-stability": "dev",
"extra": {
"branch-alias": {
"dev-master": "4.4-dev"
},
"thanks": {
"name": "phpunit/phpunit",
"url": "https://github.com/sebastianbergmann/phpunit"