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

Skip to content

Commit 75323bd

Browse files
committed
Merge branch '5.2' into 5.x
* 5.2: [Notifier] Improve tests (5.1) [DoctrineBridge] Guess correct form types for DATE_IMMUTABLE and DATETIME_IMMUTABLE [Notifier] Fix wrong package name [Notifier] Fix wrong package names Add missing symfony/deprecation-contracts requirement [Notifier] [Free Mobile] Could not use custom host in DSN Add missing symfony/deprecation-contracts requirement
2 parents a4033bb + 904b05a commit 75323bd

26 files changed

+94
-77
lines changed

src/Symfony/Bridge/Doctrine/Form/DoctrineOrmTypeGuesser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public function guessType(string $class, string $property)
6161
case Types::DATETIMETZ_MUTABLE:
6262
case 'vardatetime':
6363
return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\DateTimeType', [], Guess::HIGH_CONFIDENCE);
64-
case Types::DATE_IMMUTABLE:
64+
case Types::DATETIME_IMMUTABLE:
6565
case Types::DATETIMETZ_IMMUTABLE:
6666
return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\DateTimeType', ['input' => 'datetime_immutable'], Guess::HIGH_CONFIDENCE);
6767
case Types::DATEINTERVAL:

src/Symfony/Bridge/Doctrine/Tests/Form/DoctrineOrmTypeGuesserTest.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,44 @@
1111

1212
namespace Symfony\Bridge\Doctrine\Tests\Form;
1313

14+
use Doctrine\DBAL\Types\Types;
1415
use Doctrine\ORM\Mapping\ClassMetadata;
1516
use Doctrine\Persistence\ManagerRegistry;
1617
use Doctrine\Persistence\ObjectManager;
1718
use PHPUnit\Framework\TestCase;
1819
use Symfony\Bridge\Doctrine\Form\DoctrineOrmTypeGuesser;
1920
use Symfony\Component\Form\Guess\Guess;
21+
use Symfony\Component\Form\Guess\TypeGuess;
2022
use Symfony\Component\Form\Guess\ValueGuess;
2123

