8000 Merge branch '2.6' into 2.7 · symfony/symfony@bab6db5 · GitHub
[go: up one dir, main page]

Skip to content

Commit bab6db5

Browse files
committed
Merge branch '2.6' into 2.7
* 2.6: renamed some confusing tests [2.3] Fix @link annotations [2.6] Fix @link annotations Fix javascript [2.3][Translation] test refresh cache when resources File change. [Translator] Cache does not take fallback locales into consideration Conflicts: src/Symfony/Bundle/FrameworkBundle/Tests/Translation/TranslatorTest.php src/Symfony/Component/Form/Extension/HttpFoundation/EventListener/BindRequestListener.php src/Symfony/Component/HttpKernel/Tests/HttpKernelTest.php src/Symfony/Component/Validator/ValidatorInterface.php
2 parents 9842205 + 234cebd commit bab6db5

File tree

17 files changed

+78
-28
lines changed

17 files changed

+78
-28
lines changed

src/Symfony/Bridge/Twig/Node/RenderBlockNode.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
namespace Symfony\Bridge\Twig\Node;
1313

1414
/**
15-
* Compiles a call to {@link FormRendererInterface::renderBlock()}.
15+
* Compiles a call to {@link \Symfony\Component\Form\FormRendererInterface::renderBlock()}.
1616
*
1717
* The function name is used as block name. For example, if the function name
1818
* is "foo", the block "foo" will be rendered.
9E88

src/Symfony/Bundle/DebugBundle/DependencyInjection/Compiler/DumpDataCollectorPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
use Symfony\Component\DependencyInjection\ContainerBuilder;
1616

1717
/**
18-
* Registers the file link format for the {@link DumpDataCollector}.
18+
* Registers the file link format for the {@link \Symfony\Component\HttpKernel\DataCollector\DumpDataCollector\DumpDataCollector}.
1919
*
2020
* @author Christian Flothmann <christian.flothmann@xabbuh.de>
2121
*/

src/Symfony/Bundle/FrameworkBundle/Tests/Translation/TranslatorTest.php

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Bundle\FrameworkBundle\Tests\Translation;
1313

1414
use Symfony\Bundle\FrameworkBundle\Translation\Translator;
15+
use Symfony\Component\Translation\Loader\ArrayLoader;
1516
use Symfony\Component\Translation\MessageCatalogue;
1617
use Symfony\Component\Filesystem\Filesystem;
1718
use Symfony\Component\Translation\MessageSelector;
@@ -77,6 +78,8 @@ public function testTransWithCaching()
7778

< F438 /code>
7879
// do it another time as the cache is primed now
7980
$loader = $this->getMock('Symfony\Component\Translation\Loader\LoaderInterface');
81+
$loader->expects($this->never())->method('load');
82+
8083
$translator = $this->getTranslator($loader, array('cache_dir' => $this->tmpDir));
8184
$translator->setLocale('fr');
8285
$translator->setFallbackLocales(array('en', 'es', 'pt-PT', 'pt_BR', 'fr.UTF-8', 'sr@latin'));
@@ -90,6 +93,27 @@ public function testTransWithCaching()
9093
$this->assertEquals('other choice 1 (PT-BR)', $translator->transChoice('other choice', 1));
9194
$this->assertEquals('foobarbaz (fr.UTF-8)', $translator->trans('foobarbaz'));
9295
$this->assertEquals('foobarbax (sr@latin)', $translator->trans('foobarbax'));
96+
97+
// refresh cache again when resource file resources file change
98+
$resource = $this->getMock('Symfony\Component\Config\Resource\ResourceInterface');
99+
$resource
100+
->expects($this->at(0))
101+
->method('isFresh')
102+
->will($this->returnValue(false))
103+
;
104+
$catalogue = $this->getCatalogue('fr', array('foo' => 'foo fresh'));
105+
$catalogue->addResource($resource);
106+
107+
$loader = $this->getMock('Symfony\Component\Translation\Loader\LoaderInterface');
108+
$loader
109+
->expects($this->at(0))
110+
->method('load')
111+
->will($this->returnValue($catalogue))
112+
;
113+
114+
$translator = $this->getTranslator($loader, array('cache_dir' => $this->tmpDir));
115+
$translator->setLocale('fr');
116+
$this->assertEquals('foo fresh', $translator->trans('foo'));
93117
}
94118

