Merge branch '2.6' into 2.7
* 2.6: (21 commits) [FrameworkBundle] Fix title and placeholder rendering in php form templates. [TwigBridge] Removed duplicated code from TwigRenderer [Translator][Logging] implement TranslatorBagInterface. 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. “console help” ignores --raw option Fix form icon position in web profiler [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 ... Conflicts: src/Symfony/Bridge/Twig/composer.json src/Symfony/Bundle/FrameworkBundle/composer.json src/Symfony/Component/Security/Http/Firewall/ContextListener.php src/Symfony/Component/Security/Http/Tests/Firewall/ContextListenerTest.php
This commit is contained in:
commit
1d45ca894b
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 <bschussek@gmail.com>
|
||||
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
],
|
||||
"require": {
|
||||
"php": ">=5.3.9",
|
||||
"symfony/security-csrf": "~2.6|~3.0.0",
|
||||
"twig/twig": "~1.18"
|
||||
},
|
||||
"require-dev": {
|
||||
|
|
|
@ -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']);
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ img {
|
|||
width: 970px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
pre {
|
||||
#content pre {
|
||||
white-space: normal;
|
||||
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 ($required): ?>required="required" <?php endif ?>
|
||||
<?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 elseif ($v === true): ?>
|
||||
<?php printf('%s="%s" ', $view->escape($k), $view->escape($k)) ?>
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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
|
||||
*
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -101,6 +101,11 @@ class OutputFormatterTest extends \PHPUnit_Framework_TestCase
|
|||
"(\033[32mz>=2.0,<a2.3\033[39m)",
|
||||
$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()
|
||||
|
|
|
@ -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 =
|
||||
<<<TABLE
|
||||
+------------+
|
||||
| あいうえお |
|
||||
+------------+
|
||||
| 1234567890 |
|
||||
+------------+
|
||||
|
||||
TABLE;
|
||||
|
||||
$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:
|
||||
|
||||
$ cd path/to/Symfony/Component/CssSelector/
|
||||
$ composer.phar install
|
||||
$ composer install
|
||||
$ phpunit
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 <bschussek@gmail.com>
|
||||
*/
|
||||
final class FormEvents
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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]"]');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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(),
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
---------------------------
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -16,7 +16,7 @@ use Psr\Log\LoggerInterface;
|
|||
/**
|
||||
* @author Abdellatif Ait boudad <a.aitboudad@gmail.com>
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Reference in New Issue