diff --git a/.travis.yml b/.travis.yml index 52acc2f6ae..44330620ac 100644 --- a/.travis.yml +++ b/.travis.yml @@ -35,10 +35,10 @@ before_install: - if [ "$TRAVIS_BRANCH" = "master" ]; then export COMPOSER_ROOT_VERSION=dev-master; else export COMPOSER_ROOT_VERSION="$TRAVIS_BRANCH".x-dev; fi; install: - - if [ "$components" = "no" ]; then composer --prefer-source --dev install; fi; + - if [ "$components" = "no" ]; then composer --prefer-source install; fi; script: - if [ "$components" = "no" ]; then ls -d src/Symfony/*/* | parallel --gnu --keep-order 'echo -e "\\nRunning {} tests"; phpunit --exclude-group tty,benchmark,intl-data {} || (echo -e "\\e[41mKO\\e[0m {}" && $(exit 1));'; fi; - if [ "$components" = "no" ]; then echo -e "\\nRunning tests requiring tty"; phpunit --group tty || (echo -e "\\e[41mKO\\e[0m tty group" && $(exit 1)); fi; - - if [ "$components" = "high" ]; then find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist | sed 's#\(.*\)/.*#\1#' | parallel --gnu --keep-order -j25% 'echo -e "\\nRunning {} tests"; cd {}; composer --prefer-source --dev update; phpunit --exclude-group tty,benchmark,intl-data || (echo -e "\\e[41mKO\\e[0m {}" && $(exit 1));'; fi; - - if [ "$components" = "low" ]; then find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist | sed 's#\(.*\)/.*#\1#' | parallel --gnu --keep-order -j25% 'echo -e "\\nRunning {} tests"; cd {}; composer --prefer-source --dev --prefer-lowest --prefer-stable update; phpunit --exclude-group tty,benchmark,intl-data || (echo -e "\\e[41mKO\\e[0m {}" && $(exit 1));'; fi; + - if [ "$components" = "high" ]; then find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist | sed 's#\(.*\)/.*#\1#' | parallel --gnu --keep-order -j25% 'echo -e "\\nRunning {} tests"; cd {}; composer --prefer-source update; phpunit --exclude-group tty,benchmark,intl-data || (echo -e "\\e[41mKO\\e[0m {}" && $(exit 1));'; fi; + - if [ "$components" = "low" ]; then find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist | sed 's#\(.*\)/.*#\1#' | parallel --gnu --keep-order -j25% 'echo -e "\\nRunning {} tests"; cd {}; composer --prefer-source --prefer-lowest --prefer-stable update; phpunit --exclude-group tty,benchmark,intl-data || (echo -e "\\e[41mKO\\e[0m {}" && $(exit 1));'; fi; diff --git a/src/Symfony/Bridge/Doctrine/README.md b/src/Symfony/Bridge/Doctrine/README.md index 972ccbfc96..3dabc3cd6d 100644 --- a/src/Symfony/Bridge/Doctrine/README.md +++ b/src/Symfony/Bridge/Doctrine/README.md @@ -10,5 +10,5 @@ Resources You can run the unit tests with the following command: $ cd path/to/Symfony/Bridge/Doctrine/ - $ composer.phar install + $ composer install $ phpunit diff --git a/src/Symfony/Bridge/Monolog/README.md b/src/Symfony/Bridge/Monolog/README.md index c666f1d150..b0d91ca4f4 100644 --- a/src/Symfony/Bridge/Monolog/README.md +++ b/src/Symfony/Bridge/Monolog/README.md @@ -9,5 +9,5 @@ Resources You can run the unit tests with the following command: $ cd path/to/Symfony/Bridge/Monolog/ - $ composer.phar install + $ composer install $ phpunit diff --git a/src/Symfony/Bridge/Propel1/README.md b/src/Symfony/Bridge/Propel1/README.md index 22d0aa2a7a..22590ca583 100644 --- a/src/Symfony/Bridge/Propel1/README.md +++ b/src/Symfony/Bridge/Propel1/README.md @@ -9,5 +9,5 @@ Resources You can run the unit tests with the following command: $ cd path/to/Symfony/Bridge/Propel1/ - $ composer.phar install + $ composer install $ phpunit diff --git a/src/Symfony/Bridge/ProxyManager/README.md b/src/Symfony/Bridge/ProxyManager/README.md index f2ce134241..35d41998b8 100644 --- a/src/Symfony/Bridge/ProxyManager/README.md +++ b/src/Symfony/Bridge/ProxyManager/README.md @@ -9,7 +9,7 @@ Resources You can run the unit tests with the following command: $ cd path/to/Symfony/Bridge/ProxyManager/ - $ composer.phar install --dev + $ composer install $ phpunit [1]: https://github.com/Ocramius/ProxyManager diff --git a/src/Symfony/Bridge/Twig/Form/TwigRenderer.php b/src/Symfony/Bridge/Twig/Form/TwigRenderer.php index 3b47c26ea6..ac139e44a1 100644 --- a/src/Symfony/Bridge/Twig/Form/TwigRenderer.php +++ b/src/Symfony/Bridge/Twig/Form/TwigRenderer.php @@ -11,11 +11,7 @@ namespace Symfony\Bridge\Twig\Form; -use Symfony\Component\Form\Exception\UnexpectedTypeException; -use Symfony\Component\Form\Extension\Csrf\CsrfProvider\CsrfProviderAdapter; -use Symfony\Component\Form\Extension\Csrf\CsrfProvider\CsrfProviderInterface; use Symfony\Component\Form\FormRenderer; -use Symfony\Component\Security\Csrf\CsrfTokenManagerInterface; /** * @author Bernhard Schussek @@ -29,12 +25,6 @@ class TwigRenderer extends FormRenderer implements TwigRendererInterface public function __construct(TwigRendererEngineInterface $engine, $csrfTokenManager = null) { - if ($csrfTokenManager instanceof CsrfProviderInterface) { - $csrfTokenManager = new CsrfProviderAdapter($csrfTokenManager); - } elseif (null !== $csrfTokenManager && !$csrfTokenManager instanceof CsrfTokenManagerInterface) { - throw new UnexpectedTypeException($csrfTokenManager, 'CsrfProviderInterface or CsrfTokenManagerInterface'); - } - parent::__construct($engine, $csrfTokenManager); $this->engine = $engine; diff --git a/src/Symfony/Bridge/Twig/README.md b/src/Symfony/Bridge/Twig/README.md index c5053c860b..1f92af944f 100644 --- a/src/Symfony/Bridge/Twig/README.md +++ b/src/Symfony/Bridge/Twig/README.md @@ -11,5 +11,5 @@ If you want to run the unit tests, install dev dependencies before running PHPUnit: $ cd path/to/Symfony/Bridge/Twig/ - $ composer.phar install + $ composer install $ phpunit diff --git a/src/Symfony/Bridge/Twig/composer.json b/src/Symfony/Bridge/Twig/composer.json index df8a513113..8e5dfe46ae 100644 --- a/src/Symfony/Bridge/Twig/composer.json +++ b/src/Symfony/Bridge/Twig/composer.json @@ -17,7 +17,6 @@ ], "require": { "php": ">=5.3.9", - "symfony/security-csrf": "~2.6|~3.0.0", "twig/twig": "~1.18" }, "require-dev": { diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index bbd824e1d1..8f7dc263fd 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -284,13 +284,13 @@ class FrameworkExtension extends Extension return; } + $loader->load('profiling.xml'); + $loader->load('collectors.xml'); + if (true === $this->formConfigEnabled) { $loader->load('form_debug.xml'); } - $loader->load('profiling.xml'); - $loader->load('collectors.xml'); - $container->setParameter('profiler_listener.only_exceptions', $config['only_exceptions']); $container->setParameter('profiler_listener.only_master_requests', $config['only_master_requests']); diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/public/css/structure.css b/src/Symfony/Bundle/FrameworkBundle/Resources/public/css/structure.css index 00b948f228..87499d072a 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/public/css/structure.css +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/public/css/structure.css @@ -62,7 +62,7 @@ img { width: 970px; margin: 0 auto; } -pre { +#content pre { white-space: normal; font-family: Arial, Helvetica, sans-serif; } diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/widget_attributes.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/widget_attributes.html.php index c226047731..118e764c85 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/widget_attributes.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/widget_attributes.html.php @@ -2,7 +2,7 @@ id="escape($id) ?>" name="escape($full_name) disabled="disabled" required="required" $v): ?> - + escape($k), $view->escape($view['translator']->trans($v, array(), $translation_domain))) ?> escape($k), $view->escape($k)) ?> diff --git a/src/Symfony/Component/BrowserKit/README.md b/src/Symfony/Component/BrowserKit/README.md index 1b40c9fe2d..3c0ee3a040 100644 --- a/src/Symfony/Component/BrowserKit/README.md +++ b/src/Symfony/Component/BrowserKit/README.md @@ -19,5 +19,5 @@ provided by the HttpKernel component. You can run the unit tests with the following command: $ cd path/to/Symfony/Component/BrowserKit/ - $ composer.phar install + $ composer install $ phpunit diff --git a/src/Symfony/Component/ClassLoader/README.md b/src/Symfony/Component/ClassLoader/README.md index 37df048699..0d2955dc97 100644 --- a/src/Symfony/Component/ClassLoader/README.md +++ b/src/Symfony/Component/ClassLoader/README.md @@ -81,5 +81,5 @@ Resources You can run the unit tests with the following command: $ cd path/to/Symfony/Component/ClassLoader/ - $ composer.phar install + $ composer install $ phpunit diff --git a/src/Symfony/Component/Config/README.md b/src/Symfony/Component/Config/README.md index 1b12e89a8b..690d7d74f9 100644 --- a/src/Symfony/Component/Config/README.md +++ b/src/Symfony/Component/Config/README.md @@ -12,6 +12,6 @@ Resources You can run the unit tests with the following command: $ cd path/to/Symfony/Component/Config/ - $ composer.phar install + $ composer install $ phpunit diff --git a/src/Symfony/Component/Console/Command/HelpCommand.php b/src/Symfony/Component/Console/Command/HelpCommand.php index d370da2709..4cf9362419 100644 --- a/src/Symfony/Component/Console/Command/HelpCommand.php +++ b/src/Symfony/Component/Console/Command/HelpCommand.php @@ -83,7 +83,7 @@ EOF $helper = new DescriptorHelper(); $helper->describe($output, $this->command, array( 'format' => $input->getOption('format'), - 'raw' => $input->getOption('raw'), + 'raw_text' => $input->getOption('raw'), )); $this->command = null; diff --git a/src/Symfony/Component/Console/Formatter/OutputFormatter.php b/src/Symfony/Component/Console/Formatter/OutputFormatter.php index 774f65fba4..90b1970f4b 100644 --- a/src/Symfony/Component/Console/Formatter/OutputFormatter.php +++ b/src/Symfony/Component/Console/Formatter/OutputFormatter.php @@ -150,6 +150,10 @@ class OutputFormatter implements OutputFormatterInterface $pos = $match[1]; $text = $match[0]; + if (0 != $pos && '\\' == $message[$pos - 1]) { + continue; + } + // add the text up to the next tag $output .= $this->applyCurrentStyle(substr($message, $offset, $pos - $offset)); $offset = $pos + strlen($text); @@ -164,9 +168,6 @@ class OutputFormatter implements OutputFormatterInterface if (!$open && !$tag) { // $this->styleStack->pop(); - } elseif ($pos && '\\' == $message[$pos - 1]) { - // escaped tag - $output .= $this->applyCurrentStyle($text); } elseif (false === $style = $this->createStyleFromString(strtolower($tag))) { $output .= $this->applyCurrentStyle($text); } elseif ($open) { diff --git a/src/Symfony/Component/Console/Helper/Helper.php b/src/Symfony/Component/Console/Helper/Helper.php index 78a73ee56f..b288d446bd 100644 --- a/src/Symfony/Component/Console/Helper/Helper.php +++ b/src/Symfony/Component/Console/Helper/Helper.php @@ -43,7 +43,7 @@ abstract class Helper implements HelperInterface } /** - * Returns the length of a string, using mb_strlen if it is available. + * Returns the length of a string, using mb_strwidth if it is available. * * @param string $string The string to check its length * diff --git a/src/Symfony/Component/Console/Helper/Table.php b/src/Symfony/Component/Console/Helper/Table.php index 5b4ad6900f..67cfbb503d 100644 --- a/src/Symfony/Component/Console/Helper/Table.php +++ b/src/Symfony/Component/Console/Helper/Table.php @@ -307,8 +307,8 @@ class Table $width = $this->getColumnWidth($column); // str_pad won't work properly with multi-byte strings, we need to fix the padding - if (function_exists('mb_strlen') && false !== $encoding = mb_detect_encoding($cell)) { - $width += strlen($cell) - mb_strlen($cell, $encoding); + if (function_exists('mb_strwidth') && false !== $encoding = mb_detect_encoding($cell)) { + $width += strlen($cell) - mb_strwidth($cell, $encoding); } $width += Helper::strlen($cell) - Helper::strlenWithoutDecoration($this->output->getFormatter(), $cell); diff --git a/src/Symfony/Component/Console/README.md b/src/Symfony/Component/Console/README.md index 00722e6fb7..98041446e8 100644 --- a/src/Symfony/Component/Console/README.md +++ b/src/Symfony/Component/Console/README.md @@ -50,7 +50,7 @@ Tests You can run the unit tests with the following command: $ cd path/to/Symfony/Component/Console/ - $ composer.phar install + $ composer install $ phpunit Third Party diff --git a/src/Symfony/Component/Console/Tests/Formatter/OutputFormatterTest.php b/src/Symfony/Component/Console/Tests/Formatter/OutputFormatterTest.php index 435d2d4916..f5daaf624a 100644 --- a/src/Symfony/Component/Console/Tests/Formatter/OutputFormatterTest.php +++ b/src/Symfony/Component/Console/Tests/Formatter/OutputFormatterTest.php @@ -101,6 +101,11 @@ class OutputFormatterTest extends \PHPUnit_Framework_TestCase "(\033[32mz>=2.0,format('('.$formatter->escape('z>=2.0,)') ); + + $this->assertEquals( + "\033[32msome error\033[0m", + $formatter->format(''.$formatter->escape('some error').'') + ); } public function testDeepNestedStyles() diff --git a/src/Symfony/Component/Console/Tests/Helper/LegacyTableHelperTest.php b/src/Symfony/Component/Console/Tests/Helper/LegacyTableHelperTest.php index 046cc19ca8..e164a547fc 100644 --- a/src/Symfony/Component/Console/Tests/Helper/LegacyTableHelperTest.php +++ b/src/Symfony/Component/Console/Tests/Helper/LegacyTableHelperTest.php @@ -256,7 +256,7 @@ TABLE public function testRenderMultiByte() { - if (!function_exists('mb_strlen')) { + if (!function_exists('mb_strwidth')) { $this->markTestSkipped('The "mbstring" extension is not available'); } @@ -276,6 +276,33 @@ TABLE | 1234 | +------+ +TABLE; + + $this->assertEquals($expected, $this->getOutputContent($output)); + } + + public function testRenderFullWidthCharacters() + { + if (!function_exists('mb_strwidth')) { + $this->markTestSkipped('The "mbstring" extension is not available'); + } + + $table = new TableHelper(); + $table + ->setHeaders(array('あいうえお')) + ->setRows(array(array(1234567890))) + ->setLayout(TableHelper::LAYOUT_DEFAULT) + ; + $table->render($output = $this->getOutputStream()); + + $expected = + <<assertEquals($expected, $this->getOutputContent($output)); diff --git a/src/Symfony/Component/CssSelector/README.md b/src/Symfony/Component/CssSelector/README.md index ef28bc9d17..ffe6c890f6 100644 --- a/src/Symfony/Component/CssSelector/README.md +++ b/src/Symfony/Component/CssSelector/README.md @@ -43,5 +43,5 @@ which is distributed under the BSD license. You can run the unit tests with the following command: $ cd path/to/Symfony/Component/CssSelector/ - $ composer.phar install + $ composer install $ phpunit diff --git a/src/Symfony/Component/Debug/README.md b/src/Symfony/Component/Debug/README.md index 70c460370b..67e6d6c278 100644 --- a/src/Symfony/Component/Debug/README.md +++ b/src/Symfony/Component/Debug/README.md @@ -39,5 +39,5 @@ Resources You can run the unit tests with the following command: $ cd path/to/Symfony/Component/Debug/ - $ composer.phar install --dev + $ composer install $ phpunit diff --git a/src/Symfony/Component/DependencyInjection/README.md b/src/Symfony/Component/DependencyInjection/README.md index 387fae4c10..19a1142ae2 100644 --- a/src/Symfony/Component/DependencyInjection/README.md +++ b/src/Symfony/Component/DependencyInjection/README.md @@ -76,5 +76,5 @@ Resources You can run the unit tests with the following command: $ cd path/to/Symfony/Component/DependencyInjection/ - $ composer.phar install + $ composer install $ phpunit diff --git a/src/Symfony/Component/DomCrawler/README.md b/src/Symfony/Component/DomCrawler/README.md index 646573f4e0..d2c8de5da4 100644 --- a/src/Symfony/Component/DomCrawler/README.md +++ b/src/Symfony/Component/DomCrawler/README.md @@ -32,5 +32,5 @@ Resources You can run the unit tests with the following command: $ cd path/to/Symfony/Component/DomCrawler/ - $ composer.phar install + $ composer install $ phpunit diff --git a/src/Symfony/Component/EventDispatcher/README.md b/src/Symfony/Component/EventDispatcher/README.md index 0fbc35e2a4..8031f4dd3f 100644 --- a/src/Symfony/Component/EventDispatcher/README.md +++ b/src/Symfony/Component/EventDispatcher/README.md @@ -23,5 +23,5 @@ Resources You can run the unit tests with the following command: $ cd path/to/Symfony/Component/EventDispatcher/ - $ composer.phar install + $ composer install $ phpunit diff --git a/src/Symfony/Component/Filesystem/README.md b/src/Symfony/Component/Filesystem/README.md index 85b0f1c522..df09f93dce 100644 --- a/src/Symfony/Component/Filesystem/README.md +++ b/src/Symfony/Component/Filesystem/README.md @@ -43,5 +43,5 @@ Resources You can run the unit tests with the following command: $ cd path/to/Symfony/Component/Filesystem/ - $ composer.phar install + $ composer install $ phpunit diff --git a/src/Symfony/Component/Finder/README.md b/src/Symfony/Component/Finder/README.md index 7a96219cce..413cdf57e7 100644 --- a/src/Symfony/Component/Finder/README.md +++ b/src/Symfony/Component/Finder/README.md @@ -45,7 +45,7 @@ Resources You can run the unit tests with the following command: $ cd path/to/Symfony/Component/Finder/ - $ composer.phar install + $ composer install $ phpunit [1]: http://api.symfony.com/2.5/Symfony/Component/Finder/SplFileInfo.html diff --git a/src/Symfony/Component/Form/FormEvents.php b/src/Symfony/Component/Form/FormEvents.php index 79c3baafeb..025383eafd 100644 --- a/src/Symfony/Component/Form/FormEvents.php +++ b/src/Symfony/Component/Form/FormEvents.php @@ -13,6 +13,12 @@ namespace Symfony\Component\Form; use Symfony\Component\Form\Deprecated\FormEvents as Deprecated; /** + * To learn more about how form events work check the documentation + * entry at {@link http://symfony.com/doc/any/components/form/form_events.html} + * + * To learn how to dynamically modify forms using events check the cookbook + * entry at {@link http://symfony.com/doc/any/cookbook/form/dynamic_form_modification.html} + * * @author Bernhard Schussek */ final class FormEvents diff --git a/src/Symfony/Component/Form/README.md b/src/Symfony/Component/Form/README.md index 2bd259debf..298a99d012 100644 --- a/src/Symfony/Component/Form/README.md +++ b/src/Symfony/Component/Form/README.md @@ -22,5 +22,5 @@ Resources You can run the unit tests with the following command: $ cd path/to/Symfony/Component/Form/ - $ composer.phar install + $ composer install $ phpunit diff --git a/src/Symfony/Component/Form/Tests/AbstractLayoutTest.php b/src/Symfony/Component/Form/Tests/AbstractLayoutTest.php index 9360e91378..21e0ba364b 100644 --- a/src/Symfony/Component/Form/Tests/AbstractLayoutTest.php +++ b/src/Symfony/Component/Form/Tests/AbstractLayoutTest.php @@ -2107,4 +2107,18 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg // no foo $this->assertNotContains('foo="', $html); } + + public function testTranslatedAttributes() + { + $view = $this->factory->createNamedBuilder('name', 'form') + ->add('firstName', 'text', array('attr' => array('title' => 'Foo'))) + ->add('lastName', 'text', array('attr' => array('placeholder' => 'Bar'))) + ->getForm() + ->createView(); + + $html = $this->renderForm($view); + + $this->assertMatchesXpath($html, '/form//input[@title="[trans]Foo[/trans]"]'); + $this->assertMatchesXpath($html, '/form//input[@placeholder="[trans]Bar[/trans]"]'); + } } diff --git a/src/Symfony/Component/HttpFoundation/README.md b/src/Symfony/Component/HttpFoundation/README.md index 008c1587f6..11ad6eef54 100644 --- a/src/Symfony/Component/HttpFoundation/README.md +++ b/src/Symfony/Component/HttpFoundation/README.md @@ -52,5 +52,5 @@ Resources You can run the unit tests with the following command: $ cd path/to/Symfony/Component/HttpFoundation/ - $ composer.phar install + $ composer install $ phpunit diff --git a/src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php b/src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php index 8845814520..4d83e9a849 100644 --- a/src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php +++ b/src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php @@ -91,7 +91,7 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter $this->data = array( 'format' => $request->getRequestFormat(), 'content' => $content, - 'content_type' => $response->headers->get('Content-Type') ? $response->headers->get('Content-Type') : 'text/html', + 'content_type' => $response->headers->get('Content-Type', 'text/html'), 'status_text' => isset(Response::$statusTexts[$statusCode]) ? Response::$statusTexts[$statusCode] : '', 'status_code' => $statusCode, 'request_query' => $request->query->all(), diff --git a/src/Symfony/Component/HttpKernel/README.md b/src/Symfony/Component/HttpKernel/README.md index d9ad1cbc3f..9ec8c0427b 100644 --- a/src/Symfony/Component/HttpKernel/README.md +++ b/src/Symfony/Component/HttpKernel/README.md @@ -95,5 +95,5 @@ Resources You can run the unit tests with the following command: $ cd path/to/Symfony/Component/HttpKernel/ - $ composer.phar install + $ composer install $ phpunit diff --git a/src/Symfony/Component/Intl/CONTRIBUTING.md b/src/Symfony/Component/Intl/CONTRIBUTING.md index 0657e12019..971e0af7f5 100644 --- a/src/Symfony/Component/Intl/CONTRIBUTING.md +++ b/src/Symfony/Component/Intl/CONTRIBUTING.md @@ -10,7 +10,7 @@ Preparation To prepare, you need to install the development dependencies of the component. $ cd /path/to/Symfony/Component/Intl - $ composer.phar install --dev + $ composer install Determining your ICU version --------------------------- diff --git a/src/Symfony/Component/Intl/README.md b/src/Symfony/Component/Intl/README.md index dd7b562f26..d35582f380 100644 --- a/src/Symfony/Component/Intl/README.md +++ b/src/Symfony/Component/Intl/README.md @@ -18,7 +18,7 @@ Resources You can run the unit tests with the following command: $ cd path/to/Symfony/Component/Intl/ - $ composer.phar install --dev + $ composer install $ phpunit [0]: http://www.php.net/manual/en/intl.setup.php diff --git a/src/Symfony/Component/Intl/Resources/bin/update-data.php b/src/Symfony/Component/Intl/Resources/bin/update-data.php index 1d92bd851e..bfe99ecb3e 100644 --- a/src/Symfony/Component/Intl/Resources/bin/update-data.php +++ b/src/Symfony/Component/Intl/Resources/bin/update-data.php @@ -50,7 +50,7 @@ the subdirectories bin/ and lib/. For running this script, the intl extension must be loaded and all vendors must have been installed through composer: -composer install --dev +composer install MESSAGE ); diff --git a/src/Symfony/Component/OptionsResolver/README.md b/src/Symfony/Component/OptionsResolver/README.md index a00aec5f57..ddf73dfc27 100644 --- a/src/Symfony/Component/OptionsResolver/README.md +++ b/src/Symfony/Component/OptionsResolver/README.md @@ -14,7 +14,7 @@ Resources You can run the unit tests with the following command: $ cd path/to/Symfony/Component/OptionsResolver/ - $ composer.phar install + $ composer install $ phpunit [1]: http://symfony.com/doc/current/components/options_resolver.html diff --git a/src/Symfony/Component/Process/README.md b/src/Symfony/Component/Process/README.md index 29d1cf9330..7c83ed413e 100644 --- a/src/Symfony/Component/Process/README.md +++ b/src/Symfony/Component/Process/README.md @@ -47,5 +47,5 @@ Resources You can run the unit tests with the following command: $ cd path/to/Symfony/Component/Process/ - $ composer.phar install + $ composer install $ phpunit diff --git a/src/Symfony/Component/PropertyAccess/README.md b/src/Symfony/Component/PropertyAccess/README.md index 79b6ebca5a..9fb92f058d 100644 --- a/src/Symfony/Component/PropertyAccess/README.md +++ b/src/Symfony/Component/PropertyAccess/README.md @@ -10,5 +10,5 @@ Resources You can run the unit tests with the following command: $ cd path/to/Symfony/Component/PropertyAccess/ - $ composer.phar install + $ composer install $ phpunit diff --git a/src/Symfony/Component/Routing/README.md b/src/Symfony/Component/Routing/README.md index cd566a59c1..1a94583a87 100644 --- a/src/Symfony/Component/Routing/README.md +++ b/src/Symfony/Component/Routing/README.md @@ -32,5 +32,5 @@ Resources You can run the unit tests with the following command: $ cd path/to/Symfony/Component/Routing/ - $ composer.phar install + $ composer install $ phpunit diff --git a/src/Symfony/Component/Security/Http/Firewall/ContextListener.php b/src/Symfony/Component/Security/Http/Firewall/ContextListener.php index 8df0d34fd8..013586c025 100644 --- a/src/Symfony/Component/Security/Http/Firewall/ContextListener.php +++ b/src/Symfony/Component/Security/Http/Firewall/ContextListener.php @@ -115,6 +115,9 @@ class ContextListener implements ListenerInterface return; } + $this->dispatcher->removeListener(KernelEvents::RESPONSE, array($this, 'onKernelResponse')); + $this->registered = false; + $request = $event->getRequest(); $session = $request->getSession(); diff --git a/src/Symfony/Component/Security/Http/Tests/Firewall/ContextListenerTest.php b/src/Symfony/Component/Security/Http/Tests/Firewall/ContextListenerTest.php index cb9685a684..ae1199ac3c 100644 --- a/src/Symfony/Component/Security/Http/Tests/Firewall/ContextListenerTest.php +++ b/src/Symfony/Component/Security/Http/Tests/Firewall/ContextListenerTest.php @@ -21,6 +21,7 @@ use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage; use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; use Symfony\Component\Security\Http\Firewall\ContextListener; +use Symfony\Component\EventDispatcher\EventDispatcher; class ContextListenerTest extends \PHPUnit_Framework_TestCase { @@ -99,7 +100,7 @@ class ContextListenerTest extends \PHPUnit_Framework_TestCase new Response() ); - $listener = new ContextListener($tokenStorage, array(), 'session'); + $listener = new ContextListener($tokenStorage, array(), 'session', null, new EventDispatcher()); $listener->onKernelResponse($event); $this->assertTrue($session->isStarted()); @@ -118,7 +119,7 @@ class ContextListenerTest extends \PHPUnit_Framework_TestCase new Response() ); - $listener = new ContextListener(new TokenStorage(), array(), 'session'); + $listener = new ContextListener(new TokenStorage(), array(), 'session', null, new EventDispatcher()); $listener->onKernelResponse($event); $this->assertFalse($session->isStarted()); @@ -190,6 +191,35 @@ class ContextListenerTest extends \PHPUnit_Framework_TestCase $listener->handle($event); } + public function testOnKernelResponseListenerRemovesItself() + { + $tokenStorage = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface'); + $dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface'); + $event = $this->getMockBuilder('Symfony\Component\HttpKernel\Event\FilterResponseEvent') + ->disableOriginalConstructor() + ->getMock(); + + $listener = new ContextListener($tokenStorage, array(), 'key123', null, $dispatcher); + + $request = $this->getMock('Symfony\Component\HttpFoundation\Request'); + $request->expects($this->any()) + ->method('hasSession') + ->will($this->returnValue(true)); + + $event->expects($this->any()) + ->method('isMasterRequest') + ->will($this->returnValue(true)); + $event->expects($this->any()) + ->method('getRequest') + ->will($this->returnValue($request)); + + $dispatcher->expects($this->once()) + ->method('removeListener') + ->with(KernelEvents::RESPONSE, array($listener, 'onKernelResponse')); + + $listener->onKernelResponse($event); + } + public function testHandleRemovesTokenIfNoPreviousSessionWasFound() { $request = $this->getMock('Symfony\Component\HttpFoundation\Request'); @@ -229,7 +259,7 @@ class ContextListenerTest extends \PHPUnit_Framework_TestCase new Response() ); - $listener = new ContextListener($tokenStorage, array(), 'session'); + $listener = new ContextListener($tokenStorage, array(), 'session', null, new EventDispatcher()); $listener->onKernelResponse($event); return $session; diff --git a/src/Symfony/Component/Security/README.md b/src/Symfony/Component/Security/README.md index 66c7d80a9f..173897d184 100644 --- a/src/Symfony/Component/Security/README.md +++ b/src/Symfony/Component/Security/README.md @@ -19,5 +19,5 @@ Tests You can run the unit tests with the following command: $ cd path/to/Symfony/Component/Security/ - $ composer.phar install + $ composer install $ phpunit diff --git a/src/Symfony/Component/Serializer/README.md b/src/Symfony/Component/Serializer/README.md index 5a1606ca09..4d8ab012e9 100644 --- a/src/Symfony/Component/Serializer/README.md +++ b/src/Symfony/Component/Serializer/README.md @@ -11,5 +11,5 @@ Resources You can run the unit tests with the following command: $ cd path/to/Symfony/Component/Serializer/ - $ composer.phar install + $ composer install $ phpunit diff --git a/src/Symfony/Component/Stopwatch/README.md b/src/Symfony/Component/Stopwatch/README.md index 428bba6b63..611df90ca5 100644 --- a/src/Symfony/Component/Stopwatch/README.md +++ b/src/Symfony/Component/Stopwatch/README.md @@ -9,5 +9,5 @@ Resources You can run the unit tests with the following command: $ cd path/to/Symfony/Component/Stopwatch/ - $ composer.phar install + $ composer install $ phpunit diff --git a/src/Symfony/Component/Templating/README.md b/src/Symfony/Component/Templating/README.md index bde622fef4..253eb4f507 100644 --- a/src/Symfony/Component/Templating/README.md +++ b/src/Symfony/Component/Templating/README.md @@ -14,5 +14,5 @@ Resources You can run the unit tests with the following command: $ cd path/to/Symfony/Component/Templating/ - $ composer.phar install + $ composer install $ phpunit diff --git a/src/Symfony/Component/Translation/LoggingTranslator.php b/src/Symfony/Component/Translation/LoggingTranslator.php index a5d244a1e2..851188230b 100644 --- a/src/Symfony/Component/Translation/LoggingTranslator.php +++ b/src/Symfony/Component/Translation/LoggingTranslator.php @@ -16,7 +16,7 @@ use Psr\Log\LoggerInterface; /** * @author Abdellatif Ait boudad */ -class LoggingTranslator implements TranslatorInterface +class LoggingTranslator implements TranslatorInterface, TranslatorBagInterface { /** * @var TranslatorInterface @@ -84,6 +84,14 @@ class LoggingTranslator implements TranslatorInterface return $this->translator->getLocale(); } + /** + * {@inheritdoc} + */ + public function getCatalogue($locale = null) + { + return $this->translator->getCatalogue($locale); + } + /** * Passes through all unknown calls onto the translator object. */ diff --git a/src/Symfony/Component/Translation/README.md b/src/Symfony/Component/Translation/README.md index b1de250026..4910b4883d 100644 --- a/src/Symfony/Component/Translation/README.md +++ b/src/Symfony/Component/Translation/README.md @@ -33,5 +33,5 @@ http://symfony.com/doc/2.7/book/translation.html You can run the unit tests with the following command: $ cd path/to/Symfony/Component/Translation/ - $ composer.phar install + $ composer install $ phpunit diff --git a/src/Symfony/Component/Validator/README.md b/src/Symfony/Component/Validator/README.md index 9788f558f3..0c9bc50719 100644 --- a/src/Symfony/Component/Validator/README.md +++ b/src/Symfony/Component/Validator/README.md @@ -122,5 +122,5 @@ http://jcp.org/en/jsr/detail?id=303 You can run the unit tests with the following command: $ cd path/to/Symfony/Component/Validator/ - $ composer.phar install + $ composer install $ phpunit diff --git a/src/Symfony/Component/Yaml/Parser.php b/src/Symfony/Component/Yaml/Parser.php index e9a94d7785..fdd1e3bd6a 100644 --- a/src/Symfony/Component/Yaml/Parser.php +++ b/src/Symfony/Component/Yaml/Parser.php @@ -52,13 +52,13 @@ class Parser */ public function parse($value, $exceptionOnInvalidType = false, $objectSupport = false, $objectForMap = false) { - $this->currentLineNb = -1; - $this->currentLine = ''; - $this->lines = explode("\n", $this->cleanup($value)); - if (!preg_match('//u', $value)) { throw new ParseException('The YAML value does not appear to be valid UTF-8.'); } + $this->currentLineNb = -1; + $this->currentLine = ''; + $value = $this->cleanup($value); + $this->lines = explode("\n", $value); if (function_exists('mb_internal_encoding') && ((int) ini_get('mbstring.func_overload')) & 2) { $mbEncoding = mb_internal_encoding(); @@ -233,9 +233,8 @@ class Parser throw new ParseException('Multiple documents are not supported.'); } - // 1-liner optionally followed by newline - $lineCount = count($this->lines); - if (1 === $lineCount || (2 === $lineCount && empty($this->lines[1]))) { + // 1-liner optionally followed by newline(s) + if ($this->lines[0] === trim($value)) { try { $value = Inline::parse($this->lines[0], $exceptionOnInvalidType, $objectSupport, $objectForMap, $this->refs); } catch (ParseException $e) { diff --git a/src/Symfony/Component/Yaml/README.md b/src/Symfony/Component/Yaml/README.md index 96abbbfd16..85a9786735 100644 --- a/src/Symfony/Component/Yaml/README.md +++ b/src/Symfony/Component/Yaml/README.md @@ -17,5 +17,5 @@ Resources You can run the unit tests with the following command: $ cd path/to/Symfony/Component/Yaml/ - $ composer.phar install + $ composer install $ phpunit diff --git a/src/Symfony/Component/Yaml/Tests/ParserTest.php b/src/Symfony/Component/Yaml/Tests/ParserTest.php index 553d2fb5de..ecd4b49f40 100644 --- a/src/Symfony/Component/Yaml/Tests/ParserTest.php +++ b/src/Symfony/Component/Yaml/Tests/ParserTest.php @@ -135,6 +135,14 @@ EOF; ); $tests['Literal block chomping strip with multiple trailing newlines'] = array($expected, $yaml); + $yaml = <<<'EOF' +{} + + +EOF; + $expected = array(); + $tests['Literal block chomping strip with multiple trailing newlines after a 1-liner'] = array($expected, $yaml); + $yaml = <<<'EOF' foo: |- one