Run the phpunit-bridge from a PR
This commit is contained in:
parent
8173dafda4
commit
7bdd8ff872
1
.gitignore
vendored
1
.gitignore
vendored
@ -2,6 +2,7 @@ vendor/
|
|||||||
composer.lock
|
composer.lock
|
||||||
phpunit.xml
|
phpunit.xml
|
||||||
.php_cs.cache
|
.php_cs.cache
|
||||||
|
.phpunit.result.cache
|
||||||
composer.phar
|
composer.phar
|
||||||
package.tar
|
package.tar
|
||||||
/packages.json
|
/packages.json
|
||||||
|
20
.travis.yml
20
.travis.yml
@ -194,6 +194,22 @@ before_install:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
install:
|
install:
|
||||||
|
- |
|
||||||
|
# Install the phpunit-bridge from a PR if required
|
||||||
|
#
|
||||||
|
# To run a PR with a patched phpunit-bridge, first submit the path for the
|
||||||
|
# phpunit-bridge as a separate PR against the next feature-branch then
|
||||||
|
# uncomment and update the following line with that PR number
|
||||||
|
#SYMFONY_PHPUNIT_BRIDGE_PR=32886
|
||||||
|
|
||||||
|
if [[ $SYMFONY_PHPUNIT_BRIDGE_PR ]]; then
|
||||||
|
git fetch origin refs/pull/$SYMFONY_PHPUNIT_BRIDGE_PR/head
|
||||||
|
git rm -rq src/Symfony/Bridge/PhpUnit
|
||||||
|
git checkout -q FETCH_HEAD -- src/Symfony/Bridge/PhpUnit
|
||||||
|
SYMFONY_VERSION=$(cat src/Symfony/Bridge/PhpUnit/composer.json | grep '^ *"dev-master". *"[1-9]' | grep -o '[0-9.]*')
|
||||||
|
sed -i 's/"symfony\/phpunit-bridge": ".*"/"symfony\/phpunit-bridge": "'$SYMFONY_VERSION'.x@dev"/' composer.json
|
||||||
|
fi
|
||||||
|
|
||||||
- |
|
- |
|
||||||
# Create local composer packages for each patched components and reference them in composer.json files when cross-testing components
|
# Create local composer packages for each patched components and reference them in composer.json files when cross-testing components
|
||||||
if [[ ! $deps ]]; then
|
if [[ ! $deps ]]; then
|
||||||
@ -206,6 +222,10 @@ install:
|
|||||||
mv composer.json composer.json.phpunit &&
|
mv composer.json composer.json.phpunit &&
|
||||||
mv composer.json.orig composer.json
|
mv composer.json.orig composer.json
|
||||||
fi
|
fi
|
||||||
|
if [[ $SYMFONY_PHPUNIT_BRIDGE_PR ]]; then
|
||||||
|
git rm -fq -- src/Symfony/Bridge/PhpUnit/composer.json
|
||||||
|
git diff --staged -- src/Symfony/Bridge/PhpUnit/ | git apply -R --index
|
||||||
|
fi
|
||||||
|
|
||||||
- |
|
- |
|
||||||
# For the master branch, when deps=high, the version before master is checked out and tested with the locally patched components
|
# For the master branch, when deps=high, the version before master is checked out and tested with the locally patched components
|
||||||
|
@ -1,35 +0,0 @@
|
|||||||
<?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;
|
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
|
||||||
|
|
||||||
// A trait to provide forward compatibility with newest PHPUnit versions
|
|
||||||
|
|
||||||
$r = new \ReflectionClass(TestCase::class);
|
|
||||||
|
|
||||||
if (\PHP_VERSION_ID < 70000 || !$r->hasMethod('createMock') || !$r->getMethod('createMock')->hasReturnType()) {
|
|
||||||
trait ForwardCompatTestTrait
|
|
||||||
{
|
|
||||||
use Legacy\ForwardCompatTestTraitForV5;
|
|
||||||
}
|
|
||||||
} elseif ($r->getMethod('tearDown')->hasReturnType()) {
|
|
||||||
trait ForwardCompatTestTrait
|
|
||||||
{
|
|
||||||
use Legacy\ForwardCompatTestTraitForV8;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
trait ForwardCompatTestTrait
|
|
||||||
{
|
|
||||||
use Legacy\ForwardCompatTestTraitForV7;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,306 +0,0 @@
|
|||||||
<?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;
|
|
||||||
|
|
||||||
use PHPUnit\Framework\MockObject\MockObject;
|
|
||||||
use PHPUnit\Framework\TestCase;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @internal
|
|
||||||
*/
|
|
||||||
trait ForwardCompatTestTraitForV5
|
|
||||||
{
|
|
||||||
private $forwardCompatExpectedExceptionMessage = '';
|
|
||||||
private $forwardCompatExpectedExceptionCode = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public static function setUpBeforeClass()
|
|
||||||
{
|
|
||||||
self::doSetUpBeforeClass();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public static function tearDownAfterClass()
|
|
||||||
{
|
|
||||||
self::doTearDownAfterClass();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
protected function setUp()
|
|
||||||
{
|
|
||||||
self::doSetUp();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
protected function tearDown()
|
|
||||||
{
|
|
||||||
self::doTearDown();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
private static function doSetUpBeforeClass()
|
|
||||||
{
|
|
||||||
parent::setUpBeforeClass();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
private static function doTearDownAfterClass()
|
|
||||||
{
|
|
||||||
parent::tearDownAfterClass();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
private function doSetUp()
|
|
||||||
{
|
|
||||||
parent::setUp();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
private function doTearDown()
|
|
||||||
{
|
|
||||||
parent::tearDown();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $originalClassName
|
|
||||||
*
|
|
||||||
* @return MockObject
|
|
||||||
*/
|
|
||||||
protected function createMock($originalClassName)
|
|
||||||
{
|
|
||||||
$mock = $this->getMockBuilder($originalClassName)
|
|
||||||
->disableOriginalConstructor()
|
|
||||||
->disableOriginalClone()
|
|
||||||
->disableArgumentCloning();
|
|
||||||
|
|
||||||
if (method_exists($mock, 'disallowMockingUnknownTypes')) {
|
|
||||||
$mock = $mock->disallowMockingUnknownTypes();
|
|
||||||
}
|
|
||||||
|
|
||||||
return $mock->getMock();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $message
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public static function assertIsArray($actual, $message = '')
|
|
||||||
{
|
|
||||||
static::assertInternalType('array', $actual, $message);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $message
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public static function assertIsBool($actual, $message = '')
|
|
||||||
{
|
|
||||||
static::assertInternalType('bool', $actual, $message);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $message
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public static function assertIsFloat($actual, $message = '')
|
|
||||||
{
|
|
||||||
static::assertInternalType('float', $actual, $message);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $message
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public static function assertIsInt($actual, $message = '')
|
|
||||||
{
|
|
||||||
static::assertInternalType('int', $actual, $message);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $message
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public static function assertIsNumeric($actual, $message = '')
|
|
||||||
{
|
|
||||||
static::assertInternalType('numeric', $actual, $message);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $message
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public static function assertIsObject($actual, $message = '')
|
|
||||||
{
|
|
||||||
static::assertInternalType('object', $actual, $message);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $message
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public static function assertIsResource($actual, $message = '')
|
|
||||||
{
|
|
||||||
static::assertInternalType('resource', $actual, $message);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $message
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public static function assertIsString($actual, $message = '')
|
|
||||||
{
|
|
||||||
static::assertInternalType('string', $actual, $message);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $message
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public static function assertIsScalar($actual, $message = '')
|
|
||||||
{
|
|
||||||
static::assertInternalType('scalar', $actual, $message);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $message
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public static function assertIsCallable($actual, $message = '')
|
|
||||||
{
|
|
||||||
static::assertInternalType('callable', $actual, $message);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $message
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public static function assertIsIterable($actual, $message = '')
|
|
||||||
{
|
|
||||||
static::assertInternalType('iterable', $actual, $message);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $exception
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function expectException($exception)
|
|
||||||
{
|
|
||||||
if (method_exists(TestCase::class, 'expectException')) {
|
|
||||||
parent::expectException($exception);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
parent::setExpectedException($exception, $this->forwardCompatExpectedExceptionMessage, $this->forwardCompatExpectedExceptionCode);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function expectExceptionCode($code)
|
|
||||||
{
|
|
||||||
if (method_exists(TestCase::class, 'expectExceptionCode')) {
|
|
||||||
parent::expectExceptionCode($code);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->forwardCompatExpectedExceptionCode = $code;
|
|
||||||
parent::setExpectedException(parent::getExpectedException(), $this->forwardCompatExpectedExceptionMessage, $this->forwardCompatExpectedExceptionCode);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $message
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function expectExceptionMessage($message)
|
|
||||||
{
|
|
||||||
if (method_exists(TestCase::class, 'expectExceptionMessage')) {
|
|
||||||
parent::expectExceptionMessage($message);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->forwardCompatExpectedExceptionMessage = $message;
|
|
||||||
parent::setExpectedException(parent::getExpectedException(), $this->forwardCompatExpectedExceptionMessage, $this->forwardCompatExpectedExceptionCode);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $messageRegExp
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function expectExceptionMessageRegExp($messageRegExp)
|
|
||||||
{
|
|
||||||
if (method_exists(TestCase::class, 'expectExceptionMessageRegExp')) {
|
|
||||||
parent::expectExceptionMessageRegExp($messageRegExp);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
parent::setExpectedExceptionRegExp(parent::getExpectedException(), $messageRegExp, $this->forwardCompatExpectedExceptionCode);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $exceptionMessage
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function setExpectedException($exceptionName, $exceptionMessage = '', $exceptionCode = null)
|
|
||||||
{
|
|
||||||
$this->forwardCompatExpectedExceptionMessage = $exceptionMessage;
|
|
||||||
$this->forwardCompatExpectedExceptionCode = $exceptionCode;
|
|
||||||
|
|
||||||
parent::setExpectedException($exceptionName, $exceptionMessage, $exceptionCode);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $exceptionMessageRegExp
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function setExpectedExceptionRegExp($exceptionName, $exceptionMessageRegExp = '', $exceptionCode = null)
|
|
||||||
{
|
|
||||||
$this->forwardCompatExpectedExceptionCode = $exceptionCode;
|
|
||||||
|
|
||||||
parent::setExpectedExceptionRegExp($exceptionName, $exceptionMessageRegExp, $exceptionCode);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,35 +0,0 @@
|
|||||||
<?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;
|
|
||||||
|
|
||||||
use PHPUnit\Framework\MockObject\MockObject;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @internal
|
|
||||||
*/
|
|
||||||
trait ForwardCompatTestTraitForV7
|
|
||||||
{
|
|
||||||
use ForwardCompatTestTraitForV5;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string|string[] $originalClassName
|
|
||||||
*/
|
|
||||||
protected function createMock($originalClassName): MockObject
|
|
||||||
{
|
|
||||||
return $this->getMockBuilder($originalClassName)
|
|
||||||
->disableOriginalConstructor()
|
|
||||||
->disableOriginalClone()
|
|
||||||
->disableArgumentCloning()
|
|
||||||
->disallowMockingUnknownTypes()
|
|
||||||
->getMock();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,58 +0,0 @@
|
|||||||
<?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 ForwardCompatTestTraitForV8
|
|
||||||
{
|
|
||||||
public static function setUpBeforeClass(): void
|
|
||||||
{
|
|
||||||
self::doSetUpBeforeClass();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function tearDownAfterClass(): void
|
|
||||||
{
|
|
||||||
self::doTearDownAfterClass();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
self::doSetUp();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function tearDown(): void
|
|
||||||
{
|
|
||||||
self::doTearDown();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static function doSetUpBeforeClass(): void
|
|
||||||
{
|
|
||||||
parent::setUpBeforeClass();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static function doTearDownAfterClass(): void
|
|
||||||
{
|
|
||||||
parent::tearDownAfterClass();
|
|
||||||
}
|
|
||||||
|
|
||||||
private function doSetUp(): void
|
|
||||||
{
|
|
||||||
parent::setUp();
|
|
||||||
}
|
|
||||||
|
|
||||||
private function doTearDown(): void
|
|
||||||
{
|
|
||||||
parent::tearDown();
|
|
||||||
}
|
|
||||||
}
|
|
Reference in New Issue
Block a user