Skip to content

Commit 97cf53f

Browse files
committed
Merge branch '2.3' into 2.7
* 2.3: [2.7] Fixed flatten exception recursion with errors Embedded identifier support Change the ExtensionInterface load method definition to bo identical to the documentation. add and correct armenian translations [Config] Fix array sort on normalization in edge case [Yaml] fix indented line handling in folded blocks improve BrowserKit test coverage p1
2 parents 5fa5c87 + 7660fb8 commit 97cf53f

File tree

16 files changed

+439
-70
lines changed

16 files changed

+439
-70
lines changed

src/Symfony/Bridge/Doctrine/Form/ChoiceList/ORMQueryBuilderLoader.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ public function getEntitiesByIds($identifier, array $values)
9292
$qb = clone $this->queryBuilder;
9393
$alias = current($qb->getRootAliases());
9494
$parameter = 'ORMQueryBuilderLoader_getEntitiesByIds_'.$identifier;
95+
$parameter = str_replace('.', '_', $parameter);
9596
$where = $qb->expr()->in($alias.'.'.$identifier, ':'.$parameter);
9697

9798
// Guess type
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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\Bridge\Doctrine\Tests\Fixtures\Embeddable;
13+
14+
use Doctrine\ORM\Mapping as ORM;
15+
16+
/**
17+
* @ORM\Embeddable
18+
*/
19+
class Identifier
20+
{
21+
/**
22+
* @var int
23+
*
24+
* @ORM\Id
25+
* @ORM\Column(type="integer")
26+
*/
27+
protected $value;
28+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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\Bridge\Doctrine\Tests\Fixtures;
13+
14+
use Doctrine\ORM\Mapping as ORM;
15+
16+
/**
17+
* @ORM\Entity
18+
*/
19+
class EmbeddedIdentifierEntity
20+
{
21+
/**
22+
* @var Embeddable\Identifier
23+
*
24+
* @ORM\Embedded(class="Symfony\Bridge\Doctrine\Tests\Fixtures\Embeddable\Identifier")
25+
*/
26+
protected $id;
27+
}

src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/ORMQueryBuilderLoaderTest.php

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Symfony\Bridge\Doctrine\Form\ChoiceList\ORMQueryBuilderLoader;
1515
use Symfony\Bridge\Doctrine\Test\DoctrineTestHelper;
1616
use Doctrine\DBAL\Connection;
17+
use Doctrine\ORM\Version;
1718

1819
class ORMQueryBuilderLoaderTest extends \PHPUnit_Framework_TestCase
1920
{
@@ -104,4 +105,38 @@ public function testFilterNonIntegerValues()
104105
$loader = new ORMQueryBuilderLoader($qb);
105106
$loader->getEntitiesByIds('id', array(1, '', 2, 3, 'foo'));
106107
}
108+
109+
public function testEmbeddedIdentifierName()
110+
{
111+
if (Version::compare('2.5.0') > 0) {
112+
$this->markTestSkipped('Applicable only for Doctrine >= 2.5.0');
113+
114+
return;
115+
}
116+
117+
$em = DoctrineTestHelper::createTestEntityManager();
118+
119+
$query = $this->getMockBuilder('QueryMock')
120+
->setMethods(array('setParameter', 'getResult', 'getSql', '_doExecute'))
121+
->getMock();
122+
123+
$query->expects($this->once())
124+
->method('setParameter')
125+
->with('ORMQueryBuilderLoader_getEntitiesByIds_id_value', array(1, 2, 3), Connection::PARAM_INT_ARRAY)
126+
->willReturn($query);
127+
128+
$qb = $this->getMockBuilder('Doctrine\ORM\QueryBuilder')
129+
->setConstructorArgs(array($em))
130+
->setMethods(array('getQuery'))
131+
->getMock();
132+
$qb->expects($this->once())
133+
->method('getQuery')
134+
->willReturn($query);
135+
136+
$qb->select('e')
137+
->from('Symfony\Bridge\Doctrine\Tests\Fixtures\EmbeddedIdentifierEntity', 'e');
138+
139+
$loader = new ORMQueryBuilderLoader($qb);
140+
$loader->getEntitiesByIds('id.value', array(1, '', 2, 3, 'foo'));
141+
}
107142
}

