8000 Merge branch '7.1' into 7.2 · dunglas/symfony@643745f · GitHub
[go: up one dir, main page]

Skip to content

Commit 643745f

Browse files
committed
Merge branch '7.1' into 7.2
* 7.1: do not mix named and positional arguments in data provider definitions session names must not be empty add missing properties fix Contracts directory name in PHPUnit configuration [Validator][CidrValidator] Fix error message for `OutOfRangeNetmask` validation Passing null to parameter #2 ($subject) of type string is deprecated
2 parents 23c9d8c + c8e00fd commit 643745f

File tree

10 files changed

+58
-12
lines changed

10 files changed

+58
-12
lines changed

phpunit.xml.dist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
<directory>./src/Symfony/Component/*/Tests/</directory>
3535
<directory>./src/Symfony/Component/*/*/Tests/</directory>
3636
<directory>./src/Symfony/Component/*/*/*/Tests/</directory>
37-
<directory>./src/Symfony/Contract/*/Tests/</directory>
37+
<directory>./src/Symfony/Contracts/*/Tests/</directory>
3838
<directory>./src/Symfony/Bundle/*/Tests/</directory>
3939
</testsuite>
4040
</testsuites>
@@ -63,7 +63,7 @@
6363
<directory>./src/Symfony/Bundle/*/vendor</directory>
6464
<directory>./src/Symfony/Component/*/vendor</directory>
6565
<directory>./src/Symfony/Component/*/*/vendor</directory>
66-
<directory>./src/Symfony/Contract/*/vendor</directory>
66+
<directory>./src/Symfony/Contracts/*/vendor</directory>
6767
</exclude>
6868
</coverage>
6969

src/Symfony/Bridge/Monolog/Handler/ChromePhpHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function onKernelResponse(ResponseEvent $event): void
3636
return;
3737
}
3838

39-
if (!preg_match(static::USER_AGENT_REGEX, $event->getRequest()->headers->get('User-Agent'))) {
39+
if (!preg_match(static::USER_AGENT_REGEX, $event->getRequest()->headers->get('User-Agent', ''))) {
4040
self::$sendHeaders = false;
4141
$this->headers = [];
4242

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 <fabien@symfony.com>
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\Bridge\Monolog\Tests\Handler;
13+
14+
use PHPUnit\Framework\TestCase;
15+
use Symfony\Bridge\Monolog\Handler\ChromePhpHandler;
16+
use Symfony\Component\HttpFoundation\Request;
17+
use Symfony\Component\HttpFoundation\Response;
18+
use Symfony\Component\HttpKernel\Event\ResponseEvent;
19+
use Symfony\Component\HttpKernel\HttpKernelInterface;
20+
21+
class ChromePhpHandlerTest extends TestCase
22+
{
23+
public function testOnKernelResponseShouldNotTriggerDeprecation()
24+
{
25+
$request = Request::create('/');
26+
$request->headers->remove('User-Agent');
27+
28+
$response = new Response('foo');
29+
$event = new ResponseEvent($this->createMock(HttpKernelInterface::class), $request, HttpKernelInterface::MAIN_REQUEST, $response);
30+
31+
$error = null;
32+
set_error_handler(function ($type, $message) use (&$error) { $error = $message; }, \E_DEPRECATED);
33+
34+
$listener = new ChromePhpHandler();
35+
$listener->onKernelResponse($event);
36+
restore_error_handler();
37+
38+
$this->assertNull($error);
39+
}
40+
}

src/Symfony/Component/Cache/Tests/Traits/RedisTraitTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public static function provideCreateConnection(): array
7373
'Redis',
7474
],
7575
[
76-
'dsn' => \sprintf('redis:?%s', implode('&', \array_slice($hosts, 0, 2))),
76+
\sprintf('redis:?%s', implode('&', \array_slice($hosts, 0, 2))),
7777
'RedisArray',
7878
],
7979
];

src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/AbstractRedisSessionHandlerTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public function testUseSessionGcMaxLifetimeAsTimeToLive()
8585

