Merge branch '2.3' into 2.6
* 2.3: [FrameworkBundle] Fix title and placeholder rendering in php form templates. RequestDataCollector - small fix renamed composer.phar to composer to be consistent with the Symfony docs [FrameworkBundle] bumped min version of Routing to 2.3 removed composer --dev option everywhere fixed a test [Console] Fixed output bug, if escaped string in a formatted string. [Security] Remove ContextListener's onKernelResponse listener as it is used Revert "minor #12652 [HttpFoundation] [Hackday] #9942 test: Request::getContent() for null value (skler)" Revert "fixed assertion" fixed assertion [HttpFoundation] [Hackday] #9942 test: Request::getContent() for null value fixed URL Add reference to documentation in FormEvents phpdocs [YAML] Fix one-liners to work with multiple new lines Keep "pre" meaning for var_dump quick-and-dirty debug [Console][Table] Fix cell padding with multi-byte Conflicts: src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/widget_attributes.html.php src/Symfony/Bundle/FrameworkBundle/composer.json src/Symfony/Component/Console/Helper/TableHelper.php
This commit is contained in:
commit
38f03bd2f5
@ -36,10 +36,10 @@ before_install:
|
|||||||
- if [ "$TRAVIS_BRANCH" = "master" ]; then export COMPOSER_ROOT_VERSION=dev-master; else export COMPOSER_ROOT_VERSION="$TRAVIS_BRANCH".x-dev; fi;
|
- if [ "$TRAVIS_BRANCH" = "master" ]; then export COMPOSER_ROOT_VERSION=dev-master; else export COMPOSER_ROOT_VERSION="$TRAVIS_BRANCH".x-dev; fi;
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- if [ "$components" = "no" ]; then composer --prefer-source --dev install; fi;
|
- if [ "$components" = "no" ]; then composer --prefer-source install; fi;
|
||||||
|
|
||||||
script:
|
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 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" = "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" = "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 --dev --prefer-lowest --prefer-stable 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;
|
||||||
|
@ -10,5 +10,5 @@ Resources
|
|||||||
You can run the unit tests with the following command:
|
You can run the unit tests with the following command:
|
||||||
|
|
||||||
$ cd path/to/Symfony/Bridge/Doctrine/
|
$ cd path/to/Symfony/Bridge/Doctrine/
|
||||||
$ composer.phar install
|
$ composer install
|
||||||
$ phpunit
|
$ phpunit
|
||||||
|
@ -9,5 +9,5 @@ Resources
|
|||||||
You can run the unit tests with the following command:
|
You can run the unit tests with the following command:
|
||||||
|
|
||||||
$ cd path/to/Symfony/Bridge/Monolog/
|
$ cd path/to/Symfony/Bridge/Monolog/
|
||||||
$ composer.phar install
|
$ composer install
|
||||||
$ phpunit
|
$ phpunit
|
||||||
|
@ -9,5 +9,5 @@ Resources
|
|||||||
You can run the unit tests with the following command:
|
You can run the unit tests with the following command:
|
||||||
|
|
||||||
$ cd path/to/Symfony/Bridge/Propel1/
|
$ cd path/to/Symfony/Bridge/Propel1/
|
||||||
$ composer.phar install
|
$ composer install
|
||||||
$ phpunit
|
$ phpunit
|
||||||
|
@ -9,7 +9,7 @@ Resources
|
|||||||
You can run the unit tests with the following command:
|
You can run the unit tests with the following command:
|
||||||
|
|
||||||
$ cd path/to/Symfony/Bridge/ProxyManager/
|
$ cd path/to/Symfony/Bridge/ProxyManager/
|
||||||
$ composer.phar install --dev
|
$ composer install
|
||||||
$ phpunit
|
$ phpunit
|
||||||
|
|
||||||
[1]: https://github.com/Ocramius/ProxyManager
|
[1]: https://github.com/Ocramius/ProxyManager
|
||||||
|
@ -11,5 +11,5 @@ If you want to run the unit tests, install dev dependencies before
|
|||||||
running PHPUnit:
|
running PHPUnit:
|
||||||
|
|
||||||
$ cd path/to/Symfony/Bridge/Twig/
|
$ cd path/to/Symfony/Bridge/Twig/
|
||||||
$ composer.phar install
|
$ composer install
|
||||||
$ phpunit
|
$ phpunit
|
||||||
|
@ -62,7 +62,7 @@ img {
|
|||||||
width: 970px;
|
width: 970px;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
}
|
}
|
||||||
pre {
|
#content pre {
|
||||||
white-space: normal;
|
white-space: normal;
|
||||||
font-family: Arial, Helvetica, sans-serif;
|
font-family: Arial, Helvetica, sans-serif;
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ id="<?php echo $view->escape($id) ?>" name="<?php echo $view->escape($full_name)
|
|||||||
<?php if ($disabled): ?>disabled="disabled" <?php endif ?>
|
<?php if ($disabled): ?>disabled="disabled" <?php endif ?>
|
||||||
<?php if ($required): ?>required="required" <?php endif ?>
|
<?php if ($required): ?>required="required" <?php endif ?>
|
||||||
<?php foreach ($attr as $k => $v): ?>
|
<?php foreach ($attr as $k => $v): ?>
|
||||||
<?php if (in_array($v, array('placeholder', 'title'), true)): ?>
|
<?php if (in_array($k, array('placeholder', 'title'), true)): ?>
|
||||||
<?php printf('%s="%s" ', $view->escape($k), $view->escape($view['translator']->trans($v, array(), $translation_domain))) ?>
|
<?php printf('%s="%s" ', $view->escape($k), $view->escape($view['translator']->trans($v, array(), $translation_domain))) ?>
|
||||||
<?php elseif ($v === true): ?>
|
<?php elseif ($v === true): ?>
|
||||||
<?php printf('%s="%s" ', $view->escape($k), $view->escape($k)) ?>
|
<?php printf('%s="%s" ', $view->escape($k), $view->escape($k)) ?>
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
"symfony/http-foundation": "~2.4.9|~2.5,>=2.5.4",
|
"symfony/http-foundation": "~2.4.9|~2.5,>=2.5.4",
|
||||||
"symfony/http-kernel": "~2.6",
|
"symfony/http-kernel": "~2.6",
|
||||||
"symfony/filesystem": "~2.3",
|
"symfony/filesystem": "~2.3",
|
||||||
"symfony/routing": "~2.2",
|
"symfony/routing": "~2.3",
|
||||||
"symfony/security-core": "~2.6",
|
"symfony/security-core": "~2.6",
|
||||||
"symfony/security-csrf": "~2.6",
|
"symfony/security-csrf": "~2.6",
|
||||||
"symfony/stopwatch": "~2.3",
|
"symfony/stopwatch": "~2.3",
|
||||||
|
@ -19,5 +19,5 @@ provided by the HttpKernel component.
|
|||||||
You can run the unit tests with the following command:
|
You can run the unit tests with the following command:
|
||||||
|
|
||||||
$ cd path/to/Symfony/Component/BrowserKit/
|
$ cd path/to/Symfony/Component/BrowserKit/
|
||||||
$ composer.phar install
|
$ composer install
|
||||||
$ phpunit
|
$ phpunit
|
||||||
|
@ -81,5 +81,5 @@ Resources
|
|||||||
You can run the unit tests with the following command:
|
You can run the unit tests with the following command:
|
||||||
|
|
||||||
$ cd path/to/Symfony/Component/ClassLoader/
|
$ cd path/to/Symfony/Component/ClassLoader/
|
||||||
$ composer.phar install
|
$ composer install
|
||||||
$ phpunit
|
$ phpunit
|
||||||
|
@ -12,6 +12,6 @@ Resources
|
|||||||
You can run the unit tests with the following command:
|
You can run the unit tests with the following command:
|
||||||
|
|
||||||
$ cd path/to/Symfony/Component/Config/
|
$ cd path/to/Symfony/Component/Config/
|
||||||
$ composer.phar install
|
$ composer install
|
||||||
$ phpunit
|
$ phpunit
|
||||||
|
|
||||||
|
@ -150,6 +150,10 @@ class OutputFormatter implements OutputFormatterInterface
|
|||||||
$pos = $match[1];
|
$pos = $match[1];
|
||||||
$text = $match[0];
|
$text = $match[0];
|
||||||
|
|
||||||
|
if (0 != $pos && '\\' == $message[$pos - 1]) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// add the text up to the next tag
|
// add the text up to the next tag
|
||||||
$output .= $this->applyCurrentStyle(substr($message, $offset, $pos - $offset));
|
$output .= $this->applyCurrentStyle(substr($message, $offset, $pos - $offset));
|
||||||
$offset = $pos + strlen($text);
|
$offset = $pos + strlen($text);
|
||||||
@ -164,9 +168,6 @@ class OutputFormatter implements OutputFormatterInterface
|
|||||||
if (!$open && !$tag) {
|
if (!$open && !$tag) {
|
||||||
// </>
|
// </>
|
||||||
$this->styleStack->pop();
|
$this->styleStack->pop();
|
||||||
} elseif ($pos && '\\' == $message[$pos - 1]) {
|
|
||||||
// escaped tag
|
|
||||||
$output .= $this->applyCurrentStyle($text);
|
|
||||||
} elseif (false === $style = $this->createStyleFromString(strtolower($tag))) {
|
} elseif (false === $style = $this->createStyleFromString(strtolower($tag))) {
|
||||||
$output .= $this->applyCurrentStyle($text);
|
$output .= $this->applyCurrentStyle($text);
|
||||||
} elseif ($open) {
|
} elseif ($open) {
|
||||||
|
@ -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
|
* @param string $string The string to check its length
|
||||||
*
|
*
|
||||||
|
@ -307,8 +307,8 @@ class Table
|
|||||||
$width = $this->getColumnWidth($column);
|
$width = $this->getColumnWidth($column);
|
||||||
|
|
||||||
// str_pad won't work properly with multi-byte strings, we need to fix the padding
|
// 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)) {
|
if (function_exists('mb_strwidth') && false !== $encoding = mb_detect_encoding($cell)) {
|
||||||
$width += strlen($cell) - mb_strlen($cell, $encoding);
|
$width += strlen($cell) - mb_strwidth($cell, $encoding);
|
||||||
}
|
}
|
||||||
|
|
||||||
$width += Helper::strlen($cell) - Helper::strlenWithoutDecoration($this->output->getFormatter(), $cell);
|
$width += Helper::strlen($cell) - Helper::strlenWithoutDecoration($this->output->getFormatter(), $cell);
|
||||||
|
@ -50,7 +50,7 @@ Tests
|
|||||||
You can run the unit tests with the following command:
|
You can run the unit tests with the following command:
|
||||||
|
|
||||||
$ cd path/to/Symfony/Component/Console/
|
$ cd path/to/Symfony/Component/Console/
|
||||||
$ composer.phar install
|
$ composer install
|
||||||
$ phpunit
|
$ phpunit
|
||||||
|
|
||||||
Third Party
|
Third Party
|
||||||
|
@ -101,6 +101,11 @@ class OutputFormatterTest extends \PHPUnit_Framework_TestCase
|
|||||||
"(\033[32mz>=2.0,<a2.3\033[39m)",
|
"(\033[32mz>=2.0,<a2.3\033[39m)",
|
||||||
$formatter->format('(<info>'.$formatter->escape('z>=2.0,<a2.3').'</info>)')
|
$formatter->format('(<info>'.$formatter->escape('z>=2.0,<a2.3').'</info>)')
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$this->assertEquals(
|
||||||
|
"\033[32m<error>some error</error>\033[0m",
|
||||||
|
$formatter->format('<info>'.$formatter->escape('<error>some error</error>').'</info>')
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testDeepNestedStyles()
|
public function testDeepNestedStyles()
|
||||||
|
@ -256,7 +256,7 @@ TABLE
|
|||||||
|
|
||||||
public function testRenderMultiByte()
|
public function testRenderMultiByte()
|
||||||
{
|
{
|
||||||
if (!function_exists('mb_strlen')) {
|
if (!function_exists('mb_strwidth')) {
|
||||||
$this->markTestSkipped('The "mbstring" extension is not available');
|
$this->markTestSkipped('The "mbstring" extension is not available');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -276,6 +276,33 @@ TABLE
|
|||||||
| 1234 |
|
| 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 =
|
||||||
|
<<<TABLE
|
||||||
|
+------------+
|
||||||
|
| あいうえお |
|
||||||
|
+------------+
|
||||||
|
| 1234567890 |
|
||||||
|
+------------+
|
||||||
|
|
||||||
TABLE;
|
TABLE;
|
||||||
|
|
||||||
$this->assertEquals($expected, $this->getOutputContent($output));
|
$this->assertEquals($expected, $this->getOutputContent($output));
|
||||||
|
@ -43,5 +43,5 @@ which is distributed under the BSD license.
|
|||||||
You can run the unit tests with the following command:
|
You can run the unit tests with the following command:
|
||||||
|
|
||||||
$ cd path/to/Symfony/Component/CssSelector/
|
$ cd path/to/Symfony/Component/CssSelector/
|
||||||
$ composer.phar install
|
$ composer install
|
||||||
$ phpunit
|
$ phpunit
|
||||||
|
@ -39,5 +39,5 @@ Resources
|
|||||||
You can run the unit tests with the following command:
|
You can run the unit tests with the following command:
|
||||||
|
|
||||||
$ cd path/to/Symfony/Component/Debug/
|
$ cd path/to/Symfony/Component/Debug/
|
||||||
$ composer.phar install --dev
|
$ composer install
|
||||||
$ phpunit
|
$ phpunit
|
||||||
|
@ -76,5 +76,5 @@ Resources
|
|||||||
You can run the unit tests with the following command:
|
You can run the unit tests with the following command:
|
||||||
|
|
||||||
$ cd path/to/Symfony/Component/DependencyInjection/
|
$ cd path/to/Symfony/Component/DependencyInjection/
|
||||||
$ composer.phar install
|
$ composer install
|
||||||
$ phpunit
|
$ phpunit
|
||||||
|
@ -32,5 +32,5 @@ Resources
|
|||||||
You can run the unit tests with the following command:
|
You can run the unit tests with the following command:
|
||||||
|
|
||||||
$ cd path/to/Symfony/Component/DomCrawler/
|
$ cd path/to/Symfony/Component/DomCrawler/
|
||||||
$ composer.phar install
|
$ composer install
|
||||||
$ phpunit
|
$ phpunit
|
||||||
|
@ -23,5 +23,5 @@ Resources
|
|||||||
You can run the unit tests with the following command:
|
You can run the unit tests with the following command:
|
||||||
|
|
||||||
$ cd path/to/Symfony/Component/EventDispatcher/
|
$ cd path/to/Symfony/Component/EventDispatcher/
|
||||||
$ composer.phar install
|
$ composer install
|
||||||
$ phpunit
|
$ phpunit
|
||||||
|
@ -43,5 +43,5 @@ Resources
|
|||||||
You can run the unit tests with the following command:
|
You can run the unit tests with the following command:
|
||||||
|
|
||||||
$ cd path/to/Symfony/Component/Filesystem/
|
$ cd path/to/Symfony/Component/Filesystem/
|
||||||
$ composer.phar install
|
$ composer install
|
||||||
$ phpunit
|
$ phpunit
|
||||||
|
@ -45,7 +45,7 @@ Resources
|
|||||||
You can run the unit tests with the following command:
|
You can run the unit tests with the following command:
|
||||||
|
|
||||||
$ cd path/to/Symfony/Component/Finder/
|
$ cd path/to/Symfony/Component/Finder/
|
||||||
$ composer.phar install
|
$ composer install
|
||||||
$ phpunit
|
$ phpunit
|
||||||
|
|
||||||
[1]: http://api.symfony.com/2.5/Symfony/Component/Finder/SplFileInfo.html
|
[1]: http://api.symfony.com/2.5/Symfony/Component/Finder/SplFileInfo.html
|
||||||
|
@ -11,6 +11,12 @@
|
|||||||
namespace Symfony\Component\Form;
|
namespace Symfony\Component\Form;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* 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 <bschussek@gmail.com>
|
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||||
*/
|
*/
|
||||||
final class FormEvents
|
final class FormEvents
|
||||||
|
@ -22,5 +22,5 @@ Resources
|
|||||||
You can run the unit tests with the following command:
|
You can run the unit tests with the following command:
|
||||||
|
|
||||||
$ cd path/to/Symfony/Component/Form/
|
$ cd path/to/Symfony/Component/Form/
|
||||||
$ composer.phar install
|
$ composer install
|
||||||
$ phpunit
|
$ phpunit
|
||||||
|
@ -2107,4 +2107,18 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
|
|||||||
// no foo
|
// no foo
|
||||||
$this->assertNotContains('foo="', $html);
|
$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]"]');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -52,5 +52,5 @@ Resources
|
|||||||
You can run the unit tests with the following command:
|
You can run the unit tests with the following command:
|
||||||
|
|
||||||
$ cd path/to/Symfony/Component/HttpFoundation/
|
$ cd path/to/Symfony/Component/HttpFoundation/
|
||||||
$ composer.phar install
|
$ composer install
|
||||||
$ phpunit
|
$ phpunit
|
||||||
|
@ -91,7 +91,7 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter
|
|||||||
$this->data = array(
|
$this->data = array(
|
||||||
'format' => $request->getRequestFormat(),
|
'format' => $request->getRequestFormat(),
|
||||||
'content' => $content,
|
'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_text' => isset(Response::$statusTexts[$statusCode]) ? Response::$statusTexts[$statusCode] : '',
|
||||||
'status_code' => $statusCode,
|
'status_code' => $statusCode,
|
||||||
'request_query' => $request->query->all(),
|
'request_query' => $request->query->all(),
|
||||||
|
@ -95,5 +95,5 @@ Resources
|
|||||||
You can run the unit tests with the following command:
|
You can run the unit tests with the following command:
|
||||||
|
|
||||||
$ cd path/to/Symfony/Component/HttpKernel/
|
$ cd path/to/Symfony/Component/HttpKernel/
|
||||||
$ composer.phar install
|
$ composer install
|
||||||
$ phpunit
|
$ phpunit
|
||||||
|
@ -10,7 +10,7 @@ Preparation
|
|||||||
To prepare, you need to install the development dependencies of the component.
|
To prepare, you need to install the development dependencies of the component.
|
||||||
|
|
||||||
$ cd /path/to/Symfony/Component/Intl
|
$ cd /path/to/Symfony/Component/Intl
|
||||||
$ composer.phar install --dev
|
$ composer install
|
||||||
|
|
||||||
Determining your ICU version
|
Determining your ICU version
|
||||||
---------------------------
|
---------------------------
|
||||||
|
@ -18,7 +18,7 @@ Resources
|
|||||||
You can run the unit tests with the following command:
|
You can run the unit tests with the following command:
|
||||||
|
|
||||||
$ cd path/to/Symfony/Component/Intl/
|
$ cd path/to/Symfony/Component/Intl/
|
||||||
$ composer.phar install --dev
|
$ composer install
|
||||||
$ phpunit
|
$ phpunit
|
||||||
|
|
||||||
[0]: http://www.php.net/manual/en/intl.setup.php
|
[0]: http://www.php.net/manual/en/intl.setup.php
|
||||||
|
@ -50,7 +50,7 @@ the subdirectories bin/ and lib/.
|
|||||||
For running this script, the intl extension must be loaded and all vendors
|
For running this script, the intl extension must be loaded and all vendors
|
||||||
must have been installed through composer:
|
must have been installed through composer:
|
||||||
|
|
||||||
composer install --dev
|
composer install
|
||||||
|
|
||||||
MESSAGE
|
MESSAGE
|
||||||
);
|
);
|
||||||
|
@ -14,7 +14,7 @@ Resources
|
|||||||
You can run the unit tests with the following command:
|
You can run the unit tests with the following command:
|
||||||
|
|
||||||
$ cd path/to/Symfony/Component/OptionsResolver/
|
$ cd path/to/Symfony/Component/OptionsResolver/
|
||||||
$ composer.phar install
|
$ composer install
|
||||||
$ phpunit
|
$ phpunit
|
||||||
|
|
||||||
[1]: http://symfony.com/doc/current/components/options_resolver.html
|
[1]: http://symfony.com/doc/current/components/options_resolver.html
|
||||||
|
@ -47,5 +47,5 @@ Resources
|
|||||||
You can run the unit tests with the following command:
|
You can run the unit tests with the following command:
|
||||||
|
|
||||||
$ cd path/to/Symfony/Component/Process/
|
$ cd path/to/Symfony/Component/Process/
|
||||||
$ composer.phar install
|
$ composer install
|
||||||
$ phpunit
|
$ phpunit
|
||||||
|
@ -10,5 +10,5 @@ Resources
|
|||||||
You can run the unit tests with the following command:
|
You can run the unit tests with the following command:
|
||||||
|
|
||||||
$ cd path/to/Symfony/Component/PropertyAccess/
|
$ cd path/to/Symfony/Component/PropertyAccess/
|
||||||
$ composer.phar install
|
$ composer install
|
||||||
$ phpunit
|
$ phpunit
|
||||||
|
@ -32,5 +32,5 @@ Resources
|
|||||||
You can run the unit tests with the following command:
|
You can run the unit tests with the following command:
|
||||||
|
|
||||||
$ cd path/to/Symfony/Component/Routing/
|
$ cd path/to/Symfony/Component/Routing/
|
||||||
$ composer.phar install
|
$ composer install
|
||||||
$ phpunit
|
$ phpunit
|
||||||
|
@ -113,6 +113,9 @@ class ContextListener implements ListenerInterface
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->dispatcher->removeListener(KernelEvents::RESPONSE, array($this, 'onKernelResponse'));
|
||||||
|
$this->registered = false;
|
||||||
|
|
||||||
if (null !== $this->logger) {
|
if (null !== $this->logger) {
|
||||||
$this->logger->debug('Write SecurityContext in the session');
|
$this->logger->debug('Write SecurityContext in the session');
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,7 @@ use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage;
|
|||||||
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
|
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
|
||||||
use Symfony\Component\Security\Core\SecurityContext;
|
use Symfony\Component\Security\Core\SecurityContext;
|
||||||
use Symfony\Component\Security\Http\Firewall\ContextListener;
|
use Symfony\Component\Security\Http\Firewall\ContextListener;
|
||||||
|
use Symfony\Component\EventDispatcher\EventDispatcher;
|
||||||
|
|
||||||
class ContextListenerTest extends \PHPUnit_Framework_TestCase
|
class ContextListenerTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
@ -112,7 +113,7 @@ class ContextListenerTest extends \PHPUnit_Framework_TestCase
|
|||||||
new Response()
|
new Response()
|
||||||
);
|
);
|
||||||
|
|
||||||
$listener = new ContextListener($this->securityContext, array(), 'session');
|
$listener = new ContextListener($this->securityContext, array(), 'session', null, new EventDispatcher());
|
||||||
$listener->onKernelResponse($event);
|
$listener->onKernelResponse($event);
|
||||||
|
|
||||||
$this->assertTrue($session->isStarted());
|
$this->assertTrue($session->isStarted());
|
||||||
@ -131,7 +132,7 @@ class ContextListenerTest extends \PHPUnit_Framework_TestCase
|
|||||||
new Response()
|
new Response()
|
||||||
);
|
);
|
||||||
|
|
||||||
$listener = new ContextListener($this->securityContext, array(), 'session');
|
$listener = new ContextListener($this->securityContext, array(), 'session', null, new EventDispatcher());
|
||||||
$listener->onKernelResponse($event);
|
$listener->onKernelResponse($event);
|
||||||
|
|
||||||
$this->assertFalse($session->isStarted());
|
$this->assertFalse($session->isStarted());
|
||||||
@ -203,6 +204,35 @@ class ContextListenerTest extends \PHPUnit_Framework_TestCase
|
|||||||
$listener->handle($event);
|
$listener->handle($event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testOnKernelResponseListenerRemovesItself()
|
||||||
|
{
|
||||||
|
$context = $this->getMock('Symfony\Component\Security\Core\SecurityContextInterface');
|
||||||
|
$dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
|
||||||
|
$event = $this->getMockBuilder('Symfony\Component\HttpKernel\Event\FilterResponseEvent')
|
||||||
|
->disableOriginalConstructor()
|
||||||
|
->getMock();
|
||||||
|
|
||||||
|
$listener = new ContextListener($context, 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('getRequestType')
|
||||||
|
->will($this->returnValue(HttpKernelInterface::MASTER_REQUEST));
|
||||||
|
$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()
|
public function testHandleRemovesTokenIfNoPreviousSessionWasFound()
|
||||||
{
|
{
|
||||||
$request = $this->getMock('Symfony\Component\HttpFoundation\Request');
|
$request = $this->getMock('Symfony\Component\HttpFoundation\Request');
|
||||||
@ -241,7 +271,7 @@ class ContextListenerTest extends \PHPUnit_Framework_TestCase
|
|||||||
new Response()
|
new Response()
|
||||||
);
|
);
|
||||||
|
|
||||||
$listener = new ContextListener($this->securityContext, array(), 'session');
|
$listener = new ContextListener($this->securityContext, array(), 'session', null, new EventDispatcher());
|
||||||
$listener->onKernelResponse($event);
|
$listener->onKernelResponse($event);
|
||||||
|
|
||||||
return $session;
|
return $session;
|
||||||
|
@ -19,5 +19,5 @@ Tests
|
|||||||
You can run the unit tests with the following command:
|
You can run the unit tests with the following command:
|
||||||
|
|
||||||
$ cd path/to/Symfony/Component/Security/
|
$ cd path/to/Symfony/Component/Security/
|
||||||
$ composer.phar install
|
$ composer install
|
||||||
$ phpunit
|
$ phpunit
|
||||||
|
@ -11,5 +11,5 @@ Resources
|
|||||||
You can run the unit tests with the following command:
|
You can run the unit tests with the following command:
|
||||||
|
|
||||||
$ cd path/to/Symfony/Component/Serializer/
|
$ cd path/to/Symfony/Component/Serializer/
|
||||||
$ composer.phar install
|
$ composer install
|
||||||
$ phpunit
|
$ phpunit
|
||||||
|
@ -9,5 +9,5 @@ Resources
|
|||||||
You can run the unit tests with the following command:
|
You can run the unit tests with the following command:
|
||||||
|
|
||||||
$ cd path/to/Symfony/Component/Stopwatch/
|
$ cd path/to/Symfony/Component/Stopwatch/
|
||||||
$ composer.phar install
|
$ composer install
|
||||||
$ phpunit
|
$ phpunit
|
||||||
|
@ -14,5 +14,5 @@ Resources
|
|||||||
You can run the unit tests with the following command:
|
You can run the unit tests with the following command:
|
||||||
|
|
||||||
$ cd path/to/Symfony/Component/Templating/
|
$ cd path/to/Symfony/Component/Templating/
|
||||||
$ composer.phar install
|
$ composer install
|
||||||
$ phpunit
|
$ phpunit
|
||||||
|
@ -33,5 +33,5 @@ http://symfony.com/doc/2.6/book/translation.html
|
|||||||
You can run the unit tests with the following command:
|
You can run the unit tests with the following command:
|
||||||
|
|
||||||
$ cd path/to/Symfony/Component/Translation/
|
$ cd path/to/Symfony/Component/Translation/
|
||||||
$ composer.phar install
|
$ composer install
|
||||||
$ phpunit
|
$ phpunit
|
||||||
|
@ -122,5 +122,5 @@ http://jcp.org/en/jsr/detail?id=303
|
|||||||
You can run the unit tests with the following command:
|
You can run the unit tests with the following command:
|
||||||
|
|
||||||
$ cd path/to/Symfony/Component/Validator/
|
$ cd path/to/Symfony/Component/Validator/
|
||||||
$ composer.phar install
|
$ composer install
|
||||||
$ phpunit
|
$ phpunit
|
||||||
|
@ -52,13 +52,13 @@ class Parser
|
|||||||
*/
|
*/
|
||||||
public function parse($value, $exceptionOnInvalidType = false, $objectSupport = false, $objectForMap = false)
|
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)) {
|
if (!preg_match('//u', $value)) {
|
||||||
throw new ParseException('The YAML value does not appear to be valid UTF-8.');
|
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) {
|
if (function_exists('mb_internal_encoding') && ((int) ini_get('mbstring.func_overload')) & 2) {
|
||||||
$mbEncoding = mb_internal_encoding();
|
$mbEncoding = mb_internal_encoding();
|
||||||
@ -233,9 +233,8 @@ class Parser
|
|||||||
throw new ParseException('Multiple documents are not supported.');
|
throw new ParseException('Multiple documents are not supported.');
|
||||||
}
|
}
|
||||||
|
|
||||||
// 1-liner optionally followed by newline
|
// 1-liner optionally followed by newline(s)
|
||||||
$lineCount = count($this->lines);
|
if ($this->lines[0] === trim($value)) {
|
||||||
if (1 === $lineCount || (2 === $lineCount && empty($this->lines[1]))) {
|
|
||||||
try {
|
try {
|
||||||
$value = Inline::parse($this->lines[0], $exceptionOnInvalidType, $objectSupport, $objectForMap, $this->refs);
|
$value = Inline::parse($this->lines[0], $exceptionOnInvalidType, $objectSupport, $objectForMap, $this->refs);
|
||||||
} catch (ParseException $e) {
|
} catch (ParseException $e) {
|
||||||
|
@ -17,5 +17,5 @@ Resources
|
|||||||
You can run the unit tests with the following command:
|
You can run the unit tests with the following command:
|
||||||
|
|
||||||
$ cd path/to/Symfony/Component/Yaml/
|
$ cd path/to/Symfony/Component/Yaml/
|
||||||
$ composer.phar install
|
$ composer install
|
||||||
$ phpunit
|
$ phpunit
|
||||||
|
@ -135,6 +135,14 @@ EOF;
|
|||||||
);
|
);
|
||||||
$tests['Literal block chomping strip with multiple trailing newlines'] = array($expected, $yaml);
|
$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'
|
$yaml = <<<'EOF'
|
||||||
foo: |-
|
foo: |-
|
||||||
one
|
one
|
||||||
|
Reference in New Issue
Block a user