src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/FirewallEntryPointBundle/DependencyInjection/FirewallEntryPointExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
class FirewallEntryPointExtension extends Extension
2020
{
21-
public function load(array $config, ContainerBuilder $container)
21+
public function load(array $configs, ContainerBuilder $container)
2222
{
2323
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
2424
$loader->load('services.xml');

src/Symfony/Component/BrowserKit/Tests/ClientTest.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -624,4 +624,24 @@ public function testSetServerParameterInRequest()
624624
$this->assertArrayHasKey('HTTPS', $server);
625625
$this->assertFalse($server['HTTPS']);
626626
}
627+
628+
public function testInternalRequest()
629+
{
630+
$client = new TestClient();
631+
632+
$client->request('GET', 'https://www.example.com/https/www.example.com', array(), array(), array(
633+
'HTTP_HOST' => 'testhost',
634+
'HTTP_USER_AGENT' => 'testua',
635+
'HTTPS' => false,
636+
'NEW_SERVER_KEY' => 'new-server-key-value',
637+
));
638+
639+
$this->assertInstanceOf('Symfony\Component\BrowserKit\Request', $client->getInternalRequest());
640+
}
641+
642+
public function testInternalRequestNull()
643+
{
644+
$client = new TestClient();
645+
$this->assertNull($client->getInternalRequest());
646+
}
627647
}

src/Symfony/Component/BrowserKit/Tests/CookieJarTest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,16 @@ public function testCookieExpireWithNullPaths()
174174
$this->assertEquals(array(), array_keys($cookieJar->allValues('http://example.com/')));
175175
}
176176

177+
public function testCookieExpireWithDomain()
178+
{
179+
$cookieJar = new CookieJar();
180+
$cookieJar->set($cookie1 = new Cookie('foo', 'bar1', null, '/foo', 'http://example2.com/'));
181+
$cookieJar->expire('foo', '/foo', 'http://example2.com/');
182+
183+
$this->assertNull($cookieJar->get('foo'), '->get() returns null if the cookie is expired');
184+
$this->assertEquals(array(), array_keys($cookieJar->allValues('http://example2.com/')));
185+
}
186+
177187
public function testCookieWithSameNameButDifferentPaths()
178188
{
179189
$cookieJar = new CookieJar();
@@ -207,6 +217,14 @@ public function testCookieGetWithSubdomain()
207217
$this->assertEquals($cookie2, $cookieJar->get('foo1', '/', 'test.example.com'));
208218
}
209219

220+
public function testCookieGetWithWrongSubdomain()
221+
{
222+
$cookieJar = new CookieJar();
223+
$cookieJar->set($cookie1 = new Cookie('foo1', 'bar', null, '/', 'test.example.com'));
224+
225+
$this->assertNull($cookieJar->get('foo1', '/', 'foo.example.com'));
226+
}
227+
210228
public function testCookieGetWithSubdirectory()
211229
{
212230
$cookieJar = new CookieJar();

src/Symfony/Component/BrowserKit/Tests/CookieTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,4 +176,13 @@ public function testIsExpired()
176176
$cookie = new Cookie('foo', 'bar', 0);
177177
$this->assertFalse($cookie->isExpired());
178178
}
179+
180+
/**
181+
* @expectedException UnexpectedValueException
182+
* @expectedExceptionMessage The cookie expiration time "string" is not valid.
183+
*/
184+
public function testConstructException()
185+
{
186+
$cookie = new Cookie('foo', 'bar', 'string');
187+
}
179188
}

src/Symfony/Component/Config/Definition/ArrayNode.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,17 @@ protected function preNormalize($value)
5555
return $value;
5656
}
5757

58+
$normalized = array();
59+
5860
foreach ($value as $k => $v) {
5961
if (false !== strpos($k, '-') && false === strpos($k, '_') && !array_key_exists($normalizedKey = str_replace('-', '_', $k), $value)) {
60-
$value[$normalizedKey] = $v;
61-
unset($value[$k]);
62+
$normalized[$normalizedKey] = $v;
63+
} else {
64+
$normalized[$k] = $v;
6265
}
6366
}
6467

65-
return $value;
68+
return $normalized;
6669
}
6770

6871
/**

src/Symfony/Component/Config/Tests/Definition/ArrayNodeTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ public function getPreNormalizationTests()
7474
array('foo-bar_moo' => 'foo'),
7575
array('foo-bar_moo' => 'foo'),
7676
),
77+
array(
78+
array('anything-with-dash-and-no-underscore' => 'first', 'no_dash' => 'second'),
79+
array('anything_with_dash_and_no_underscore' => 'first', 'no_dash' => 'second'),
80+
),
7781
array(
7882
array('foo-bar' => null, 'foo_bar' => 'foo'),
7983
array('foo-bar' => null, 'foo_bar' => 'foo'),

0 commit comments

Comments
 (0)