8686
public function testDestroySession()
8787
{
88-
$this->storage->open('', '');
88+
$this->storage->open('', 'test');
8989
$this->redisClient->set(self::PREFIX.'id', 'foo');
9090

9191
$this->assertTrue((bool) $this->redisClient->exists(self::PREFIX.'id'));

src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MemcachedSessionHandlerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public function testWriteSessionWithLargeTTL()
107107

108108
public function testDestroySession()
109109
{
110-
$this->storage->open('', '');
110+
$this->storage->open('', 'sid');
111111
$this->memcached
112112
->expects($this->once())
113113
->method('delete')

src/Symfony/Component/Validator/Constraints/CidrValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public function validate($value, Constraint $constraint): void
8181
$this->context
8282
->buildViolation($constraint->netmaskRangeViolationMessage)
8383
->setParameter('{{ min }}', $constraint->netmaskMin)
84-
->setParameter('{{ max }}', $constraint->netmaskMax)
84+
->setParameter('{{ max }}', $netmaskMax)
8585
->setCode(Cidr::OUT_OF_RANGE_ERROR)
8686
->addViolation();
8787
}

src/Symfony/Component/Validator/Tests/Constraints/CidrValidatorTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public function testInvalidIpAddressAndNetmask(string|\Stringable $cidr)
106106
/**
107107
* @dataProvider getOutOfRangeNetmask
108108
*/
109-
public function testOutOfRangeNetmask(string $cidr, ?string $version = null, ?int $min = null, ?int $max = null)
109+
public function testOutOfRangeNetmask(string $cidr, int $maxExpected, ?string $version = null, ?int $min = null, ?int $max = null)
110110
{
111111
$cidrConstraint = new Cidr([
112112
'version' => $version,
@@ -118,7 +118,7 @@ public function testOutOfRangeNetmask(string $cidr, ?string $version = null, ?in
118118
$this
119119
->buildViolation('The value of the netmask should be between {{ min }} and {{ max }}.')
120120
->setParameter('{{ min }}', $cidrConstraint->netmaskMin)
121-
->setParameter('{{ max }}', $cidrConstraint->netmaskMax)
121+
->setParameter('{{ max }}', $maxExpected)
122122
->setCode(Cidr::OUT_OF_RANGE_ERROR)
123123
->assertRaised();
124124
}
@@ -240,9 +240,9 @@ public static function getWithInvalidMasksAndIps(): array
240240
public static function getOutOfRangeNetmask(): array
241241
{
242242
return [
243-
['10.0.0.0/24', Ip::V4, 10, 20],
244-
['10.0.0.0/128'],
245-
['2001:0DB8:85A3:0000:0000:8A2E:0370:7334/24', Ip::V6, 10, 20],
243+
['10.0.0.0/24', 20, Ip::V4, 10, 20],
244+
['10.0.0.0/128', 32],
245+
['2001:0DB8:85A3:0000:0000:8A2E:0370:7334/24', 20, Ip::V6, 10, 20],
246246
];
247247
}
248248

src/Symfony/Contracts/Tests/Service/LegacyTestService.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ class LegacyTestService extends LegacyParentTestService implements ServiceSubscr
3333
{
3434
use ServiceSubscriberTrait;
3535

36+
protected $container;
37+
3638
#[SubscribedService]
3739
public function aService(): Service2
3840
{

src/Symfony/Contracts/Tests/Service/ServiceSubscriberTraitTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ public function testParentNotCalledIfHasMagicCall()
5656
};
5757
$service = new class extends ParentWithMagicCall {
5858
use ServiceSubscriberTrait;
59+
60+
private $container;
5961
};
6062

6163
$this->assertNull($service->setContainer($container));
@@ -69,6 +71,8 @@ public function testParentNotCalledIfNoParent()
6971
};
7072
$service = new class {
7173
use ServiceSubscriberTrait;
74+
75+
private $container;
7276
};
7377

7478
$this->assertNull($service->setContainer($container));

0 commit comments

Comments
 (0)
0