Skip to content

Commit 97d7ce3

Browse files
Merge branch '6.0' into 6.1
* 6.0: (22 commits) Add missing license header Add missing license header [Workflow] Catch error when trying to get an uninitialized marking Add missing license header Allow usage of Provider domains if possible Use reference date in reverse transform Fixes #40997 Fix env resolution in lock configuration Fix Symfony not working on SMB share #45990 [Messenger] DoctrineTransportFactory works with notify and decorated PostgreSQL driver [Cache] make LockRegistry use static properties instead of static variables fix: return-path has higher priority for envelope address than from address (fixes #41322) [HttpClient] Fix sending content-length when streaming the body [Console] Header with column max width is now well wrap with separator Fix use_cookies framework session configuration [FrameworkBundle] [Command] Fix `debug:router --no-interaction` error … [Intl] Update the ICU data to 71.1 - 5.4 [Intl] Update the ICU data to 71.1 - 4.4 Add tests to messenger connection get for OraclePlatform [RateLimiter] Adding default empty value [DependencyInjection] Add TaggedIteratorArgument unit tests ...
2 parents 1628aa4 + 8a3fd74 commit 97d7ce3

File tree

5 files changed

+193
-0
lines changed

5 files changed

+193
-0
lines changed
Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
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\Component\DependencyInjection\Tests\Argument;
13+
14+
use PHPUnit\Framework\TestCase;
15+
use Symfony\Component\DependencyInjection\Argument\TaggedIteratorArgument;
16+
17+
class TaggedIteratorArgumentTest extends TestCase
18+
{
19+
public function testWithTagOnly()
20+
{
21+
$taggedIteratorArgument = new TaggedIteratorArgument('foo');
22+
23+
$this->assertSame('foo', $taggedIteratorArgument->getTag());
24+
$this->assertNull($taggedIteratorArgument->getIndexAttribute());
25+
$this->assertNull($taggedIteratorArgument->getDefaultIndexMethod());
26+
$this->assertFalse($taggedIteratorArgument->needsIndexes());
27+
$this->assertNull($taggedIteratorArgument->getDefaultPriorityMethod());
28+
}
29+
30+
public function testOnlyTagWithNeedsIndexes()
31+
{
32+
$taggedIteratorArgument = new TaggedIteratorArgument('foo', null, null, true);
33+
34+
$this->assertSame('foo', $taggedIteratorArgument->getTag());
35+
$this->assertSame('foo', $taggedIteratorArgument->getIndexAttribute());
36+
$this->assertSame('getDefaultFooName', $taggedIteratorArgument->getDefaultIndexMethod());
37+
$this->assertSame('getDefaultFooPriority', $taggedIteratorArgument->getDefaultPriorityMethod());
38+
}
39+
40+
public function testOnlyTagWithNeedsIndexesAndDotTag()
41+
{
42+
$taggedIteratorArgument = new TaggedIteratorArgument('foo.bar', null, null, true);
43+
44+
$this->assertSame('foo.bar', $taggedIteratorArgument->getTag());
45+
$this->assertSame('bar', $taggedIteratorArgument->getIndexAttribute());
46+
$this->assertSame('getDefaultBarName', $taggedIteratorArgument->getDefaultIndexMethod());
47+
$this->assertSame('getDefaultBarPriority', $taggedIteratorArgument->getDefaultPriorityMethod());
48+
}
49+
50+
public function testOnlyTagWithNeedsIndexesAndDotsTag()
51+
{
52+
$taggedIteratorArgument = new TaggedIteratorArgument('foo.bar.baz.qux', null, null, true);
53+
54+
$this->assertSame('foo.bar.baz.qux', $taggedIteratorArgument->getTag());
55+
$this->assertSame('qux', $taggedIteratorArgument->getIndexAttribute());
56+
$this->assertSame('getDefaultQuxName', $taggedIteratorArgument->getDefaultIndexMethod());
57+
$this->assertSame('getDefaultQuxPriority', $taggedIteratorArgument->getDefaultPriorityMethod());
58+
}
59+
60+
/**
61+
* @dataProvider defaultIndexMethodProvider
62+
*/
63+
public function testDefaultIndexMethod(?string $indexAttribute, ?string $defaultIndexMethod, ?string $expectedDefaultIndexMethod)
64+
{
65+
$taggedIteratorArgument = new TaggedIteratorArgument('foo', $indexAttribute, $defaultIndexMethod);
66+
67+
$this->assertSame($expectedDefaultIndexMethod, $taggedIteratorArgument->getDefaultIndexMethod());
68+
}
69+
70+
public function defaultIndexMethodProvider()
71+
{
72+
yield 'No indexAttribute and no defaultIndexMethod' => [
73+
null,
74+
null,
75+
null,
76+
];
77+
78+
yield 'Only indexAttribute' => [
79+
'bar',
80+
null,
81+
'getDefaultBarName',
82+
];
83+
84+
yield 'Only defaultIndexMethod' => [
85+
null,
86+
'getBaz',
87+
'getBaz',
88+
];
89+
90+
yield 'DefaultIndexMethod and indexAttribute' => [
91+
'bar',
92+
'getBaz',
93+
'getBaz',
94+
];
95+
96+
yield 'Transform to getter with one special char' => [
97+
'bar_baz',
98+
null,
99+
'getDefaultBarBazName',
100+
];
101+
102+
yield 'Transform to getter with multiple special char' => [
103+
'bar-baz-qux',
104+
null,
105+
'getDefaultBarBazQuxName',
106+
];
107+
}
108+
109+
/**
110+
* @dataProvider defaultPriorityMethodProvider
111+
*/
112+
public function testDefaultPriorityIndexMethod(?string $indexAttribute, ?string $defaultPriorityMethod, ?string $expectedDefaultPriorityMethod)
113+
{
114+
$taggedIteratorArgument = new TaggedIteratorArgument('foo', $indexAttribute, null, false, $defaultPriorityMethod);
115+
116+
$this->assertSame($expectedDefaultPriorityMethod, $taggedIteratorArgument->getDefaultPriorityMethod());
117+
}
118+
119+
public function defaultPriorityMethodProvider()
120+
{
121+
yield 'No indexAttribute and no defaultPriorityMethod' => [
122+
null,
123+
null,
124+
null,
125+
];
126+
127+
yield 'Only indexAttribute' => [
128+
'bar',
129+
null,
130+
'getDefaultBarPriority',
131+
];
132+
133+
yield 'Only defaultPriorityMethod' => [
134+
null,
135+
'getBaz',
136+
'getBaz',
137+
];
138+
139+
yield 'DefaultPriorityMethod and indexAttribute' => [
140+
'bar',
141+
'getBaz',
142+
'getBaz',
143+
];
144+
145+
yield 'Transform to getter with one special char' => [
146+
'bar_baz',
147+
null,
148+
'getDefaultBarBazPriority',
149+
];
150+
151+
yield 'Transform to getter with multiple special char' => [
152+
'bar-baz-qux',
153+
null,
154+
'getDefaultBarBazQuxPriority',
155+
];
156+
}
157+
}

Tests/Compiler/AliasDeprecatedPublicServicesPassTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
<?php
22

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+
312
namespace Symfony\Component\DependencyInjection\Tests\Compiler;
413

514
use PHPUnit\Framework\TestCase;

Tests/Compiler/CustomExpressionLanguageFunctionTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
<?php
22

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+
312
namespace Symfony\Component\DependencyInjection\Tests\Compiler;
413

514
use PHPUnit\Framework\TestCase;

Tests/EnvVarProcessorTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
<?php
22

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+
312
namespace Symfony\Component\DependencyInjection\Tests;
413

514
use PHPUnit\Framework\TestCase;

Tests/Exception/AutowiringFailedExceptionTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
<?php
22

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+
312
namespace Symfony\Component\DependencyInjection\Tests\Exception;
413

514
use PHPUnit\Framework\TestCase;

0 commit comments

Comments
 (0)