Skip to content

Commit 41509a2

Browse files
minor symfony#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 symfony#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
2 parents 3e3e74c + 1de6bf8 commit 41509a2

File tree

7 files changed

+37
-13
lines changed

7 files changed

+37
-13
lines changed

src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/default.phpt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,12 @@ $vendor = __DIR__;
1212
while (!file_exists($vendor.'/vendor')) {
1313
$vendor = dirname($vendor);
1414
}
15-
define('PHPUNIT_COMPOSER_INSTALL', $vendor.'/vendor/autoload.php');
16-
require PHPUNIT_COMPOSER_INSTALL;
15+
// Fake class to ensure bootstrap.php calls DeprecationErrorHandler::register().
16+
class PHPUnit_TextUI_Command
17+
{
18+
19+
}
20+
require $vendor.'/vendor/autoload.php';
1721
require_once __DIR__.'/../../bootstrap.php';
1822

1923
@trigger_error('root deprecation', E_USER_DEPRECATED);

src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/disabled.phpt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,12 @@ $vendor = __DIR__;
1212
while (!file_exists($vendor.'/vendor')) {
1313
$vendor = dirname($vendor);
1414
}
15-
define('PHPUNIT_COMPOSER_INSTALL', $vendor.'/vendor/autoload.php');
16-
require PHPUNIT_COMPOSER_INSTALL;
15+
// Fake class to ensure bootstrap.php calls DeprecationErrorHandler::register().
16+
class PHPUnit_TextUI_Command
17+
{
18+
19+
}
20+
require $vendor.'/vendor/autoload.php';
1721
require_once __DIR__.'/../../bootstrap.php';
1822

1923
echo (int) set_error_handler('var_dump');

src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/regexp.phpt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,12 @@ $vendor = __DIR__;
1212
while (!file_exists($vendor.'/vendor')) {
1313
$vendor = dirname($vendor);
1414
}
15-
define('PHPUNIT_COMPOSER_INSTALL', $vendor.'/vendor/autoload.php');
16-
require PHPUNIT_COMPOSER_INSTALL;
15+
// Fake class to ensure bootstrap.php calls DeprecationErrorHandler::register().
16+
class PHPUnit_TextUI_Command
17+
{
18+
19+
}
20+
require $vendor.'/vendor/autoload.php';
1721
require_once __DIR__.'/../../bootstrap.php';
1822

1923
@trigger_error('root deprecation', E_USER_DEPRECATED);

src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/weak.phpt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,12 @@ $vendor = __DIR__;
1212
while (!file_exists($vendor.'/vendor')) {
1313
$vendor = dirname($vendor);
1414
}
15-
define('PHPUNIT_COMPOSER_INSTALL', $vendor.'/vendor/autoload.php');
16-
require PHPUNIT_COMPOSER_INSTALL;
15+
// Fake class to ensure bootstrap.php calls DeprecationErrorHandler::register().
16+
class PHPUnit_TextUI_Command
17+
{
18+
19+
}
20+
require $vendor.'/vendor/autoload.php';
1721
require_once __DIR__.'/../../bootstrap.php';
1822

1923
@trigger_error('root deprecation', E_USER_DEPRECATED);

src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/weak_vendors_on_non_vendor.phpt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,12 @@ $vendor = __DIR__;
1212
while (!file_exists($vendor.'/vendor')) {
1313
$vendor = dirname($vendor);
1414
}
15-
define('PHPUNIT_COMPOSER_INSTALL', $vendor.'/vendor/autoload.php');
16-
require PHPUNIT_COMPOSER_INSTALL;
15+
// Fake class to ensure bootstrap.php calls DeprecationErrorHandler::register().
16+
class PHPUnit_TextUI_Command
17+
{
18+
19+
}
20+
require $vendor.'/vendor/autoload.php';
1721
require_once __DIR__.'/../../bootstrap.php';
1822

1923
@trigger_error('root deprecation', E_USER_DEPRECATED);

src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/weak_vendors_on_vendor.phpt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,12 @@ $vendor = __DIR__;
1212
while (!file_exists($vendor.'/vendor')) {
1313
$vendor = dirname($vendor);
1414
}
15-
define('PHPUNIT_COMPOSER_INSTALL', $vendor.'/vendor/autoload.php');
16-
require PHPUNIT_COMPOSER_INSTALL;
15+
// Fake class to ensure bootstrap.php calls DeprecationErrorHandler::register().
16+
class PHPUnit_TextUI_Command
17+
{
18+
19+
}
20+
require $vendor.'/vendor/autoload.php';
1721
require_once __DIR__.'/../../bootstrap.php';
1822
require __DIR__.'/fake_vendor/autoload.php';
1923
require __DIR__.'/fake_vendor/acme/lib/deprecation_riddled.php';

src/Symfony/Bridge/PhpUnit/bootstrap.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
use Symfony\Bridge\PhpUnit\DeprecationErrorHandler;
1414

1515
// Detect if we're loaded by an actual run of phpunit
16-
if (!defined('PHPUNIT_COMPOSER_INSTALL') && !class_exists('PHPUnit_TextUI_Command', false) && !class_exists('PHPUnit\TextUI\Command', false)) {
16+
if (!class_exists('PHPUnit_TextUI_Command', false) && !class_exists('PHPUnit\TextUI\Command', false)) {
1717
if ($ser = getenv('SYMFONY_DEPRECATIONS_SERIALIZE')) {
1818
DeprecationErrorHandler::collectDeprecations($ser);
1919
}

0 commit comments

Comments
 (0)