Merge branch '2.4' into 2.5
* 2.4: Update validators.eu.xlf fixed CS remove unused imports [Routing] simplify the XML schema file Unify null comparisons [EventDispatcher] don't count empty listeners [Process] Fix unit tests in sigchild environment [Process] fix signal handling in wait() [BrowserKit] refactor code and fix unquoted regex Fixed server HTTP_HOST port uri conversion [MonologBridge] fixed Console handler priorities Bring code into standard [Process] Add test to verify fix for issue #11421 [Process] Fixes issue #11421 [DependencyInjection] Pass a Scope instance instead of a scope name. Conflicts: src/Symfony/Bundle/FrameworkBundle/Test/WebTestCase.php src/Symfony/Component/DependencyInjection/Tests/Dumper/GraphvizDumperTest.php src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorCollectionTest.php
This commit is contained in:
commit
7e175ef8f3
@ -49,7 +49,7 @@ class ContainerAwareEventManager extends EventManager
|
|||||||
public function dispatchEvent($eventName, EventArgs $eventArgs = null)
|
public function dispatchEvent($eventName, EventArgs $eventArgs = null)
|
||||||
{
|
{
|
||||||
if (isset($this->listeners[$eventName])) {
|
if (isset($this->listeners[$eventName])) {
|
||||||
$eventArgs = $eventArgs === null ? EventArgs::getEmptyInstance() : $eventArgs;
|
$eventArgs = null === $eventArgs ? EventArgs::getEmptyInstance() : $eventArgs;
|
||||||
|
|
||||||
$initialized = isset($this->initialized[$eventName]);
|
$initialized = isset($this->initialized[$eventName]);
|
||||||
|
|
||||||
|
@ -139,8 +139,8 @@ class ConsoleHandler extends AbstractProcessingHandler implements EventSubscribe
|
|||||||
public static function getSubscribedEvents()
|
public static function getSubscribedEvents()
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
ConsoleEvents::COMMAND => 'onCommand',
|
ConsoleEvents::COMMAND => array('onCommand', 255),
|
||||||
ConsoleEvents::TERMINATE => 'onTerminate'
|
ConsoleEvents::TERMINATE => array('onTerminate', -255),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,7 +13,13 @@ namespace Symfony\Bridge\Monolog\Tests\Handler;
|
|||||||
|
|
||||||
use Monolog\Logger;
|
use Monolog\Logger;
|
||||||
use Symfony\Bridge\Monolog\Handler\ConsoleHandler;
|
use Symfony\Bridge\Monolog\Handler\ConsoleHandler;
|
||||||
|
use Symfony\Component\Console\ConsoleEvents;
|
||||||
|
use Symfony\Component\Console\Event\ConsoleCommandEvent;
|
||||||
|
use Symfony\Component\Console\Event\ConsoleTerminateEvent;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
|
use Symfony\Component\Console\Output\BufferedOutput;
|
||||||
|
use Symfony\Component\EventDispatcher\EventDispatcher;
|
||||||
|
use Symfony\Component\Console\Command\Command;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests the ConsoleHandler and also the ConsoleFormatter.
|
* Tests the ConsoleHandler and also the ConsoleFormatter.
|
||||||
@ -156,4 +162,42 @@ class ConsoleHandlerTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
$this->assertTrue($handler->handle($errorRecord), 'The handler finished handling the log as bubble is false.');
|
$this->assertTrue($handler->handle($errorRecord), 'The handler finished handling the log as bubble is false.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testLogsFromListeners()
|
||||||
|
{
|
||||||
|
$output = new BufferedOutput();
|
||||||
|
$output->setVerbosity(OutputInterface::VERBOSITY_DEBUG);
|
||||||
|
|
||||||
|
$handler = new ConsoleHandler(null, false);
|
||||||
|
|
||||||
|
$logger = new Logger('app');
|
||||||
|
$logger->pushHandler($handler);
|
||||||
|
|
||||||
|
$dispatcher = new EventDispatcher();
|
||||||
|
$dispatcher->addListener(ConsoleEvents::COMMAND, function () use ($logger) {
|
||||||
|
$logger->addInfo('Before command message.');
|
||||||
|
});
|
||||||
|
$dispatcher->addListener(ConsoleEvents::TERMINATE, function () use ($logger) {
|
||||||
|
$logger->addInfo('Before terminate message.');
|
||||||
|
});
|
||||||
|
|
||||||
|
$dispatcher->addSubscriber($handler);
|
||||||
|
|
||||||
|
$dispatcher->addListener(ConsoleEvents::COMMAND, function () use ($logger) {
|
||||||
|
$logger->addInfo('After command message.');
|
||||||
|
});
|
||||||
|
$dispatcher->addListener(ConsoleEvents::TERMINATE, function () use ($logger) {
|
||||||
|
$logger->addInfo('After terminate message.');
|
||||||
|
});
|
||||||
|
|
||||||
|
$event = new ConsoleCommandEvent(new Command('foo'), $this->getMock('Symfony\Component\Console\Input\InputInterface'), $output);
|
||||||
|
$dispatcher->dispatch(ConsoleEvents::COMMAND, $event);
|
||||||
|
$this->assertContains('Before command message.', $out = $output->fetch());
|
||||||
|
$this->assertContains('After command message.', $out);
|
||||||
|
|
||||||
|
$event = new ConsoleTerminateEvent(new Command('foo'), $this->getMock('Symfony\Component\Console\Input\InputInterface'), $output, 0);
|
||||||
|
$dispatcher->dispatch(ConsoleEvents::TERMINATE, $event);
|
||||||
|
$this->assertContains('Before terminate message.', $out = $output->fetch());
|
||||||
|
$this->assertContains('After terminate message.', $out);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ class Configuration implements ConfigurationInterface
|
|||||||
->end()
|
->end()
|
||||||
->arrayNode('trusted_proxies')
|
->arrayNode('trusted_proxies')
|
||||||
->beforeNormalization()
|
->beforeNormalization()
|
||||||
->ifTrue(function ($v) { return !is_array($v) && !is_null($v); })
|
->ifTrue(function ($v) { return !is_array($v) && null !== $v; })
|
||||||
->then(function ($v) { return is_bool($v) ? array() : preg_split('/\s*,\s*/', $v); })
|
->then(function ($v) { return is_bool($v) ? array() : preg_split('/\s*,\s*/', $v); })
|
||||||
->end()
|
->end()
|
||||||
->prototype('scalar')
|
->prototype('scalar')
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<select
|
<select
|
||||||
<?php if ($required && $empty_value === null && $empty_value_in_choices === false && $multiple === false):
|
<?php if ($required && null === $empty_value && $empty_value_in_choices === false && $multiple === false):
|
||||||
$required = false;
|
$required = false;
|
||||||
endif; ?>
|
endif; ?>
|
||||||
<?php echo $view['form']->block($form, 'widget_attributes', array(
|
<?php echo $view['form']->block($form, 'widget_attributes', array(
|
||||||
|
@ -45,14 +45,14 @@ abstract class KernelTestCase extends \PHPUnit_Framework_TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
$dir = static::getPhpUnitCliConfigArgument();
|
$dir = static::getPhpUnitCliConfigArgument();
|
||||||
if ($dir === null &&
|
if (null === $dir &&
|
||||||
(is_file(getcwd().DIRECTORY_SEPARATOR.'phpunit.xml') ||
|
(is_file(getcwd().DIRECTORY_SEPARATOR.'phpunit.xml') ||
|
||||||
is_file(getcwd().DIRECTORY_SEPARATOR.'phpunit.xml.dist'))) {
|
is_file(getcwd().DIRECTORY_SEPARATOR.'phpunit.xml.dist'))) {
|
||||||
$dir = getcwd();
|
$dir = getcwd();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Can't continue
|
// Can't continue
|
||||||
if ($dir === null) {
|
if (null === $dir) {
|
||||||
throw new \RuntimeException('Unable to guess the Kernel directory.');
|
throw new \RuntimeException('Unable to guess the Kernel directory.');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,7 +90,7 @@ abstract class KernelTestCase extends \PHPUnit_Framework_TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Attempts to guess the Kernel location.
|
* Attempts to guess the kernel location.
|
||||||
*
|
*
|
||||||
* When the Kernel is located, the file is required.
|
* When the Kernel is located, the file is required.
|
||||||
*
|
*
|
||||||
@ -117,7 +117,7 @@ abstract class KernelTestCase extends \PHPUnit_Framework_TestCase
|
|||||||
$finder->name('*Kernel.php')->depth(0)->in($dir);
|
$finder->name('*Kernel.php')->depth(0)->in($dir);
|
||||||
$results = iterator_to_array($finder);
|
$results = iterator_to_array($finder);
|
||||||
if (!count($results)) {
|
if (!count($results)) {
|
||||||
throw new \RuntimeException('Either set KERNEL_DIR in your phpunit.xml according to http://symfony.com/doc/current/book/testing.html#your-first-functional-test or override the KernelTestCase::createKernel() method.');
|
throw new \RuntimeException('Either set KERNEL_DIR in your phpunit.xml according to http://symfony.com/doc/current/book/testing.html#your-first-functional-test or override the WebTestCase::createKernel() method.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$file = current($results);
|
$file = current($results);
|
||||||
|
@ -96,7 +96,7 @@ class SerializerPassTest extends \PHPUnit_Framework_TestCase
|
|||||||
'Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\SerializerPass',
|
'Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\SerializerPass',
|
||||||
'findAndSortTaggedServices'
|
'findAndSortTaggedServices'
|
||||||
);
|
);
|
||||||
$method->setAccessible(TRUE);
|
$method->setAccessible(true);
|
||||||
|
|
||||||
$actual = $method->invoke($serializerPass, 'tag', $container);
|
$actual = $method->invoke($serializerPass, 'tag', $container);
|
||||||
|
|
||||||
|
@ -370,7 +370,7 @@
|
|||||||
this.getThreshold = function() {
|
this.getThreshold = function() {
|
||||||
var threshold = Sfjs.getPreference(_storagePrefix + 'threshold');
|
var threshold = Sfjs.getPreference(_storagePrefix + 'threshold');
|
||||||
|
|
||||||
if (threshold === null) {
|
if (null === threshold) {
|
||||||
return _threshold;
|
return _threshold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,20 +68,20 @@
|
|||||||
menu = document.getElementById('navigation'), savedState = Sfjs.getPreference('menu/displayState'),
|
menu = document.getElementById('navigation'), savedState = Sfjs.getPreference('menu/displayState'),
|
||||||
displayState, elem, className;
|
displayState, elem, className;
|
||||||
|
|
||||||
if (savedState == null) {
|
if (null === savedState) {
|
||||||
savedState = 'block';
|
savedState = 'block';
|
||||||
}
|
}
|
||||||
|
|
||||||
displayState = state || (savedState == 'block' ? 'none' : 'block');
|
displayState = state || ('block' === savedState ? 'none' : 'block');
|
||||||
|
|
||||||
if (typeof doSave === 'undefined') {
|
if ('undefined' === typeof doSave) {
|
||||||
doSave = true;
|
doSave = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
document.getElementById('searchBar').style.display = displayState;
|
document.getElementById('searchBar').style.display = displayState;
|
||||||
document.getElementById('adminBar').style.display = displayState;
|
document.getElementById('adminBar').style.display = displayState;
|
||||||
|
|
||||||
if (displayState == 'block') {
|
if ('block' === displayState) {
|
||||||
Sfjs.removeClass(menu, 'collapsed-menu');
|
Sfjs.removeClass(menu, 'collapsed-menu');
|
||||||
Sfjs.removeClass(menu.parentNode.parentNode, 'collapsed-menu-parents');
|
Sfjs.removeClass(menu.parentNode.parentNode, 'collapsed-menu-parents');
|
||||||
|
|
||||||
@ -107,7 +107,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
window.setTimeout(function() {
|
window.setTimeout(function() {
|
||||||
if (document.getElementById('menu-profiler') == null) {
|
if (null === document.getElementById('menu-profiler')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,12 +119,12 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (elem in menuItems) {
|
for (elem in menuItems) {
|
||||||
if (typeof(menuItems[elem].children) != 'undefined' &&
|
if (typeof(menuItems[elem].children) !== 'undefined' &&
|
||||||
menuItems[elem].children.length > 0) {
|
menuItems[elem].children.length > 0) {
|
||||||
child = menuItems[elem].children[0]
|
child = menuItems[elem].children[0]
|
||||||
|
|
||||||
if (child.getAttribute('title') == '' ||
|
if ('' === child.getAttribute('title') ||
|
||||||
child.getAttribute('title') == null) {
|
null === child.getAttribute('title')) {
|
||||||
value = child.text.replace(/^\s+/g, '').split('\n')[0].replace(/\s+$/g, '');
|
value = child.text.replace(/^\s+/g, '').split('\n')[0].replace(/\s+$/g, '');
|
||||||
child.setAttribute('title', value);
|
child.setAttribute('title', value);
|
||||||
}
|
}
|
||||||
|
@ -297,7 +297,7 @@ abstract class Client
|
|||||||
$uri = $this->getAbsoluteUri($uri);
|
$uri = $this->getAbsoluteUri($uri);
|
||||||
|
|
||||||
if (isset($server['HTTP_HOST'])) {
|
if (isset($server['HTTP_HOST'])) {
|
||||||
$uri = preg_replace('{^(https?\://)'.parse_url($uri, PHP_URL_HOST).'}', '${1}'.$server['HTTP_HOST'], $uri);
|
$uri = preg_replace('{^(https?\://)'.preg_quote($this->extractHost($uri)).'}', '${1}'.$server['HTTP_HOST'], $uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($server['HTTPS'])) {
|
if (isset($server['HTTPS'])) {
|
||||||
@ -310,12 +310,7 @@ abstract class Client
|
|||||||
$server['HTTP_REFERER'] = $this->history->current()->getUri();
|
$server['HTTP_REFERER'] = $this->history->current()->getUri();
|
||||||
}
|
}
|
||||||
|
|
||||||
$server['HTTP_HOST'] = parse_url($uri, PHP_URL_HOST);
|
$server['HTTP_HOST'] = $this->extractHost($uri);
|
||||||
|
|
||||||
if ($port = parse_url($uri, PHP_URL_PORT)) {
|
|
||||||
$server['HTTP_HOST'] .= ':'.$port;
|
|
||||||
}
|
|
||||||
|
|
||||||
$server['HTTPS'] = 'https' == parse_url($uri, PHP_URL_SCHEME);
|
$server['HTTPS'] = 'https' == parse_url($uri, PHP_URL_SCHEME);
|
||||||
|
|
||||||
$this->internalRequest = new Request($uri, $method, $parameters, $files, $this->cookieJar->allValues($uri), $server, $content);
|
$this->internalRequest = new Request($uri, $method, $parameters, $files, $this->cookieJar->allValues($uri), $server, $content);
|
||||||
@ -610,4 +605,15 @@ abstract class Client
|
|||||||
|
|
||||||
return $server;
|
return $server;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function extractHost($uri)
|
||||||
|
{
|
||||||
|
$host = parse_url($uri, PHP_URL_HOST);
|
||||||
|
|
||||||
|
if ($port = parse_url($uri, PHP_URL_PORT)) {
|
||||||
|
return $host.':'.$port;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $host;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -210,6 +210,24 @@ class ClientTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->assertEquals('http://www.example.com/foo/bar', $client->getRequest()->getUri(), '->request() uses the previous request for relative URLs');
|
$this->assertEquals('http://www.example.com/foo/bar', $client->getRequest()->getUri(), '->request() uses the previous request for relative URLs');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testRequestURIConversionByServerHost()
|
||||||
|
{
|
||||||
|
$client = new TestClient();
|
||||||
|
|
||||||
|
$server = array('HTTP_HOST' => 'www.exampl+e.com:8000');
|
||||||
|
$parameters = array();
|
||||||
|
$files = array();
|
||||||
|
|
||||||
|
$client->request('GET', 'http://exampl+e.com', $parameters, $files, $server);
|
||||||
|
$this->assertEquals('http://www.exampl+e.com:8000', $client->getRequest()->getUri(), '->request() uses HTTP_HOST to add port');
|
||||||
|
|
||||||
|
$client->request('GET', 'http://exampl+e.com:8888', $parameters, $files, $server);
|
||||||
|
$this->assertEquals('http://www.exampl+e.com:8000', $client->getRequest()->getUri(), '->request() uses HTTP_HOST to modify existing port');
|
||||||
|
|
||||||
|
$client->request('GET', 'http://exampl+e.com:8000', $parameters, $files, $server);
|
||||||
|
$this->assertEquals('http://www.exampl+e.com:8000', $client->getRequest()->getUri(), '->request() uses HTTP_HOST respects correct set port');
|
||||||
|
}
|
||||||
|
|
||||||
public function testRequestReferer()
|
public function testRequestReferer()
|
||||||
{
|
{
|
||||||
$client = new TestClient();
|
$client = new TestClient();
|
||||||
|
@ -182,7 +182,7 @@ class ExprBuilderTest extends \PHPUnit_Framework_TestCase
|
|||||||
->end()
|
->end()
|
||||||
->end()
|
->end()
|
||||||
->buildTree()
|
->buildTree()
|
||||||
->finalize($config === null ? array('key'=>'value') : $config)
|
->finalize(null === $config ? array('key'=>'value') : $config)
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@ use Symfony\Component\DependencyInjection\Parameter;
|
|||||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
|
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
|
||||||
|
use Symfony\Component\DependencyInjection\Scope;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GraphvizDumper dumps a service container as a graphviz file.
|
* GraphvizDumper dumps a service container as a graphviz file.
|
||||||
@ -200,8 +201,8 @@ class GraphvizDumper extends Dumper
|
|||||||
$container->setDefinitions($this->container->getDefinitions());
|
$container->setDefinitions($this->container->getDefinitions());
|
||||||
$container->setAliases($this->container->getAliases());
|
$container->setAliases($this->container->getAliases());
|
||||||
$container->setResources($this->container->getResources());
|
$container->setResources($this->container->getResources());
|
||||||
foreach ($this->container->getScopes() as $scope) {
|
foreach ($this->container->getScopes() as $scope => $parentScope) {
|
||||||
$container->addScope($scope);
|
$container->addScope(new Scope($scope, $parentScope));
|
||||||
}
|
}
|
||||||
foreach ($this->container->getExtensions() as $extension) {
|
foreach ($this->container->getExtensions() as $extension) {
|
||||||
$container->registerExtension($extension);
|
$container->registerExtension($extension);
|
||||||
|
@ -70,4 +70,11 @@ class GraphvizDumperTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
$this->assertEquals(str_replace('%path%', __DIR__, file_get_contents(self::$fixturesPath.'/graphviz/services17.dot')), $dumper->dump(), '->dump() dumps services');
|
$this->assertEquals(str_replace('%path%', __DIR__, file_get_contents(self::$fixturesPath.'/graphviz/services17.dot')), $dumper->dump(), '->dump() dumps services');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testDumpWithScopes()
|
||||||
|
{
|
||||||
|
$container = include self::$fixturesPath.'/containers/container18.php';
|
||||||
|
$dumper = new GraphvizDumper($container);
|
||||||
|
$this->assertEquals(str_replace('%path%', __DIR__, file_get_contents(self::$fixturesPath.'/graphviz/services18.dot')), $dumper->dump(), '->dump() dumps services');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,14 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||||
|
use Symfony\Component\DependencyInjection\Scope;
|
||||||
|
|
||||||
|
$container = new ContainerBuilder();
|
||||||
|
$container->addScope(new Scope('request'));
|
||||||
|
$container->
|
||||||
|
register('foo', 'FooClass')->
|
||||||
|
setScope('request')
|
||||||
|
;
|
||||||
|
$container->compile();
|
||||||
|
|
||||||
|
return $container;
|
@ -0,0 +1,8 @@
|
|||||||
|
digraph sc {
|
||||||
|
ratio="compress"
|
||||||
|
node [fontsize="11" fontname="Arial" shape="record"];
|
||||||
|
edge [fontsize="9" fontname="Arial" color="grey" arrowhead="open" arrowsize="0.5"];
|
||||||
|
|
||||||
|
node_foo [label="foo\nFooClass\n", shape=record, fillcolor="#eeeeee", style="filled"];
|
||||||
|
node_service_container [label="service_container\nSymfony\\Component\\DependencyInjection\\ContainerBuilder\n", shape=record, fillcolor="#9999ff", style="filled"];
|
||||||
|
}
|
@ -74,7 +74,7 @@ class EventDispatcher implements EventDispatcherInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->sorted;
|
return array_filter($this->sorted);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -274,6 +274,28 @@ class EventDispatcherTest extends \PHPUnit_Framework_TestCase
|
|||||||
$dispatcher->removeListener('bug.62976', function () {});
|
$dispatcher->removeListener('bug.62976', function () {});
|
||||||
$this->assertTrue($dispatcher->hasListeners('bug.62976'));
|
$this->assertTrue($dispatcher->hasListeners('bug.62976'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testHasListenersWhenAddedCallbackListenerIsRemoved()
|
||||||
|
{
|
||||||
|
$listener = function () {};
|
||||||
|
$this->dispatcher->addListener('foo', $listener);
|
||||||
|
$this->dispatcher->removeListener('foo', $listener);
|
||||||
|
$this->assertFalse($this->dispatcher->hasListeners());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testGetListenersWhenAddedCallbackListenerIsRemoved()
|
||||||
|
{
|
||||||
|
$listener = function () {};
|
||||||
|
$this->dispatcher->addListener('foo', $listener);
|
||||||
|
$this->dispatcher->removeListener('foo', $listener);
|
||||||
|
$this->assertSame(array(), $this->dispatcher->getListeners());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testHasListenersWithoutEventsReturnsFalseAfterHasListenersWithEventHasBeenCalled()
|
||||||
|
{
|
||||||
|
$this->assertFalse($this->dispatcher->hasListeners('foo'));
|
||||||
|
$this->assertFalse($this->dispatcher->hasListeners());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class CallableClass
|
class CallableClass
|
||||||
|
@ -16,7 +16,6 @@ use Symfony\Component\Finder\Iterator;
|
|||||||
use Symfony\Component\Finder\Shell\Shell;
|
use Symfony\Component\Finder\Shell\Shell;
|
||||||
use Symfony\Component\Finder\Expression\Expression;
|
use Symfony\Component\Finder\Expression\Expression;
|
||||||
use Symfony\Component\Finder\Shell\Command;
|
use Symfony\Component\Finder\Shell\Command;
|
||||||
use Symfony\Component\Finder\Iterator\SortableIterator;
|
|
||||||
use Symfony\Component\Finder\Comparator\NumberComparator;
|
use Symfony\Component\Finder\Comparator\NumberComparator;
|
||||||
use Symfony\Component\Finder\Comparator\DateComparator;
|
use Symfony\Component\Finder\Comparator\DateComparator;
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ class MockSplFileInfo extends \SplFileInfo
|
|||||||
|
|
||||||
public function isFile()
|
public function isFile()
|
||||||
{
|
{
|
||||||
if ($this->type === null) {
|
if (null === $this->type) {
|
||||||
return preg_match('/file/', $this->getFilename());
|
return preg_match('/file/', $this->getFilename());
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ class MockSplFileInfo extends \SplFileInfo
|
|||||||
|
|
||||||
public function isDir()
|
public function isDir()
|
||||||
{
|
{
|
||||||
if ($this->type === null) {
|
if (null === $this->type) {
|
||||||
return preg_match('/directory/', $this->getFilename());
|
return preg_match('/directory/', $this->getFilename());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,7 +68,7 @@ class MockSplFileInfo extends \SplFileInfo
|
|||||||
|
|
||||||
public function isReadable()
|
public function isReadable()
|
||||||
{
|
{
|
||||||
if ($this->mode === null) {
|
if (null === $this->mode) {
|
||||||
return preg_match('/r\+/', $this->getFilename());
|
return preg_match('/r\+/', $this->getFilename());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,7 +13,6 @@ namespace Symfony\Component\Form\Extension\Core\Type;
|
|||||||
|
|
||||||
use Symfony\Component\Form\AbstractType;
|
use Symfony\Component\Form\AbstractType;
|
||||||
use Symfony\Component\Intl\Intl;
|
use Symfony\Component\Intl\Intl;
|
||||||
use Symfony\Component\Locale\Locale;
|
|
||||||
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
|
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
|
||||||
|
|
||||||
class LocaleType extends AbstractType
|
class LocaleType extends AbstractType
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="30">
|
<trans-unit id="30">
|
||||||
<source>The CSRF token is invalid.</source>
|
<source>The CSRF token is invalid.</source>
|
||||||
<target>CSFR tokena ez da egokia.</target>
|
<target>CSRF tokena ez da egokia.</target>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
</body>
|
</body>
|
||||||
</file>
|
</file>
|
||||||
|
@ -32,7 +32,7 @@ class DateTimeToRfc3339TransformerTest extends DateTimeTestCase
|
|||||||
$this->dateTimeWithoutSeconds = null;
|
$this->dateTimeWithoutSeconds = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function assertEquals($expected, $actual, $message = '', $delta = 0, $maxDepth = 10, $canonicalize = FALSE, $ignoreCase = FALSE)
|
public static function assertEquals($expected, $actual, $message = '', $delta = 0, $maxDepth = 10, $canonicalize = false, $ignoreCase = false)
|
||||||
{
|
{
|
||||||
if ($expected instanceof \DateTime && $actual instanceof \DateTime) {
|
if ($expected instanceof \DateTime && $actual instanceof \DateTime) {
|
||||||
$expected = $expected->format('c');
|
$expected = $expected->format('c');
|
||||||
|
@ -126,7 +126,7 @@ class ViolationPathTest extends \PHPUnit_Framework_TestCase
|
|||||||
public function testGetParent($violationPath, $parentPath)
|
public function testGetParent($violationPath, $parentPath)
|
||||||
{
|
{
|
||||||
$path = new ViolationPath($violationPath);
|
$path = new ViolationPath($violationPath);
|
||||||
$parent = $parentPath === null ? null : new ViolationPath($parentPath);
|
$parent = null === $parentPath ? null : new ViolationPath($parentPath);
|
||||||
|
|
||||||
$this->assertEquals($parent, $path->getParent());
|
$this->assertEquals($parent, $path->getParent());
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
|
|
||||||
namespace Symfony\Component\Intl\ResourceBundle;
|
namespace Symfony\Component\Intl\ResourceBundle;
|
||||||
|
|
||||||
use Symfony\Component\Intl\Intl;
|
|
||||||
use Symfony\Component\Intl\ResourceBundle\Reader\StructuredBundleReaderInterface;
|
use Symfony\Component\Intl\ResourceBundle\Reader\StructuredBundleReaderInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
|
|
||||||
use Symfony\Component\Filesystem\Filesystem;
|
use Symfony\Component\Filesystem\Filesystem;
|
||||||
use Symfony\Component\Icu\IcuData;
|
use Symfony\Component\Icu\IcuData;
|
||||||
use Symfony\Component\Intl\Intl;
|
|
||||||
|
|
||||||
require_once __DIR__ . '/common.php';
|
require_once __DIR__ . '/common.php';
|
||||||
require_once __DIR__ . '/autoload.php';
|
require_once __DIR__ . '/autoload.php';
|
||||||
|
@ -59,8 +59,7 @@ class ExecutableFinder
|
|||||||
if (is_dir($path)) {
|
if (is_dir($path)) {
|
||||||
$dirs[] = $path;
|
$dirs[] = $path;
|
||||||
} else {
|
} else {
|
||||||
$file = str_replace(dirname($path), '', $path);
|
if (basename($path) == $name && is_executable($path)) {
|
||||||
if ($file == $name && is_executable($path)) {
|
|
||||||
return $path;
|
return $path;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -70,6 +70,8 @@ class Process
|
|||||||
/** @var ProcessPipes */
|
/** @var ProcessPipes */
|
||||||
private $processPipes;
|
private $processPipes;
|
||||||
|
|
||||||
|
private $latestSignal;
|
||||||
|
|
||||||
private static $sigchild;
|
private static $sigchild;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -355,7 +357,7 @@ class Process
|
|||||||
usleep(1000);
|
usleep(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->processInformation['signaled']) {
|
if ($this->processInformation['signaled'] && $this->processInformation['termsig'] !== $this->latestSignal) {
|
||||||
throw new RuntimeException(sprintf('The process has been signaled with signal "%s".', $this->processInformation['termsig']));
|
throw new RuntimeException(sprintf('The process has been signaled with signal "%s".', $this->processInformation['termsig']));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -782,7 +784,8 @@ class Process
|
|||||||
throw new RuntimeException('Unable to kill the process');
|
throw new RuntimeException('Unable to kill the process');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
proc_terminate($this->process);
|
// given `SIGTERM` may not be defined and that `proc_terminate` uses the constant value and not the constant itself, we use the same here
|
||||||
|
$this->doSignal(15, false);
|
||||||
do {
|
do {
|
||||||
usleep(1000);
|
usleep(1000);
|
||||||
} while ($this->isRunning() && microtime(true) < $timeoutMicro);
|
} while ($this->isRunning() && microtime(true) < $timeoutMicro);
|
||||||
@ -1416,6 +1419,7 @@ class Process
|
|||||||
$this->stdout = null;
|
$this->stdout = null;
|
||||||
$this->stderr = null;
|
$this->stderr = null;
|
||||||
$this->process = null;
|
$this->process = null;
|
||||||
|
$this->latestSignal = null;
|
||||||
$this->status = self::STATUS_READY;
|
$this->status = self::STATUS_READY;
|
||||||
$this->incrementalOutputOffset = 0;
|
$this->incrementalOutputOffset = 0;
|
||||||
$this->incrementalErrorOutputOffset = 0;
|
$this->incrementalErrorOutputOffset = 0;
|
||||||
@ -1459,6 +1463,8 @@ class Process
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->latestSignal = $signal;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,6 +110,27 @@ class ExecutableFinderTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->assertSamePath(PHP_BINARY, $result);
|
$this->assertSamePath(PHP_BINARY, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testFindProcessInOpenBasedir()
|
||||||
|
{
|
||||||
|
if (ini_get('open_basedir')) {
|
||||||
|
$this->markTestSkipped('Cannot test when open_basedir is set');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!defined('PHP_BINARY')) {
|
||||||
|
$this->markTestSkipped('Requires the PHP_BINARY constant');
|
||||||
|
}
|
||||||
|
|
||||||
|
$execPath = __DIR__.'/SignalListener.php';
|
||||||
|
|
||||||
|
$this->setPath('');
|
||||||
|
ini_set('open_basedir', PHP_BINARY.PATH_SEPARATOR.'/');
|
||||||
|
|
||||||
|
$finder = new ExecutableFinder();
|
||||||
|
$result = $finder->find($this->getPhpBinaryName(), false);
|
||||||
|
|
||||||
|
$this->assertSamePath(PHP_BINARY, $result);
|
||||||
|
}
|
||||||
|
|
||||||
private function assertSamePath($expected, $tested)
|
private function assertSamePath($expected, $tested)
|
||||||
{
|
{
|
||||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||||
|
@ -227,6 +227,11 @@ class SigchildDisabledProcessTest extends AbstractProcessTest
|
|||||||
$this->markTestSkipped('Signal is not supported in sigchild environment');
|
$this->markTestSkipped('Signal is not supported in sigchild environment');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testRunProcessWithTimeout()
|
||||||
|
{
|
||||||
|
$this->markTestSkipped('Signal (required for timeout) is not supported in sigchild environment');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
|
@ -120,6 +120,21 @@ class SigchildEnabledProcessTest extends AbstractProcessTest
|
|||||||
parent::testStartAfterATimeout();
|
parent::testStartAfterATimeout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testStopWithTimeoutIsActuallyWorking()
|
||||||
|
{
|
||||||
|
$this->markTestSkipped('Stopping with signal is not supported in sigchild environment');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testRunProcessWithTimeout()
|
||||||
|
{
|
||||||
|
$this->markTestSkipped('Signal (required for timeout) is not supported in sigchild environment');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testCheckTimeoutOnStartedProcess()
|
||||||
|
{
|
||||||
|
$this->markTestSkipped('Signal (required for timeout) is not supported in sigchild environment');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
|
@ -147,6 +147,57 @@ class SimpleProcessTest extends AbstractProcessTest
|
|||||||
parent::testSignalWithWrongNonIntSignal();
|
parent::testSignalWithWrongNonIntSignal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testStopTerminatesProcessCleanly()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$process = $this->getProcess('php -r "echo \'foo\'; sleep(1); echo \'bar\';"');
|
||||||
|
$process->run(function () use ($process) {
|
||||||
|
$process->stop();
|
||||||
|
});
|
||||||
|
} catch (RuntimeException $e) {
|
||||||
|
$this->fail('A call to stop() is not expected to cause wait() to throw a RuntimeException');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testKillSignalTerminatesProcessCleanly()
|
||||||
|
{
|
||||||
|
$this->expectExceptionIfPHPSigchild('Symfony\Component\Process\Exception\RuntimeException', 'This PHP has been compiled with --enable-sigchild. The process can not be signaled.');
|
||||||
|
|
||||||
|
try {
|
||||||
|
$process = $this->getProcess('php -r "echo \'foo\'; sleep(1); echo \'bar\';"');
|
||||||
|
$process->run(function () use ($process) {
|
||||||
|
if ($process->isRunning()) {
|
||||||
|
$process->signal(SIGKILL);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch (RuntimeException $e) {
|
||||||
|
$this->fail('A call to signal() is not expected to cause wait() to throw a RuntimeException');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testTermSignalTerminatesProcessCleanly()
|
||||||
|
{
|
||||||
|
$this->expectExceptionIfPHPSigchild('Symfony\Component\Process\Exception\RuntimeException', 'This PHP has been compiled with --enable-sigchild. The process can not be signaled.');
|
||||||
|
|
||||||
|
try {
|
||||||
|
$process = $this->getProcess('php -r "echo \'foo\'; sleep(1); echo \'bar\';"');
|
||||||
|
$process->run(function () use ($process) {
|
||||||
|
if ($process->isRunning()) {
|
||||||
|
$process->signal(SIGTERM);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch (RuntimeException $e) {
|
||||||
|
$this->fail('A call to signal() is not expected to cause wait() to throw a RuntimeException');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testStopWithTimeoutIsActuallyWorking()
|
||||||
|
{
|
||||||
|
$this->skipIfPHPSigchild();
|
||||||
|
|
||||||
|
parent::testStopWithTimeoutIsActuallyWorking();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
<xsd:element name="default" nillable="true" type="element" />
|
<xsd:element name="default" nillable="true" type="element" />
|
||||||
<xsd:element name="requirement" type="element" />
|
<xsd:element name="requirement" type="element" />
|
||||||
<xsd:element name="option" type="element" />
|
<xsd:element name="option" type="element" />
|
||||||
<xsd:element name="condition" type="condition" />
|
<xsd:element name="condition" type="xsd:string" />
|
||||||
</xsd:choice>
|
</xsd:choice>
|
||||||
</xsd:group>
|
</xsd:group>
|
||||||
|
|
||||||
@ -62,9 +62,4 @@
|
|||||||
</xsd:extension>
|
</xsd:extension>
|
||||||
</xsd:simpleContent>
|
</xsd:simpleContent>
|
||||||
</xsd:complexType>
|
</xsd:complexType>
|
||||||
|
|
||||||
<xsd:simpleType name="condition">
|
|
||||||
<xsd:restriction base="xsd:string">
|
|
||||||
</xsd:restriction>
|
|
||||||
</xsd:simpleType>
|
|
||||||
</xsd:schema>
|
</xsd:schema>
|
||||||
|
@ -303,7 +303,7 @@ abstract class AbstractRememberMeServices implements RememberMeServicesInterface
|
|||||||
|
|
||||||
$parameter = $request->get($this->options['remember_me_parameter'], null, true);
|
$parameter = $request->get($this->options['remember_me_parameter'], null, true);
|
||||||
|
|
||||||
if ($parameter === null && null !== $this->logger) {
|
if (null === $parameter && null !== $this->logger) {
|
||||||
$this->logger->debug(sprintf('Did not send remember-me cookie (remember-me parameter "%s" was not sent).', $this->options['remember_me_parameter']));
|
$this->logger->debug(sprintf('Did not send remember-me cookie (remember-me parameter "%s" was not sent).', $this->options['remember_me_parameter']));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ class PhpFileLoader extends ArrayLoader implements LoaderInterface
|
|||||||
throw new NotFoundResourceException(sprintf('File "%s" not found.', $resource));
|
throw new NotFoundResourceException(sprintf('File "%s" not found.', $resource));
|
||||||
}
|
}
|
||||||
|
|
||||||
$messages = require($resource);
|
$messages = require $resource;
|
||||||
|
|
||||||
$catalogue = parent::load($messages, $locale, $domain);
|
$catalogue = parent::load($messages, $locale, $domain);
|
||||||
$catalogue->addResource(new FileResource($resource));
|
$catalogue->addResource(new FileResource($resource));
|
||||||
|
Reference in New Issue
Block a user