Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Oct 21, 2024. It is now read-only.

Commit a4c4401

Browse files
committed
chore: apply comments from symfony#49385
1 parent 60ec41e commit a4c4401

File tree

4 files changed

+20
-2
lines changed

4 files changed

+20
-2
lines changed

src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerTrait.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Bridge\PhpUnit\Legacy;
1313

14+
use Doctrine\Common\Annotations\AnnotationRegistry;
1415
use PHPUnit\Framework\AssertionFailedError;
1516
use PHPUnit\Framework\RiskyTestError;
1617
use PHPUnit\Framework\TestCase;
@@ -129,6 +130,14 @@ public function startTestSuite($suite): void
129130
echo "Testing $suiteName\n";
130131
$this->state = 0;
131132

133+
if (!class_exists(AnnotationRegistry::class, false) && class_exists(AnnotationRegistry::class)) {
134+
if (method_exists(AnnotationRegistry::class, 'registerUniqueLoader')) {
135+
AnnotationRegistry::registerUniqueLoader('class_exists');
136+
} elseif (method_exists(AnnotationRegistry::class, 'registerLoader')) {
137+
AnnotationRegistry::registerLoader('class_exists');
138+
}
139+
}
140+
132141
if ($this->skippedFile = getenv('SYMFONY_PHPUNIT_SKIPPED_TESTS')) {
133142
$this->state = 1;
134143

src/Symfony/Bridge/PhpUnit/bootstrap.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
* file that was distributed with this source code.
1010
*/
1111

12+
use Doctrine\Common\Annotations\AnnotationRegistry;
1213
use Symfony\Bridge\PhpUnit\DeprecationErrorHandler;
1314

1415
// Detect if we need to serialize deprecations to a file.
@@ -26,6 +27,14 @@
2627
// Enforce a consistent locale
2728
setlocale(\LC_ALL, 'C');
2829

30+
if (!class_exists(AnnotationRegistry::class, false) && class_exists(AnnotationRegistry::class)) {
31+
if (method_exists(AnnotationRegistry::class, 'registerUniqueLoader')) {
32+
AnnotationRegistry::registerUniqueLoader('class_exists');
33+
} elseif (method_exists(AnnotationRegistry::class, 'registerLoader')) {
34+
AnnotationRegistry::registerLoader('class_exists');
35+
}
36+
}
37+
2938
if ('disabled' !== getenv('SYMFONY_DEPRECATIONS_HELPER')) {
3039
DeprecationErrorHandler::register(getenv('SYMFONY_DEPRECATIONS_HELPER'));
3140
}

src/Symfony/Bridge/PhpUnit/composer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
"symfony/error-handler": "For tracking deprecated interfaces usages at runtime with DebugClassLoader"
3030
},
3131
"conflict": {
32-
"doctrine/annotations": "<1.10",
3332
"phpunit/phpunit": "<7.5|9.1.2"
3433
},
3534
"autoload": {

src/Symfony/Component/Notifier/Bridge/Pusher/Tests/PusherTransportTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use Symfony\Component\Notifier\Message\PushMessage;
1717
use Symfony\Component\Notifier\Message\SmsMessage;
1818
use Symfony\Component\Notifier\Test\TransportTestCase;
19+
use Symfony\Component\Notifier\Tests\Fixtures\DummyHttpClient;
1920
use Symfony\Component\Notifier\Tests\Fixtures\DummyMessage;
2021
use Symfony\Component\Notifier\Transport\TransportInterface;
2122
use Symfony\Contracts\HttpClient\HttpClientInterface;
@@ -37,7 +38,7 @@ public function toStringProvider(): iterable
3738
*/
3839
public static function createTransport(HttpClientInterface $client = null): TransportInterface
3940
{
40-
return new PusherTransport(new Pusher('key', 'secret', 'app'), $client);
41+
return new PusherTransport(new Pusher('key', 'secret', 'app'), $client ?? new DummyHttpClient());
4142
}
4243

4344
public static function supportedMessagesProvider(): iterable

0 commit comments

Comments
 (0)