Merge branch '4.2'
* 4.2: [Cache] Only delete one key at a time when on Predis + Cluster [Validator] Add missing translations for Swedish locale [Process] fix using argument $php of new PhpProcess() [Routing] removed a useless var [Routing] Fixed XML options resolution
This commit is contained in:
commit
2ac5f1d08b
|
@ -385,7 +385,7 @@ trait RedisTrait
|
|||
return true;
|
||||
}
|
||||
|
||||
if ($this->redis instanceof \Predis\Client) {
|
||||
if ($this->redis instanceof \Predis\Client && $this->redis->getConnection() instanceof ClusterInterface) {
|
||||
$this->pipeline(function () use ($ids) {
|
||||
foreach ($ids as $id) {
|
||||
yield 'del' => [$id];
|
||||
|
|
|
@ -33,11 +33,10 @@ class PhpProcess extends Process
|
|||
*/
|
||||
public function __construct(string $script, string $cwd = null, array $env = null, int $timeout = 60, array $php = null)
|
||||
{
|
||||
$executableFinder = new PhpExecutableFinder();
|
||||
if (false === $php = $php ?? $executableFinder->find(false)) {
|
||||
$php = null;
|
||||
} else {
|
||||
$php = array_merge([$php], $executableFinder->findArguments());
|
||||
if (null === $php) {
|
||||
$executableFinder = new PhpExecutableFinder();
|
||||
$php = $executableFinder->find(false);
|
||||
$php = false === $php ? null : array_merge([$php], $executableFinder->findArguments());
|
||||
}
|
||||
if ('phpdbg' === \PHP_SAPI) {
|
||||
$file = tempnam(sys_get_temp_dir(), 'dbg');
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
namespace Symfony\Component\Process\Tests;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Process\PhpExecutableFinder;
|
||||
use Symfony\Component\Process\PhpProcess;
|
||||
|
||||
class PhpProcessTest extends TestCase
|
||||
|
@ -45,4 +46,18 @@ PHP
|
|||
|
||||
$this->assertSame(PHP_VERSION.\PHP_SAPI, $process->getOutput());
|
||||
}
|
||||
|
||||
public function testPassingPhpExplicitly()
|
||||
{
|
||||
$finder = new PhpExecutableFinder();
|
||||
$php = array_merge([$finder->find(false)], $finder->findArguments());
|
||||
|
||||
$expected = 'hello world!';
|
||||
$script = <<<PHP
|
||||
<?php echo '$expected';
|
||||
PHP;
|
||||
$process = new PhpProcess($script, null, null, 60, $php);
|
||||
$process->run();
|
||||
$this->assertEquals($expected, $process->getOutput());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ class PhpFileLoader extends FileLoader
|
|||
|
||||
if (\is_object($result) && \is_callable($result)) {
|
||||
$collection = new RouteCollection();
|
||||
$result(new RoutingConfigurator($collection, $this, $path, $file), $this);
|
||||
$result(new RoutingConfigurator($collection, $this, $path, $file));
|
||||
} else {
|
||||
$collection = $result;
|
||||
}
|
||||
|
|
|
@ -268,6 +268,7 @@ class XmlFileLoader extends FileLoader
|
|||
$prefixes = [];
|
||||
$paths = [];
|
||||
|
||||
/** @var \DOMElement $n */
|
||||
foreach ($node->getElementsByTagNameNS(self::NAMESPACE_URI, '*') as $n) {
|
||||
if ($node !== $n->parentNode) {
|
||||
continue;
|
||||
|
@ -292,7 +293,7 @@ class XmlFileLoader extends FileLoader
|
|||
$requirements[$n->getAttribute('key')] = trim($n->textContent);
|
||||
break;
|
||||
case 'option':
|
||||
$options[$n->getAttribute('key')] = trim($n->textContent);
|
||||
$options[$n->getAttribute('key')] = XmlUtils::phpize(trim($n->textContent));
|
||||
break;
|
||||
case 'condition':
|
||||
$condition = trim($n->textContent);
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<routes xmlns="http://symfony.com/schema/routing"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://symfony.com/schema/routing
|
||||
http://symfony.com/schema/routing/routing-1.0.xsd">
|
||||
|
||||
<route id="app_utf8" path="/utf8">
|
||||
<option key="utf8">true</option>
|
||||
</route>
|
||||
<route id="app_no_utf8" path="/no-utf8">
|
||||
<option key="utf8">false</option>
|
||||
</route>
|
||||
</routes>
|
|
@ -83,6 +83,26 @@ class XmlFileLoaderTest extends TestCase
|
|||
}
|
||||
}
|
||||
|
||||
public function testUtf8Route()
|
||||
{
|
||||
$loader = new XmlFileLoader(new FileLocator([__DIR__.'/../Fixtures/localized']));
|
||||
$routeCollection = $loader->load('utf8.xml');
|
||||
$routes = $routeCollection->all();
|
||||
|
||||
$this->assertCount(2, $routes, 'Two routes are loaded');
|
||||
$this->assertContainsOnly('Symfony\Component\Routing\Route', $routes);
|
||||
|
||||
$utf8Route = $routeCollection->get('app_utf8');
|
||||
|
||||
$this->assertSame('/utf8', $utf8Route->getPath());
|
||||
$this->assertTrue($utf8Route->getOption('utf8'), 'Must be utf8');
|
||||
|
||||
$noUtf8Route = $routeCollection->get('app_no_utf8');
|
||||
|
||||
$this->assertSame('/no-utf8', $noUtf8Route->getPath());
|
||||
$this->assertFalse($noUtf8Route->getOption('utf8'), 'Must not be utf8');
|
||||
}
|
||||
|
||||
public function testLoadLocalized()
|
||||
{
|
||||
$loader = new XmlFileLoader(new FileLocator([__DIR__.'/../Fixtures']));
|
||||
|
|
|
@ -318,6 +318,22 @@
|
|||
<source>Error</source>
|
||||
<target>Fel</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="83">
|
||||
<source>This is not a valid UUID.</source>
|
||||
<target>Detta är inte ett giltigt UUID.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="84">
|
||||
<source>This value should be a multiple of {{ compared_value }}.</source>
|
||||
<target>Detta värde ska vara en multipel av {{ compared_value }}.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="85">
|
||||
<source>This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.</source>
|
||||
<target>Denna BIC-koden är inte associerad med IBAN {{ iban }}.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="86">
|
||||
<source>This value should be valid JSON.</source>
|
||||
<target>Detta värde ska vara giltig JSON.</target>
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
||||
|
|
Reference in New Issue