Merge branch '2.3' into 2.6
* 2.3: [Validators] Missing translations for arabic language. fixed C [HttpKernel][Bundle] Check extension implements ExtensionInterface [HttpKernel] Do not call the FragmentListener if _controller is already defined
This commit is contained in:
commit
662346403b
@ -76,6 +76,10 @@ abstract class Bundle extends ContainerAware implements BundleInterface
|
||||
if (class_exists($class)) {
|
||||
$extension = new $class();
|
||||
|
||||
if (!$extension instanceof ExtensionInterface) {
|
||||
throw new \LogicException(sprintf('Extension %s must implement Symfony\Component\DependencyInjection\Extension\ExtensionInterface.', $class));
|
||||
}
|
||||
|
||||
// check naming convention
|
||||
$basename = preg_replace('/Bundle$/', '', $this->getName());
|
||||
$expectedAlias = Container::underscore($basename);
|
||||
|
@ -57,7 +57,7 @@ class FragmentListener implements EventSubscriberInterface
|
||||
{
|
||||
$request = $event->getRequest();
|
||||
|
||||
if ($this->fragmentPath !== rawurldecode($request->getPathInfo())) {
|
||||
if ($request->attributes->has('_controller') || $this->fragmentPath !== rawurldecode($request->getPathInfo())) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -11,6 +11,7 @@
|
||||
|
||||
namespace Symfony\Component\HttpKernel\Tests\Bundle;
|
||||
|
||||
use Symfony\Component\HttpKernel\Tests\Fixtures\ExtensionNotValidBundle\ExtensionNotValidBundle;
|
||||
use Symfony\Component\HttpKernel\Tests\Fixtures\ExtensionPresentBundle\ExtensionPresentBundle;
|
||||
use Symfony\Component\HttpKernel\Tests\Fixtures\ExtensionAbsentBundle\ExtensionAbsentBundle;
|
||||
use Symfony\Component\HttpKernel\Tests\Fixtures\ExtensionPresentBundle\Command\FooCommand;
|
||||
@ -30,4 +31,14 @@ class BundleTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
$this->assertNull($bundle2->registerCommands($app));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \LogicException
|
||||
* @expectedExceptionMessage must implement Symfony\Component\DependencyInjection\Extension\ExtensionInterface
|
||||
*/
|
||||
public function testGetContainerExtensionWithInvalidClass()
|
||||
{
|
||||
$bundle = new ExtensionNotValidBundle();
|
||||
$bundle->getContainerExtension();
|
||||
}
|
||||
}
|
||||
|
@ -34,6 +34,22 @@ class FragmentListenerTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertTrue($request->query->has('_path'));
|
||||
}
|
||||
|
||||
|
||||
public function testOnlyTriggeredIfControllerWasNotDefinedYet()
|
||||
{
|
||||
$request = Request::create('http://example.com/_fragment?_path=foo%3Dbar%26_controller%3Dfoo');
|
||||
$request->attributes->set('_controller', 'bar');
|
||||
|
||||
$listener = new FragmentListener(new UriSigner('foo'));
|
||||
$event = $this->createGetResponseEvent($request, HttpKernelInterface::SUB_REQUEST);
|
||||
|
||||
$expected = $request->attributes->all();
|
||||
|
||||
$listener->onKernelRequest($event);
|
||||
|
||||
$this->assertEquals($expected, $request->attributes->all());
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException
|
||||
*/
|
||||
@ -74,8 +90,8 @@ class FragmentListenerTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertFalse($request->query->has('_path'));
|
||||
}
|
||||
|
||||
private function createGetResponseEvent(Request $request)
|
||||
private function createGetResponseEvent(Request $request, $requestType = HttpKernelInterface::MASTER_REQUEST)
|
||||
{
|
||||
return new GetResponseEvent($this->getMock('Symfony\Component\HttpKernel\HttpKernelInterface'), $request, HttpKernelInterface::MASTER_REQUEST);
|
||||
return new GetResponseEvent($this->getMock('Symfony\Component\HttpKernel\HttpKernelInterface'), $request, $requestType);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\HttpKernel\Tests\Fixtures\ExtensionNotValidBundle\DependencyInjection;
|
||||
|
||||
class ExtensionNotValidExtension
|
||||
{
|
||||
public function getAlias()
|
||||
{
|
||||
return 'extension_not_valid';
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\HttpKernel\Tests\Fixtures\ExtensionNotValidBundle;
|
||||
|
||||
use Symfony\Component\HttpKernel\Bundle\Bundle;
|
||||
|
||||
class ExtensionNotValidBundle extends Bundle
|
||||
{
|
||||
}
|
@ -278,6 +278,38 @@
|
||||
<source>This value should not be identical to {{ compared_value_type }} {{ compared_value }}.</source>
|
||||
<target>القيمة يجب ان لا تطابق {{ compared_value_type }} {{ compared_value }}.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="73">
|
||||
<source>The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}.</source>
|
||||
<target>نسبة العرض على الارتفاع للصورة كبيرة جدا ({{ ratio }}). الحد الأقصى للنسبة المسموح به هو {{ max_ratio }}.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="74">
|
||||
<source>The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}.</source>
|
||||
<target>نسبة العرض على الارتفاع للصورة صغيرة جدا ({{ ratio }}). الحد الأدنى للنسبة المسموح به هو {{ max_ratio }}.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="75">
|
||||
<source>The image is square ({{ width }}x{{ height }}px). Square images are not allowed.</source>
|
||||
<target>الصورة مربعة ({{ width }}x{{ height }}px). الصور المربعة غير مسموح بها.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="76">
|
||||
<source>The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed.</source>
|
||||
<target>الصورة في وضع أفقي ({{ width }}x{{ height }}px). الصور في وضع أفقي غير مسموح بها.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="77">
|
||||
<source>The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed.</source>
|
||||
<target>الصورة في وضع عمودي ({{ width }}x{{ height }}px). الصور في وضع عمودي غير مسموح بها.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="78">
|
||||
<source>An empty file is not allowed.</source>
|
||||
<target>ملف فارغ غير مسموح به.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="79">
|
||||
<source>The host could not be resolved.</source>
|
||||
<target>يتعذر الإتصال بالنطاق.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="80">
|
||||
<source>This value does not match the expected {{ charset }} charset.</source>
|
||||
<target>هذه القيمة غير متطابقة مع صيغة التحويل {{ charset }}.</target>
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
||||
|
Reference in New Issue
Block a user