Skip to content

Commit 8b271eb

Browse files
committed
Merge branch '7.2' into 7.3
* 7.2: fix: notifier channel bus abstract arg fix risky test that doesn't perform any assertions fix: notifier push channel bus abstract arg [Scheduler] remove dead code add test covering null regions
2 parents 0a44b87 + 49f1326 commit 8b271eb

File tree

6 files changed

+75
-60
lines changed

6 files changed

+75
-60
lines changed

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2805,7 +2805,7 @@ private function registerNotifierConfiguration(array $config, ContainerBuilder $
28052805
$container->removeDefinition('notifier.channel.email');
28062806
}
28072807

2808-
foreach (['texter', 'chatter', 'notifier.channel.chat', 'notifier.channel.email', 'notifier.channel.sms'] as $serviceId) {
2808+
foreach (['texter', 'chatter', 'notifier.channel.chat', 'notifier.channel.email', 'notifier.channel.sms', 'notifier.channel.push', 'notifier.channel.desktop'] as $serviceId) {
28092809
if (!$container->hasDefinition($serviceId)) {
28102810
continue;
28112811
}

src/Symfony/Bundle/FrameworkBundle/Resources/config/notifier.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,17 @@
7575
->tag('notifier.channel', ['channel' => 'email'])
7676

7777
->set('notifier.channel.push', PushChannel::class)
78-
->args([service('texter.transports'), service('messenger.default_bus')->ignoreOnInvalid()])
78+
->args([
79+
service('texter.transports'),
80+
abstract_arg('message bus'),
81+
])
7982
->tag('notifier.channel', ['channel' => 'push'])
8083

8184
->set('notifier.channel.desktop', DesktopChannel::class)
82-
->args([service('texter.transports'), service('messenger.default_bus')->ignoreOnInvalid()])
85+
->args([
86+
service('texter.transports'),
87+
abstract_arg('message bus'),
88+
])
8389
->tag('notifier.channel', ['channel' => 'desktop'])
8490

8591
->set('notifier.monolog_handler', NotifierHandler::class)

src/Symfony/Component/Console/Tests/Helper/ProgressBarTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,10 @@ public function testRegularTimeEstimation()
112112

113113
public function testRegularTimeRemainingWithDifferentStartAtAndCustomDisplay()
114114
{
115+
$this->expectNotToPerformAssertions();
116+
115117
ProgressBar::setFormatDefinition('custom', ' %current%/%max% [%bar%] %percent:3s%% %remaining% %estimated%');
116-
$bar = new ProgressBar($output = $this->getOutputStream(), 1_200, 0);
118+
$bar = new ProgressBar($this->getOutputStream(), 1_200, 0);
117119
$bar->setFormat('custom');
118120
$bar->start(1_200, 600);
119121
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\Mailer\Bridge\Sendgrid\Tests\Transport;
13+
14+
use PHPUnit\Framework\TestCase;
15+
use Symfony\Component\Mailer\Bridge\Sendgrid\Transport\SendgridSmtpTransport;
16+
17+
class SendgridSmtpTransportTest extends TestCase
18+
{
19+
/**
20+
* @dataProvider getTransportData
21+
*/
22+
public function testToString(SendgridSmtpTransport $transport, string $expected)
23+
{
24+
$this->assertSame($expected, (string) $transport);
25+
}
26+
27+
public static function getTransportData()
28+
{
29+
return [
30+
[
31+
new SendgridSmtpTransport('KEY'),
32+
'smtps://smtp.sendgrid.net',
33+
],
34+
[
35+
new SendgridSmtpTransport('KEY', null, null, 'eu'),
36+
'smtps://smtp.eu.sendgrid.net',
37+
],
38+
];
39+
}
40+
}

src/Symfony/Component/Scheduler/Tests/RecurringMessageTest.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace Symfony\Component\Scheduler\Tests;
1313

1414
use PHPUnit\Framework\TestCase;
15-
use Random\Randomizer;
1615
use Symfony\Component\Scheduler\Exception\InvalidArgumentException;
1716
use Symfony\Component\Scheduler\RecurringMessage;
1817

@@ -22,13 +21,8 @@ public function testCanCreateHashedCronMessage()
2221
{
2322
$object = new DummyStringableMessage();
2423

25-
if (class_exists(Randomizer::class)) {
26-
$this->assertSame('30 0 * * *', (string) RecurringMessage::cron('#midnight', $object)->getTrigger());
27-
$this->assertSame('30 0 * * 3', (string) RecurringMessage::cron('#weekly', $object)->getTrigger());
28-
} else {
29-
$this->assertSame('36 0 * * *', (string) RecurringMessage::cron('#midnight', $object)->getTrigger());
30-
$this->assertSame('36 0 * * 6', (string) RecurringMessage::cron('#weekly', $object)->getTrigger());
31-
}
24+
$this->assertSame('30 0 * * *', (string) RecurringMessage::cron('#midnight', $object)->getTrigger());
25+
$this->assertSame('30 0 * * 3', (string) RecurringMessage::cron('#weekly', $object)->getTrigger());
3226
}
3327

3428
public function testHashedCronContextIsRequiredIfMessageIsNotStringable()

src/Symfony/Component/Scheduler/Tests/Trigger/CronExpressionTriggerTest.php

Lines changed: 21 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace Symfony\Component\Scheduler\Tests\Trigger;
1313

1414
use PHPUnit\Framework\TestCase;
15-
use Random\Randomizer;
1615
use Symfony\Component\Scheduler\Trigger\CronExpressionTrigger;
1716

1817
class CronExpressionTriggerTest extends TestCase
@@ -33,54 +32,28 @@ public function testHashedExpressionParsing(string $input, string $expected)
3332

3433
public static function hashedExpressionProvider(): array
3534
{
36-
if (class_exists(Randomizer::class)) {
37-
return [
38-
['# * * * *', '30 * * * *'],
39-
['# # * * *', '30 0 * * *'],
40-
['# # # * *', '30 0 25 * *'],
41-
['# # # # *', '30 0 25 10 *'],
42-
['# # # # #', '30 0 25 10 5'],
43-
['# # 1,15 1-11 *', '30 0 1,15 1-11 *'],
44-
['# # 1,15 * *', '30 0 1,15 * *'],
45-
['#hourly', '30 * * * *'],
46-
['#daily', '30 0 * * *'],
47-
['#weekly', '30 0 * * 3'],
48-
['#weekly@midnight', '30 0 * * 3'],
49-
['#monthly', '30 0 25 * *'],
50-
['#monthly@midnight', '30 0 25 * *'],
51-
['#yearly', '30 0 25 10 *'],
52-
['#yearly@midnight', '30 0 25 10 *'],
53-
['#annually', '30 0 25 10 *'],
54-
['#annually@midnight', '30 0 25 10 *'],
55-
['#midnight', '30 0 * * *'],
56-
['#(1-15) * * * *', '1 * * * *'],
57-
['#(1-15) * * * #(3-5)', '1 * * * 3'],
58-
['#(1-15) * # * #(3-5)', '1 * 17 * 5'],
59-
];
60-
}
61-
6235
return [
63-
['# * * * *', '36 * * * *'],
64-
['# # * * *', '36 0 * * *'],
65-
['# # # * *', '36 0 14 * *'],
66-
['# # # # *', '36 0 14 3 *'],
67-
['# # # # #', '36 0 14 3 5'],
68-
['# # 1,15 1-11 *', '36 0 1,15 1-11 *'],
69-
['# # 1,15 * *', '36 0 1,15 * *'],
70-
['#hourly', '36 * * * *'],
71-
['#daily', '36 0 * * *'],
72-
['#weekly', '36 0 * * 6'],
73-
['#weekly@midnight', '36 0 * * 6'],
74-
['#monthly', '36 0 14 * *'],
75-
['#monthly@midnight', '36 0 14 * *'],
76-
['#yearly', '36 0 14 3 *'],
77-
['#yearly@midnight', '36 0 14 3 *'],
78-
['#annually', '36 0 14 3 *'],
79-
['#annually@midnight', '36 0 14 3 *'],
80-
['#midnight', '36 0 * * *'],
81-
['#(1-15) * * * *', '7 * * * *'],
82-
['#(1-15) * * * #(3-5)', '7 * * * 3'],
83-
['#(1-15) * # * #(3-5)', '7 * 1 * 5'],
36+
['# * * * *', '30 * * * *'],
37+
['# # * * *', '30 0 * * *'],
38+
['# # # * *', '30 0 25 * *'],
39+
['# # # # *', '30 0 25 10 *'],
40+
['# # # # #', '30 0 25 10 5'],
41+
['# # 1,15 1-11 *', '30 0 1,15 1-11 *'],
42+
['# # 1,15 * *', '30 0 1,15 * *'],
43+
['#hourly', '30 * * * *'],
44+
['#daily', '30 0 * * *'],
45+
['#weekly', '30 0 * * 3'],
46+
['#weekly@midnight', '30 0 * * 3'],
47+
['#monthly', '30 0 25 * *'],
48+
['#monthly@midnight', '30 0 25 * *'],
49+
['#yearly', '30 0 25 10 *'],
50+
['#yearly@midnight', '30 0 25 10 *'],
51+
['#annually', '30 0 25 10 *'],
52+
['#annually@midnight', '30 0 25 10 *'],
53+
['#midnight', '30 0 * * *'],
54+
['#(1-15) * * * *', '1 * * * *'],
55+
['#(1-15) * * * #(3-5)', '1 * * * 3'],
56+
['#(1-15) * # * #(3-5)', '1 * 17 * 5'],
8457
];
8558
}
8659

0 commit comments

Comments
 (0)