2224
class DoctrineOrmTypeGuesserTest extends TestCase
2325
{
26+
/**
27+
* @dataProvider requiredType
28+
*/
29+
public function testTypeGuesser(string $type, $expected)
30+
{
31+
$classMetadata = $this->getMockBuilder('Doctrine\ORM\Mapping\ClassMetadata')->disableOriginalConstructor()->getMock();
32+
$classMetadata->fieldMappings['field'] = true;
33+
$classMetadata->expects($this->once())->method('getTypeOfField')->with('field')->willReturn($type);
34+
35+
$this->assertEquals($expected, $this->getGuesser($classMetadata)->guessType('TestEntity', 'field'));
36+
}
37+
38+
public function requiredType()
39+
{
40+
yield [Types::DATE_IMMUTABLE, new TypeGuess('Symfony\Component\Form\Extension\Core\Type\DateType', ['input' => 'datetime_immutable'], Guess::HIGH_CONFIDENCE)];
41+
yield [Types::DATE_MUTABLE, new TypeGuess('Symfony\Component\Form\Extension\Core\Type\DateType', [], Guess::HIGH_CONFIDENCE)];
42+
43+
yield [Types::TIME_IMMUTABLE, new TypeGuess('Symfony\Component\Form\Extension\Core\Type\TimeType', ['input' => 'datetime_immutable'], Guess::HIGH_CONFIDENCE)];
44+
yield [Types::TIME_MUTABLE, new TypeGuess('Symfony\Component\Form\Extension\Core\Type\TimeType', [], Guess::HIGH_CONFIDENCE)];
45+
46+
yield [Types::DATETIME_IMMUTABLE, new TypeGuess('Symfony\Component\Form\Extension\Core\Type\DateTimeType', ['input' => 'datetime_immutable'], Guess::HIGH_CONFIDENCE)];
47+
yield [Types::DATETIMETZ_IMMUTABLE, new TypeGuess('Symfony\Component\Form\Extension\Core\Type\DateTimeType', ['input' => 'datetime_immutable'], Guess::HIGH_CONFIDENCE)];
48+
yield [Types::DATETIME_MUTABLE, new TypeGuess('Symfony\Component\Form\Extension\Core\Type\DateTimeType', [], Guess::HIGH_CONFIDENCE)];
49+
yield [Types::DATETIMETZ_MUTABLE, new TypeGuess('Symfony\Component\Form\Extension\Core\Type\DateTimeType', [], Guess::HIGH_CONFIDENCE)];
50+
}
51+
2452
/**
2553
* @dataProvider requiredProvider
2654
*/

src/Symfony/Bridge/Doctrine/composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"php": ">=7.2.5",
2020
"doctrine/event-manager": "~1.0",
2121
"doctrine/persistence": "^2",
22+
"symfony/deprecation-contracts": "^2.1",
2223
"symfony/polyfill-ctype": "~1.8",
2324
"symfony/polyfill-mbstring": "~1.0",
2425
"symfony/polyfill-php80": "^1.15",

src/Symfony/Bundle/FrameworkBundle/composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"symfony/cache": "^5.2",
2222
"symfony/config": "^5.0",
2323
"symfony/dependency-injection": "^5.2",
24+
"symfony/deprecation-contracts": "^2.1",
2425
"symfony/event-dispatcher": "^5.1",
2526
"symfony/error-handler": "^4.4.1|^5.0.1",
2627
"symfony/http-foundation": "^5.2.1",

src/Symfony/Bundle/SecurityBundle/composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"ext-xml": "*",
2121
"symfony/config": "^4.4|^5.0",
2222
"symfony/dependency-injection": "^5.2",
23+
"symfony/deprecation-contracts": "^2.1",
2324
"symfony/event-dispatcher": "^5.1",
2425
"symfony/http-kernel": "^5.0",
2526
"symfony/polyfill-php80": "^1.15",

src/Symfony/Component/Lock/composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"require": {
1919
"php": ">=7.2.5",
2020
"psr/log": "~1.0",
21+
"symfony/deprecation-contracts": "^2.1",
2122
"symfony/polyfill-php80": "^1.15"
2223
},
2324
"require-dev": {

src/Symfony/Component/Messenger/Bridge/Amqp/composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
],
1818
"require": {
1919
"php": ">=7.2.5",
20+
"symfony/deprecation-contracts": "^2.1",
2021
"symfony/messenger": "^5.1"
2122
},
2223
"require-dev": {

src/Symfony/Component/Messenger/Bridge/Redis/composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
],
1818
"require": {
1919
"php": ">=7.2.5",
20+
"symfony/deprecation-contracts": "^2.1",
2021
"symfony/messenger": "^5.1"
2122
},
2223
"require-dev": {

src/Symfony/Component/Notifier/Bridge/Firebase/Tests/FirebaseTransportFactoryTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ public function testCreateWithDsn()
2525
{
2626
$factory = $this->createFactory();
2727

28-
$transport = $factory->create(Dsn::fromString('firebase://username:password@default'));
29-
$transport->setHost('host.test');
28+
$transport = $factory->create(Dsn::fromString('firebase://username:[email protected]'));
3029

3130
$this->assertSame('firebase://host.test', (string) $transport);
3231
}

src/Symfony/Component/Notifier/Bridge/FreeMobile/FreeMobileTransport.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
*/
2828
final class FreeMobileTransport extends AbstractTransport
2929
{
30-
protected const HOST = 'https://smsapi.free-mobile.fr/sendmsg';
30+
protected const HOST = 'smsapi.free-mobile.fr/sendmsg';
3131

3232
private $login;
3333
private $password;
@@ -58,7 +58,9 @@ protected function doSend(MessageInterface $message): SentMessage
5858
throw new UnsupportedMessageTypeException(__CLASS__, SmsMessage::class, $message);
5959
}
6060

61-
$response = $this->client->request('POST', $this->getEndpoint(), [
61+
$endpoint = sprintf('https://%s', $this->getEndpoint());
62+
63+
$response = $this->client->request('POST', $endpoint, [
6264
'json' => [
6365
'user' => $this->login,
6466
'pass' => $this->password,

0 commit comments

Comments
 (0)