95119
public function testTransWithCachingWithInvalidLocale()
@@ -227,12 +251,7 @@ protected function getContainer($loader)
227251

228252
public function getTranslator($loader, $options = array(), $loaderFomat = 'loader', $translatorClass = '\Symfony\Bundle\FrameworkBundle\Translation\Translator')
229253
{
230-
$translator = new $translatorClass(
231-
$this->getContainer($loader),
232-
new MessageSelector(),
233-
array($loaderFomat => array($loaderFomat)),
234-
$options
235-
);
254+
$translator = $this->createTranslator($loader, $options, $translatorClass, $loaderFomat);
236255

237256
if ('loader' === $loaderFomat) {
238257
$translator->addResource('loader', 'foo', 'fr');
@@ -267,6 +286,16 @@ public function testWarmup()
267286
$translator->warmup($this->tmpDir);
268287
$this->assertTrue(file_exists($this->tmpDir.'/catalogue.fr.'.$catalogueHash.'.php'));
269288
}
289+
290+
private function createTranslator($loader, $options, $translatorClass = '\Symfony\Bundle\FrameworkBundle\Translation\Translator', $loaderFomat = 'loader')
291+
{
292+
return new $translatorClass(
293+
$this->getContainer($loader),
294+
new MessageSelector(),
295+
array($loaderFomat => array($loaderFomat)),
296+
$options
297+
);
298+
}
270299
}
271300

272301
class TranslatorWithInvalidLocale extends Translator

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/time.html.twig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,13 @@
103103
return dict.hasOwnProperty(key)
104104
? dict[key]
105105
: null;
106-
}
106+
};
107107
108108
this.set = function(key, value) {
109109
dict[key] = value;
110110
111111
return value;
112-
}
112+
};
113113
};
114114
115115
/**
@@ -383,7 +383,7 @@
383383
384384
return this;
385385
};
386-
};
386+
}
387387
388388
function canvasAutoUpdateOnResizeAndSubmit(e) {
389389
e.preventDefault();

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/layout.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@
115115
for (elem in menuItems) {
116116
if (typeof(menuItems[elem].children) !== 'undefined' &&
117117
menuItems[elem].children.length > 0) {
118-
child = menuItems[elem].children[0]
118+
child = menuItems[elem].children[0];
119119
120120
if ('' === child.getAttribute('title') ||
121121
null === child.getAttribute('title')) {

src/Symfony/Component/Form/Extension/Core/ChoiceList/ChoiceListInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public function getRemainingViews();
8888
* Returns the indices corresponding to the given choices.
8989
*
9090
* The indices must be positive integers or strings accepted by
91-
* {@link FormConfigBuilder::validateName()}.
91+
* {@link \Symfony\Component\Form\FormConfigBuilder::validateName()}.
9292
*
9393
* The index "placeholder" is internally reserved.
9494
*
@@ -108,7 +108,7 @@ public function getIndicesForChoices(array $choices);
108108
* Returns the indices corresponding to the given values.
109109
*
110110
* The indices must be positive integers or strings accepted by
111-
* {@link FormConfigBuilder::validateName()}.
111+
* {@link \Symfony\Component\Form\FormConfigBuilder::validateName()}.
112112
*
113113
* The index "placeholder" is internally reserved.
114114
*

src/Symfony/Component/Form/Extension/Core/Type/BaseType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
* Encapsulates common logic of {@link FormType} and {@link ButtonType}.
2222
*
2323
* This type does not appear in the form's type inheritance chain and as such
24-
* cannot be extended (via {@link FormTypeExtension}s) nor themed.
24+
* cannot be extended (via {@link \Symfony\Component\Form\FormExtensionInterface}) nor themed.
2525
*
2626
* @author Bernhard Schussek <bschussek@gmail.com>
2727
*/

