minor #24685 Make it easy for Drupal to use the PHPUnit bridge (alexpott)

This PR was squashed before being merged into the 3.3 branch (closes #24685).

Discussion
----------

Make it easy for Drupal to use the PHPUnit bridge

| Q             | A
| ------------- | ---
| Branch?       | 3.3 <!-- see comment below -->
| Bug fix?      | no
| New feature?  | no <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks?    | no
| Deprecations? | no <!-- don't forget to update UPGRADE-*.md files -->
| Tests pass?   | yes
| Fixed tickets | #... <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!--highly recommended for new features-->

<!--
- Bug fixes must be submitted against the lowest branch where they apply
  (lowest branches are regularly merged to upper ones so they get the fixes too).
- Features and deprecations must be submitted against the 3.4,
  legacy code removals go to the master branch.
- Please fill in this template according to the PR you're about to submit.
- Replace this comment by a description of what your PR is solving.
-->

Drupal doesn't use src/Symfony/Bridge/PhpUnit/bin/simple-phpunit but would like to use the deprecation collection features of src/Symfony/Bridge/PhpUnit. The checks in src/Symfony/Bridge/PhpUnit/bootstrap.php mean that this is difficult because they rely on simple-phpunit - but I'm not sure that that is necessary.

Commits
-------

1de6bf8 Make it easy for Drupal to use the PHPUnit bridge
This commit is contained in:
Nicolas Grekas 2017-10-25 16:41:27 +02:00
commit 41509a2dcf
7 changed files with 37 additions and 13 deletions

View File

@ -12,8 +12,12 @@ $vendor = __DIR__;
while (!file_exists($vendor.'/vendor')) {
$vendor = dirname($vendor);
}
define('PHPUNIT_COMPOSER_INSTALL', $vendor.'/vendor/autoload.php');
require PHPUNIT_COMPOSER_INSTALL;
// Fake class to ensure bootstrap.php calls DeprecationErrorHandler::register().
class PHPUnit_TextUI_Command
{
}
require $vendor.'/vendor/autoload.php';
require_once __DIR__.'/../../bootstrap.php';
@trigger_error('root deprecation', E_USER_DEPRECATED);

View File

@ -12,8 +12,12 @@ $vendor = __DIR__;
while (!file_exists($vendor.'/vendor')) {
$vendor = dirname($vendor);
}
define('PHPUNIT_COMPOSER_INSTALL', $vendor.'/vendor/autoload.php');
require PHPUNIT_COMPOSER_INSTALL;
// Fake class to ensure bootstrap.php calls DeprecationErrorHandler::register().
class PHPUnit_TextUI_Command
{
}
require $vendor.'/vendor/autoload.php';
require_once __DIR__.'/../../bootstrap.php';
echo (int) set_error_handler('var_dump');

View File

@ -12,8 +12,12 @@ $vendor = __DIR__;
while (!file_exists($vendor.'/vendor')) {
$vendor = dirname($vendor);
}
define('PHPUNIT_COMPOSER_INSTALL', $vendor.'/vendor/autoload.php');
require PHPUNIT_COMPOSER_INSTALL;
// Fake class to ensure bootstrap.php calls DeprecationErrorHandler::register().
class PHPUnit_TextUI_Command
{
}
require $vendor.'/vendor/autoload.php';
require_once __DIR__.'/../../bootstrap.php';
@trigger_error('root deprecation', E_USER_DEPRECATED);

View File

@ -12,8 +12,12 @@ $vendor = __DIR__;
while (!file_exists($vendor.'/vendor')) {
$vendor = dirname($vendor);
}
define('PHPUNIT_COMPOSER_INSTALL', $vendor.'/vendor/autoload.php');
require PHPUNIT_COMPOSER_INSTALL;
// Fake class to ensure bootstrap.php calls DeprecationErrorHandler::register().
class PHPUnit_TextUI_Command
{
}
require $vendor.'/vendor/autoload.php';
require_once __DIR__.'/../../bootstrap.php';
@trigger_error('root deprecation', E_USER_DEPRECATED);

View File

@ -12,8 +12,12 @@ $vendor = __DIR__;
while (!file_exists($vendor.'/vendor')) {
$vendor = dirname($vendor);
}
define('PHPUNIT_COMPOSER_INSTALL', $vendor.'/vendor/autoload.php');
require PHPUNIT_COMPOSER_INSTALL;
// Fake class to ensure bootstrap.php calls DeprecationErrorHandler::register().
class PHPUnit_TextUI_Command
{
}
require $vendor.'/vendor/autoload.php';
require_once __DIR__.'/../../bootstrap.php';
@trigger_error('root deprecation', E_USER_DEPRECATED);

View File

@ -12,8 +12,12 @@ $vendor = __DIR__;
while (!file_exists($vendor.'/vendor')) {
$vendor = dirname($vendor);
}
define('PHPUNIT_COMPOSER_INSTALL', $vendor.'/vendor/autoload.php');
require PHPUNIT_COMPOSER_INSTALL;
// Fake class to ensure bootstrap.php calls DeprecationErrorHandler::register().
class PHPUnit_TextUI_Command
{
}
require $vendor.'/vendor/autoload.php';
require_once __DIR__.'/../../bootstrap.php';
require __DIR__.'/fake_vendor/autoload.php';
require __DIR__.'/fake_vendor/acme/lib/deprecation_riddled.php';

View File

@ -13,7 +13,7 @@ use Doctrine\Common\Annotations\AnnotationRegistry;
use Symfony\Bridge\PhpUnit\DeprecationErrorHandler;
// Detect if we're loaded by an actual run of phpunit
if (!defined('PHPUNIT_COMPOSER_INSTALL') && !class_exists('PHPUnit_TextUI_Command', false) && !class_exists('PHPUnit\TextUI\Command', false)) {
if (!class_exists('PHPUnit_TextUI_Command', false) && !class_exists('PHPUnit\TextUI\Command', false)) {
if ($ser = getenv('SYMFONY_DEPRECATIONS_SERIALIZE')) {
DeprecationErrorHandler::collectDeprecations($ser);
}