src/Symfony/Component/Form/Extension/DataCollector/FormDataCollector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
use Symfony\Component\HttpKernel\DataCollector\DataCollector;
1919

2020
/**
21-
* Data collector for {@link \Symfony\Component\Form\FormInterface} instances.
21+
* Data collector for {@link FormInterface} instances.
2222
*
2323
* @since 2.4
2424
* @author Robert Schönthal <robert.schoenthal@gmail.com>

src/Symfony/Component/Form/Extension/HttpFoundation/EventListener/BindRequestListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
* @author Bernhard Schussek <bschussek@gmail.com>
2121
*
2222
* @deprecated since version 2.3, to be removed in 3.0.
23-
* Pass the Request instance to {@link Form::handleRequest()} instead.
23+
* Pass the Request instance to {@link \Symfony\Component\Form\Form::handleRequest()} instead.
2424
*/
2525
class BindRequestListener implements EventSubscriberInterface
2626
{

src/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationPath.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class ViolationPath implements \IteratorAggregate, PropertyPathInterface
4848
/**
4949
* Creates a new violation path from a string.
5050
*
51-
* @param string $violationPath The property path of a {@link ConstraintViolation}
51+
* @param string $violationPath The property path of a {@link \Symfony\Component\Validator\ConstraintViolation}
5252
* object.
5353
*/
5454
public function __construct($violationPath)

src/Symfony/Component/Form/NativeRequestHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ private static function getRequestMethod()
159159
* It's safe to pass an already converted array, in which case this method
160160
* just returns the original array unmodified.
161161
*
162-
* This method is identical to {@link Symfony\Component\HttpFoundation\FileBag::fixPhpFilesArray}
162+
* This method is identical to {@link \Symfony\Component\HttpFoundation\FileBag::fixPhpFilesArray}
163163
* and should be kept as such in order to port fixes quickly and easily.
164164
*
165165
* @param array $data

src/Symfony/Component/HttpKernel/Tests/HttpKernelTest.php

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
class HttpKernelTest extends \PHPUnit_Framework_TestCase
2525
{
26-
public function testHandleWhenControllerThrowsAnExceptionAndRawIsTrue()
26+
public function testHandleWhenControllerThrowsAnExceptionAndCatchIsTrue()
2727
{
2828
$exception = new \RuntimeException();
2929
$kernel = new HttpKernel(new EventDispatcher(), $this->getResolver(function () use ($exception) { throw $exception; }));
@@ -39,27 +39,46 @@ public function testHandleWhenControllerThrowsAnExceptionAndRawIsTrue()
3939
/**
4040
* @expectedException \RuntimeException
4141
*/
42-
public function testHandleWhenControllerThrowsAnExceptionAndRawIsFalseAndNoListenerIsRegistered()
42+
public function testHandleWhenControllerThrowsAnExceptionAndCatchIsFalseAndNoListenerIsRegistered()
4343
{
4444
$kernel = new HttpKernel(new EventDispatcher(), $this->getResolver(function () { throw new \RuntimeException(); }));
4545

4646
$kernel->handle(new Request(), HttpKernelInterface::MASTER_REQUEST, false);
4747
}
4848

49-
public function testHandleWhenControllerThrowsAnExceptionAndRawIsFalse()
49+
public function testHandleWhenControllerThrowsAnExceptionAndCatchIsTrueWithAHandlingListener()
5050
{
5151
$dispatcher = new EventDispatcher();
5252
$dispatcher->addListener(KernelEvents::EXCEPTION, function ($event) {
5353
$event->setResponse(new Response($event->getException()->getMessage()));
5454
});
5555

5656
$kernel = new HttpKernel($dispatcher, $this->getResolver(function () { throw new \RuntimeException('foo'); }));
57-
$response = $kernel->handle(new Request());
57+
$response = $kernel->handle(new Request(), HttpKernelInterface::MASTER_REQUEST, true);
5858

5959
$this->assertEquals('500', $response->getStatusCode());
6060
$this->assertEquals('foo', $response->getContent());
6161
}
6262

63+
public function testHandleWhenControllerThrowsAnExceptionAndCatchIsTrueWithANonHandlingListener()
64+
{
65+
$exception = new \RuntimeException();
66+
67+
$dispatcher = new EventDispatcher();
68+
$dispatcher->addListener(KernelEvents::EXCEPTION, function ($event) {
69+
// should set a response, but does not
70+
});
71+
72+
$kernel = new HttpKernel($dispatcher, $this->getResolver(function () use($exception) { throw $exception; }));
73+
74+
try {
75+
$kernel->handle(new Request(), HttpKernelInterface::MASTER_REQUEST, true);
76+
$this->fail('LogicException expected');
77+
} catch (\LogicException $e) {
78+
$this->assertSame($exception, $e->getPrevious());
79+
}
80+
}
81+
6382
public function testHandleExceptionWithARedirectionResponse()
6483
{
6584
$dispatcher = new EventDispatcher();

src/Symfony/Component/OptionsResolver/Exception/AccessException.php

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

1414
/**
1515
* Thrown when trying to read an option outside of or write it inside of
16-
* {@link Options::resolve()}.
16+
* {@link \Symfony\Component\OptionsResolver\Options::resolve()}.
1717
*
1818
* @author Bernhard Schussek <bschussek@gmail.com>
1919
*/

src/Symfony/Component/Validator/DefaultTranslator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public function trans($id, array $parameters = array(), $domain = null, $locale
9292
* have the same expressiveness. While Translator supports intervals in
9393
* message translations, which are needed for languages other than English,
9494
* this translator does not. You should use Translator or a custom
95-
* implementation of {@link TranslatorInterface} if you need this or similar
95+
* implementation of {@link \Symfony\Component\Translation\TranslatorInterface} if you need this or similar
9696
* functionality.
9797
*
9898
* Example usage:

src/Symfony/Component/Validator/Mapping/Factory/LazyLoadingMetadataFactory.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
use Symfony\Component\Validator\Exception\NoSuchMetadataException;
1515
use Symfony\Component\Validator\Mapping\Cache\CacheInterface;
1616
use Symfony\Component\Validator\Mapping\ClassMetadata;
17+
use Symfony\Component\Validator\Mapping\ClassMetadataInterface;
18+
use Symfony\Component\Validator\Mapping\Loader\LoaderChain;
1719
use Symfony\Component\Validator\Mapping\Loader\LoaderInterface;
1820

1921
/**
@@ -28,7 +30,7 @@
2830
* Whenever a new metadata instance is created, it is passed to the loader,
2931
* which can configure the metadata based on configuration loaded from the
3032
* filesystem or a database. If you want to use multiple loaders, wrap them in a
31-
* {@link Loader\LoaderChain}.
33+
* {@link LoaderChain}.
3234
*
3335
* You can also optionally pass a {@link CacheInterface} instance to the
3436
* constructor. This cache will be used for persisting the generated metadata

src/Symfony/Component/Validator/Mapping/Factory/MetadataFactoryInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
use Symfony\Component\Validator\MetadataFactoryInterface as LegacyMetadataFactoryInterface;
1515

1616
/**
17-
* Returns {@link MetadataInterface} instances for values.
17+
* Returns {@link \Symfony\Component\Validator\Mapping\MetadataInterface} instances for values.
1818
*
1919
* @since 2.5
2020
* @author Bernhard Schussek <bschussek@gmail.com>

src/Symfony/Component/Validator/ValidatorInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
* @api
2020
*
2121
* @deprecated since version 2.5, to be removed in 3.0.
22-
* Use {@link Validator\ValidatorInterface} instead.
22+
* Use {@link \Symfony\Component\Validator\ValidatorInterface} instead.
2323
*/
2424
interface ValidatorInterface
2525
{

0 commit comments

Comments
 (0)
0