minor #11337 [Process] fix the return types (xabbuh)
This PR was merged into the 2.5 branch. Discussion ---------- [Process] fix the return types | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | Commits -------3466601
fix the return types6a41ca0
minor #11271 [Validator] Added missing Slovak translations (pulzarraider)585a045
Added SK translationsa22858b
Merge branch '2.4' into 2.55b2e34f
Merge branch '2.3' into 2.485af997
bug #11259 [Config] Fixed failed config schema loads due to libxml_disable_entity_loader usage (ccorliss)de2bef5
Fixed failed config schema loads due to libxml_disable_entity_loader usage.8a68e6c
bug #11234 [ClassLoader] fixed PHP warning on PHP 5.3 (fabpot)3b9902a
enabled PHP 5.6 for testscd7fe02
bug #11179 [Process] Fix ExecutableFinder with open basedir (cs278)b8f8c0e
[Process] Fix ExecutableFinder with open basedirfa2d337
bug #11242 [CssSelector] Refactored the CssSelector to remove the circular object graph (stof)994f81f
Refactored the CssSelector to remove the circular object graph1045adf
bug #11219 [DomCrawler] properly handle buttons with single and double quotes insid... (xabbuh)84be8de
minor #11230 Fix mocks to support >=5.5.14 and >=5.4.30 (jpauli)1c5c694
Fix mocks to support >=5.5.14 and >=5.4.307b2e3d9
[ClassLoader] fixed PHP warning on PHP 5.37b0ed91
minor #11225 [Validator] added Lithuanian translation for empty file (Tadcka)a954083
[Validator] added Lithuanian translation for empty file803b06b
bug #11220 [Components][Serializer] optional constructor arguments can be omitted during the denormalization process (xabbuh)05c51f5
minor #11203 Added missing dutch translations (WouterJ)bd9283e
Added missing dutch translations5bb2345
[Components][Serializer] optional constructor arguments can be omitted during the denormalization processcbbdbe4
[DomCrawler] properly handle buttons with single and double quotes inside the name attributef6eb9b6
minor #11201 [Validator] Added missing pt and pt_BR translations (dcsg)71a2b59
Added missing pt and pt_BR translations4450197
Merge branch '2.4' into 2.50067952
minor #11195 [Validator] Add missing ru translations (megazoll)71eb8a8
[Validator] Add missing ru translationsf45f2df
minor #11191 [Tests] fix tests due to recent changes in PHP's behavior (xabbuh)bc8042d
don't disable constructor calls to mockups of classes that extend internal PHP classesf4a3c7a
special handling for the JsonDescriptor to work around changes in PHP's JSON pretty printer76d3c9e
Merge branch '2.4' into 2.5f2bdc22
fixed previous mergeb387477
Merge branch '2.3' into 2.4eeeae94
minor #11187 [Tests] don't disable constructor calls to mockups of classes that extend intern... (xabbuh)ff00dcc
bug #11186 Added missing `break` statement (apfelbox)5af2802
Added missing `break` statement2c726b8
don't disable constructor calls to mockups of classes that extend internal PHP classes96bc061
minor #11182 Small comment update according to PSR-2 (apfelbox)31b1dff
Small comment update according to PSR-2a50aca0
bug #11168 [YAML] fix merge node (<<) (Tobion)cd0309f
minor #11162 [Console] remove weird use statement (cordoval)dee1562
[Yaml] fix overwriting of keys after merged map8c621ab
[Yaml] fix priority of sequence merges according to specbebd18c
bug #11170 [Console] Fixed notice in QuestionHelper (florianv)7d4f4f2
bug #11169 [Console] Fixed notice in DialogHelper (florianv)9fe4b88
[Console] Fixed notice in QuestionHelperff6c65e
[Console] Fixed notice in DialogHelper02614e0
[Yaml] refactoring of merges for performancec117e8e
[Console] remove weird use statementfbf92e5
bug #11144 [HttpFoundation] Fixed Request::getPort returns incorrect value under IPv6 (kicken)bd11e92
minor #11136 [Filesystem] Fix test suite on OSX (romainneutron)2a0e8e3
[HttpFoundation] Fixed Request::getPort returns incorrect value under IPv6e26f08e
[Filesystem] Fix test suite on OSX185aafa
minor #11077 [TwigBundle] [Tests] Add framework-bundle (clemens-tolboom)a12471d
Add framework-bundle
This commit is contained in:
commit
605a533d12
@ -10,7 +10,6 @@ php:
|
||||
|
||||
matrix:
|
||||
allow_failures:
|
||||
- php: 5.6
|
||||
- php: hhvm-nightly
|
||||
|
||||
services: mongodb
|
||||
|
@ -63,8 +63,12 @@ class UniqueValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
->method('hasField')
|
||||
->will($this->returnValue(true))
|
||||
;
|
||||
$refl = $this->getMockBuilder('Doctrine\Common\Reflection\StaticReflectionProperty')
|
||||
$reflParser = $this->getMockBuilder('Doctrine\Common\Reflection\StaticReflectionParser')
|
||||
->disableOriginalConstructor()
|
||||
->getMock()
|
||||
;
|
||||
$refl = $this->getMockBuilder('Doctrine\Common\Reflection\StaticReflectionProperty')
|
||||
->setConstructorArgs(array($reflParser, 'property-name'))
|
||||
->setMethods(array('getValue'))
|
||||
->getMock()
|
||||
;
|
||||
|
@ -110,7 +110,12 @@ abstract class AbstractDescriptorTest extends \PHPUnit_Framework_TestCase
|
||||
$options['raw_output'] = true;
|
||||
$output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, true);
|
||||
$this->getDescriptor()->describe($output, $describedObject, $options);
|
||||
$this->assertEquals(trim($expectedDescription), trim(str_replace(PHP_EOL, "\n", $output->fetch())));
|
||||
|
||||
if ('json' === $this->getFormat()) {
|
||||
$this->assertEquals(json_decode($expectedDescription), json_decode($output->fetch()));
|
||||
} else {
|
||||
$this->assertEquals(trim($expectedDescription), trim(str_replace(PHP_EOL, "\n", $output->fetch())));
|
||||
}
|
||||
}
|
||||
|
||||
private function getDescriptionTestData(array $objects)
|
||||
|
@ -25,7 +25,8 @@
|
||||
"symfony/dependency-injection": "~2.0",
|
||||
"symfony/config": "~2.2",
|
||||
"symfony/routing": "~2.1",
|
||||
"symfony/templating": "~2.1"
|
||||
"symfony/templating": "~2.1",
|
||||
"symfony/framework-bundle": "~2.1"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": { "Symfony\\Bundle\\TwigBundle\\": "" }
|
||||
|
@ -11,6 +11,10 @@
|
||||
|
||||
namespace Symfony\Component\ClassLoader;
|
||||
|
||||
if (!defined('T_TRAIT')) {
|
||||
define('T_TRAIT', 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* ClassMapGenerator
|
||||
*
|
||||
@ -84,7 +88,6 @@ class ClassMapGenerator
|
||||
{
|
||||
$contents = file_get_contents($path);
|
||||
$tokens = token_get_all($contents);
|
||||
$T_TRAIT = version_compare(PHP_VERSION, '5.4', '<') ? -1 : T_TRAIT;
|
||||
|
||||
$classes = array();
|
||||
|
||||
@ -111,7 +114,7 @@ class ClassMapGenerator
|
||||
break;
|
||||
case T_CLASS:
|
||||
case T_INTERFACE:
|
||||
case $T_TRAIT:
|
||||
case T_TRAIT:
|
||||
// Find the classname
|
||||
while (($t = $tokens[++$i]) && is_array($t)) {
|
||||
if (T_STRING === $t[0]) {
|
||||
|
@ -80,7 +80,8 @@ class XmlUtils
|
||||
$valid = false;
|
||||
}
|
||||
} elseif (!is_array($schemaOrCallable) && is_file((string) $schemaOrCallable)) {
|
||||
$valid = @$dom->schemaValidate($schemaOrCallable);
|
||||
$schemaSource = file_get_contents((string) $schemaOrCallable);
|
||||
$valid = @$dom->schemaValidateSource($schemaSource);
|
||||
} else {
|
||||
libxml_use_internal_errors($internalErrors);
|
||||
|
||||
|
@ -157,7 +157,7 @@ class DialogHelper extends InputAwareHelper
|
||||
$c .= fread($inputStream, 2);
|
||||
|
||||
// A = Up Arrow. B = Down Arrow
|
||||
if ('A' === $c[2] || 'B' === $c[2]) {
|
||||
if (isset($c[2]) && ('A' === $c[2] || 'B' === $c[2])) {
|
||||
if ('A' === $c[2] && -1 === $ofs) {
|
||||
$ofs = 0;
|
||||
}
|
||||
|
@ -212,7 +212,7 @@ class QuestionHelper extends Helper
|
||||
$c .= fread($inputStream, 2);
|
||||
|
||||
// A = Up Arrow. B = Down Arrow
|
||||
if ('A' === $c[2] || 'B' === $c[2]) {
|
||||
if (isset($c[2]) && ('A' === $c[2] || 'B' === $c[2])) {
|
||||
if ('A' === $c[2] && -1 === $ofs) {
|
||||
$ofs = 0;
|
||||
}
|
||||
|
@ -10,7 +10,6 @@
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Console\Question;
|
||||
use Doctrine\Common\Proxy\Exception\InvalidArgumentException;
|
||||
|
||||
/**
|
||||
* Represents a Question.
|
||||
@ -184,7 +183,7 @@ class Question
|
||||
*
|
||||
* @return Question The current instance
|
||||
*
|
||||
* @throws InvalidArgumentException In case the number of attempts is invalid.
|
||||
* @throws \InvalidArgumentException In case the number of attempts is invalid.
|
||||
*/
|
||||
public function setMaxAttempts($attempts)
|
||||
{
|
||||
|
@ -24,6 +24,8 @@ interface ExtensionInterface
|
||||
/**
|
||||
* Returns node translators.
|
||||
*
|
||||
* These callables will receive the node as first argument and the translator as second argument.
|
||||
*
|
||||
* @return callable[]
|
||||
*/
|
||||
public function getNodeTranslators();
|
||||
|
@ -29,11 +29,6 @@ class NodeExtension extends AbstractExtension
|
||||
const ATTRIBUTE_NAME_IN_LOWER_CASE = 2;
|
||||
const ATTRIBUTE_VALUE_IN_LOWER_CASE = 4;
|
||||
|
||||
/**
|
||||
* @var Translator
|
||||
*/
|
||||
private $translator;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
@ -42,12 +37,10 @@ class NodeExtension extends AbstractExtension
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param Translator $translator
|
||||
* @param int $flags
|
||||
* @param int $flags
|
||||
*/
|
||||
public function __construct(Translator $translator, $flags = 0)
|
||||
public function __construct($flags = 0)
|
||||
{
|
||||
$this->translator = $translator;
|
||||
$this->flags = $flags;
|
||||
}
|
||||
|
||||
@ -100,33 +93,36 @@ class NodeExtension extends AbstractExtension
|
||||
|
||||
/**
|
||||
* @param Node\SelectorNode $node
|
||||
* @param Translator $translator
|
||||
*
|
||||
* @return XPathExpr
|
||||
*/
|
||||
public function translateSelector(Node\SelectorNode $node)
|
||||
public function translateSelector(Node\SelectorNode $node, Translator $translator)
|
||||
{
|
||||
return $this->translator->nodeToXPath($node->getTree());
|
||||
return $translator->nodeToXPath($node->getTree());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Node\CombinedSelectorNode $node
|
||||
* @param Translator $translator
|
||||
*
|
||||
* @return XPathExpr
|
||||
*/
|
||||
public function translateCombinedSelector(Node\CombinedSelectorNode $node)
|
||||
public function translateCombinedSelector(Node\CombinedSelectorNode $node, Translator $translator)
|
||||
{
|
||||
return $this->translator->addCombination($node->getCombinator(), $node->getSelector(), $node->getSubSelector());
|
||||
return $translator->addCombination($node->getCombinator(), $node->getSelector(), $node->getSubSelector());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Node\NegationNode $node
|
||||
* @param Translator $translator
|
||||
*
|
||||
* @return XPathExpr
|
||||
*/
|
||||
public function translateNegation(Node\NegationNode $node)
|
||||
public function translateNegation(Node\NegationNode $node, Translator $translator)
|
||||
{
|
||||
$xpath = $this->translator->nodeToXPath($node->getSelector());
|
||||
$subXpath = $this->translator->nodeToXPath($node->getSubSelector());
|
||||
$xpath = $translator->nodeToXPath($node->getSelector());
|
||||
$subXpath = $translator->nodeToXPath($node->getSubSelector());
|
||||
$subXpath->addNameTest();
|
||||
|
||||
if ($subXpath->getCondition()) {
|
||||
@ -138,34 +134,37 @@ class NodeExtension extends AbstractExtension
|
||||
|
||||
/**
|
||||
* @param Node\FunctionNode $node
|
||||
* @param Translator $translator
|
||||
*
|
||||
* @return XPathExpr
|
||||
*/
|
||||
public function translateFunction(Node\FunctionNode $node)
|
||||
public function translateFunction(Node\FunctionNode $node, Translator $translator)
|
||||
{
|
||||
$xpath = $this->translator->nodeToXPath($node->getSelector());
|
||||
$xpath = $translator->nodeToXPath($node->getSelector());
|
||||
|
||||
return $this->translator->addFunction($xpath, $node);
|
||||
return $translator->addFunction($xpath, $node);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Node\PseudoNode $node
|
||||
* @param Translator $translator
|
||||
*
|
||||
* @return XPathExpr
|
||||
*/
|
||||
public function translatePseudo(Node\PseudoNode $node)
|
||||
public function translatePseudo(Node\PseudoNode $node, Translator $translator)
|
||||
{
|
||||
$xpath = $this->translator->nodeToXPath($node->getSelector());
|
||||
$xpath = $translator->nodeToXPath($node->getSelector());
|
||||
|
||||
return $this->translator->addPseudoClass($xpath, $node->getIdentifier());
|
||||
return $translator->addPseudoClass($xpath, $node->getIdentifier());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Node\AttributeNode $node
|
||||
* @param Translator $translator
|
||||
*
|
||||
* @return XPathExpr
|
||||
*/
|
||||
public function translateAttribute(Node\AttributeNode $node)
|
||||
public function translateAttribute(Node\AttributeNode $node, Translator $translator)
|
||||
{
|
||||
$name = $node->getAttribute();
|
||||
$safe = $this->isSafeName($name);
|
||||
@ -181,37 +180,39 @@ class NodeExtension extends AbstractExtension
|
||||
|
||||
$attribute = $safe ? '@'.$name : sprintf('attribute::*[name() = %s]', Translator::getXpathLiteral($name));
|
||||
$value = $node->getValue();
|
||||
$xpath = $this->translator->nodeToXPath($node->getSelector());
|
||||
$xpath = $translator->nodeToXPath($node->getSelector());
|
||||
|
||||
if ($this->hasFlag(self::ATTRIBUTE_VALUE_IN_LOWER_CASE)) {
|
||||
$value = strtolower($value);
|
||||
}
|
||||
|
||||
return $this->translator->addAttributeMatching($xpath, $node->getOperator(), $attribute, $value);
|
||||
return $translator->addAttributeMatching($xpath, $node->getOperator(), $attribute, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Node\ClassNode $node
|
||||
* @param Translator $translator
|
||||
*
|
||||
* @return XPathExpr
|
||||
*/
|
||||
public function translateClass(Node\ClassNode $node)
|
||||
public function translateClass(Node\ClassNode $node, Translator $translator)
|
||||
{
|
||||
$xpath = $this->translator->nodeToXPath($node->getSelector());
|
||||
$xpath = $translator->nodeToXPath($node->getSelector());
|
||||
|
||||
return $this->translator->addAttributeMatching($xpath, '~=', '@class', $node->getName());
|
||||
return $translator->addAttributeMatching($xpath, '~=', '@class', $node->getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Node\HashNode $node
|
||||
* @param Translator $translator
|
||||
*
|
||||
* @return XPathExpr
|
||||
*/
|
||||
public function translateHash(Node\HashNode $node)
|
||||
public function translateHash(Node\HashNode $node, Translator $translator)
|
||||
{
|
||||
$xpath = $this->translator->nodeToXPath($node->getSelector());
|
||||
$xpath = $translator->nodeToXPath($node->getSelector());
|
||||
|
||||
return $this->translator->addAttributeMatching($xpath, '=', '@id', $node->getId());
|
||||
return $translator->addAttributeMatching($xpath, '=', '@id', $node->getId());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -76,7 +76,7 @@ class Translator implements TranslatorInterface
|
||||
$this->mainParser = $parser ?: new Parser();
|
||||
|
||||
$this
|
||||
->registerExtension(new Extension\NodeExtension($this))
|
||||
->registerExtension(new Extension\NodeExtension())
|
||||
->registerExtension(new Extension\CombinationExtension())
|
||||
->registerExtension(new Extension\FunctionExtension())
|
||||
->registerExtension(new Extension\PseudoClassExtension())
|
||||
@ -207,7 +207,7 @@ class Translator implements TranslatorInterface
|
||||
throw new ExpressionErrorException(sprintf('Node "%s" not supported.', $node->getNodeName()));
|
||||
}
|
||||
|
||||
return call_user_func($this->nodeTranslators[$node->getNodeName()], $node);
|
||||
return call_user_func($this->nodeTranslators[$node->getNodeName()], $node, $this);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -674,8 +674,8 @@ class Crawler extends \SplObjectStorage
|
||||
{
|
||||
$translate = 'translate(@type, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "abcdefghijklmnopqrstuvwxyz")';
|
||||
$xpath = sprintf('descendant-or-self::input[((contains(%s, "submit") or contains(%s, "button")) and contains(concat(\' \', normalize-space(string(@value)), \' \'), %s)) ', $translate, $translate, static::xpathLiteral(' '.$value.' ')).
|
||||
sprintf('or (contains(%s, "image") and contains(concat(\' \', normalize-space(string(@alt)), \' \'), %s)) or @id="%s" or @name="%s"] ', $translate, static::xpathLiteral(' '.$value.' '), $value, $value).
|
||||
sprintf('| descendant-or-self::button[contains(concat(\' \', normalize-space(string(.)), \' \'), %s) or @id="%s" or @name="%s"]', static::xpathLiteral(' '.$value.' '), $value, $value);
|
||||
sprintf('or (contains(%s, "image") and contains(concat(\' \', normalize-space(string(@alt)), \' \'), %s)) or @id=%s or @name=%s] ', $translate, static::xpathLiteral(' '.$value.' '), static::xpathLiteral($value), static::xpathLiteral($value)).
|
||||
sprintf('| descendant-or-self::button[contains(concat(\' \', normalize-space(string(.)), \' \'), %s) or @id=%s or @name=%s]', static::xpathLiteral(' '.$value.' '), static::xpathLiteral($value), static::xpathLiteral($value));
|
||||
|
||||
return $this->filterRelativeXPath($xpath);
|
||||
}
|
||||
|
@ -569,6 +569,48 @@ EOF
|
||||
$this->assertEquals(1, $crawler->selectButton('FooBarName')->count(), '->selectButton() selects buttons with form attribute too');
|
||||
}
|
||||
|
||||
public function testSelectButtonWithSingleQuotesInNameAttribute()
|
||||
{
|
||||
$html = <<<HTML
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<body>
|
||||
<div id="action">
|
||||
<a href="/index.php?r=site/login">Login</a>
|
||||
</div>
|
||||
<form id="login-form" action="/index.php?r=site/login" method="post">
|
||||
<button type="submit" name="Click 'Here'">Submit</button>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
HTML;
|
||||
|
||||
$crawler = new Crawler($html);
|
||||
|
||||
$this->assertCount(1, $crawler->selectButton('Click \'Here\''));
|
||||
}
|
||||
|
||||
public function testSelectButtonWithDoubleQuotesInNameAttribute()
|
||||
{
|
||||
$html = <<<HTML
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<body>
|
||||
<div id="action">
|
||||
<a href="/index.php?r=site/login">Login</a>
|
||||
</div>
|
||||
<form id="login-form" action="/index.php?r=site/login" method="post">
|
||||
<button type="submit" name='Click "Here"'>Submit</button>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
HTML;
|
||||
|
||||
$crawler = new Crawler($html);
|
||||
|
||||
$this->assertCount(1, $crawler->selectButton('Click "Here"'));
|
||||
}
|
||||
|
||||
public function testLink()
|
||||
{
|
||||
$crawler = $this->createTestCrawler('http://example.com/bar/')->selectLink('Foo');
|
||||
|
@ -96,6 +96,8 @@ class FilesystemTestCase extends \PHPUnit_Framework_TestCase
|
||||
if ($datas = posix_getgrgid($infos['gid'])) {
|
||||
return $datas['name'];
|
||||
}
|
||||
|
||||
$this->markTestSkipped('Unable to retrieve file group name');
|
||||
}
|
||||
|
||||
protected function markAsSkippedIfSymlinkIsMissing()
|
||||
|
@ -256,6 +256,7 @@ abstract class AbstractFindAdapter extends AbstractAdapter
|
||||
case '!=':
|
||||
$command->add('-size -'.$size->getTarget().'c');
|
||||
$command->add('-size +'.$size->getTarget().'c');
|
||||
break;
|
||||
case '<':
|
||||
default:
|
||||
$command->add('-size -'.$size->getTarget().'c');
|
||||
|
@ -78,7 +78,7 @@ class FileTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
|
||||
{
|
||||
$file = $this
|
||||
->getMockBuilder('Symfony\Component\HttpFoundation\File\UploadedFile')
|
||||
->disableOriginalConstructor()
|
||||
->setConstructorArgs(array(__DIR__.'/../../../Fixtures/foo', 'foo'))
|
||||
->getMock()
|
||||
;
|
||||
$file
|
||||
|
@ -14,6 +14,7 @@ namespace Symfony\Component\Form\Tests\Extension\HttpFoundation;
|
||||
use Symfony\Component\Form\Extension\HttpFoundation\HttpFoundationRequestHandler;
|
||||
use Symfony\Component\Form\Tests\AbstractRequestHandlerTest;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
||||
|
||||
/**
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
@ -47,8 +48,6 @@ class HttpFoundationRequestHandlerTest extends AbstractRequestHandlerTest
|
||||
|
||||
protected function getMockFile()
|
||||
{
|
||||
return $this->getMockBuilder('Symfony\Component\HttpFoundation\File\UploadedFile')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
return new UploadedFile(__DIR__.'/../../Fixtures/foo', 'foo');
|
||||
}
|
||||
}
|
||||
|
@ -358,6 +358,7 @@ class Request
|
||||
if (!isset($server['CONTENT_TYPE'])) {
|
||||
$server['CONTENT_TYPE'] = 'application/x-www-form-urlencoded';
|
||||
}
|
||||
// no break
|
||||
case 'PATCH':
|
||||
$request = $parameters;
|
||||
$query = array();
|
||||
@ -955,7 +956,13 @@ class Request
|
||||
}
|
||||
|
||||
if ($host = $this->headers->get('HOST')) {
|
||||
if (false !== $pos = strrpos($host, ':')) {
|
||||
if ($host[0] === '[') {
|
||||
$pos = strpos($host, ':', strrpos($host, ']'));
|
||||
} else {
|
||||
$pos = strrpos($host, ':');
|
||||
}
|
||||
|
||||
if (false !== $pos) {
|
||||
return intval(substr($host, $pos + 1));
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\HttpFoundation\Resources\stubs;
|
||||
|
||||
use Symfony\Component\HttpFoundation\File\File as OrigFile;
|
||||
|
||||
class FakeFile extends OrigFile
|
||||
{
|
||||
private $realpath;
|
||||
|
||||
public function __construct($realpath, $path)
|
||||
{
|
||||
$this->realpath = $realpath;
|
||||
parent::__construct($path, false);
|
||||
}
|
||||
|
||||
public function isReadable()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getRealpath()
|
||||
{
|
||||
return $this->realpath;
|
||||
}
|
||||
|
||||
public function getSize()
|
||||
{
|
||||
return 42;
|
||||
}
|
||||
|
||||
public function getMTime()
|
||||
{
|
||||
return time();
|
||||
}
|
||||
}
|
@ -14,6 +14,7 @@ namespace Symfony\Component\HttpFoundation\Tests;
|
||||
use Symfony\Component\HttpFoundation\BinaryFileResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\ResponseHeaderBag;
|
||||
use Symfony\Component\HttpFoundation\Resources\stubs\FakeFile;
|
||||
|
||||
class BinaryFileResponseTest extends ResponseTestCase
|
||||
{
|
||||
@ -179,18 +180,7 @@ class BinaryFileResponseTest extends ResponseTestCase
|
||||
$request->headers->set('X-Sendfile-Type', 'X-Accel-Redirect');
|
||||
$request->headers->set('X-Accel-Mapping', $mapping);
|
||||
|
||||
$file = $this->getMockBuilder('Symfony\Component\HttpFoundation\File\File')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$file->expects($this->any())
|
||||
->method('getRealPath')
|
||||
->will($this->returnValue($realpath));
|
||||
$file->expects($this->any())
|
||||
->method('isReadable')
|
||||
->will($this->returnValue(true));
|
||||
$file->expects($this->any())
|
||||
->method('getMTime')
|
||||
->will($this->returnValue(time()));
|
||||
$file = new FakeFile($realpath, __DIR__.'/File/Fixtures/test');
|
||||
|
||||
BinaryFileResponse::trustXSendFileTypeHeader();
|
||||
$response = new BinaryFileResponse($file);
|
||||
|
@ -163,6 +163,14 @@ class RequestTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals(90, $request->getPort());
|
||||
$this->assertTrue($request->isSecure());
|
||||
|
||||
$request = Request::create('https://[::1]/foo');
|
||||
$this->assertEquals('https://[::1]/foo', $request->getUri());
|
||||
$this->assertEquals('/foo', $request->getPathInfo());
|
||||
$this->assertEquals('[::1]', $request->getHost());
|
||||
$this->assertEquals('[::1]', $request->getHttpHost());
|
||||
$this->assertEquals(443, $request->getPort());
|
||||
$this->assertTrue($request->isSecure());
|
||||
|
||||
$json = '{"jsonrpc":"2.0","method":"echo","id":7,"params":["Hello World"]}';
|
||||
$request = Request::create('http://example.com/jsonrpc', 'POST', array(), array(), array(), array(), $json);
|
||||
$this->assertEquals($json, $request->getContent());
|
||||
|
@ -34,7 +34,6 @@ class MongoDbSessionHandlerTest extends \PHPUnit_Framework_TestCase
|
||||
$mongoClass = version_compare(phpversion('mongo'), '1.3.0', '<') ? 'Mongo' : 'MongoClient';
|
||||
|
||||
$this->mongo = $this->getMockBuilder($mongoClass)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$this->options = array(
|
||||
@ -76,9 +75,7 @@ class MongoDbSessionHandlerTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testWrite()
|
||||
{
|
||||
$collection = $this->getMockBuilder('MongoCollection')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$collection = $this->createMongoCollectionMock();
|
||||
|
||||
$this->mongo->expects($this->once())
|
||||
->method('selectCollection')
|
||||
@ -105,9 +102,7 @@ class MongoDbSessionHandlerTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testReplaceSessionData()
|
||||
{
|
||||
$collection = $this->getMockBuilder('MongoCollection')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$collection = $this->createMongoCollectionMock();
|
||||
|
||||
$this->mongo->expects($this->once())
|
||||
->method('selectCollection')
|
||||
@ -130,9 +125,7 @@ class MongoDbSessionHandlerTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testDestroy()
|
||||
{
|
||||
$collection = $this->getMockBuilder('MongoCollection')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$collection = $this->createMongoCollectionMock();
|
||||
|
||||
$this->mongo->expects($this->once())
|
||||
->method('selectCollection')
|
||||
@ -148,9 +141,7 @@ class MongoDbSessionHandlerTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testGc()
|
||||
{
|
||||
$collection = $this->getMockBuilder('MongoCollection')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$collection = $this->createMongoCollectionMock();
|
||||
|
||||
$this->mongo->expects($this->once())
|
||||
->method('selectCollection')
|
||||
@ -178,4 +169,19 @@ class MongoDbSessionHandlerTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
$this->assertInstanceOf($mongoClass, $method->invoke($this->storage));
|
||||
}
|
||||
|
||||
private function createMongoCollectionMock()
|
||||
{
|
||||
|
||||
$mongoClient = $this->getMockBuilder('MongoClient')
|
||||
->getMock();
|
||||
$mongoDb = $this->getMockBuilder('MongoDB')
|
||||
->setConstructorArgs(array($mongoClient, 'database-name'))
|
||||
->getMock();
|
||||
$collection = $this->getMockBuilder('MongoCollection')
|
||||
->setConstructorArgs(array($mongoDb, 'collection-name'))
|
||||
->getMock();
|
||||
|
||||
return $collection;
|
||||
}
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ class ExecutableFinder
|
||||
public function find($name, $default = null, array $extraDirs = array())
|
||||
{
|
||||
if (ini_get('open_basedir')) {
|
||||
$searchPath = explode(PATH_SEPARATOR, getenv('open_basedir'));
|
||||
$searchPath = explode(PATH_SEPARATOR, ini_get('open_basedir'));
|
||||
$dirs = array();
|
||||
foreach ($searchPath as $path) {
|
||||
if (is_dir($path)) {
|
||||
|
@ -219,7 +219,7 @@ class ProcessBuilder
|
||||
/**
|
||||
* Disables fetching output and error output from the underlying process.
|
||||
*
|
||||
* @return Process
|
||||
* @return ProcessBuilder
|
||||
*/
|
||||
public function disableOutput()
|
||||
{
|
||||
@ -231,7 +231,7 @@ class ProcessBuilder
|
||||
/**
|
||||
* Enables fetching output and error output from the underlying process.
|
||||
*
|
||||
* @return Process
|
||||
* @return ProcessBuilder
|
||||
*/
|
||||
public function enableOutput()
|
||||
{
|
||||
|
112
src/Symfony/Component/Process/Tests/ExecutableFinderTest.php
Normal file
112
src/Symfony/Component/Process/Tests/ExecutableFinderTest.php
Normal file
@ -0,0 +1,112 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Process\Tests;
|
||||
|
||||
use Symfony\Component\Process\ExecutableFinder;
|
||||
|
||||
/**
|
||||
* @author Chris Smith <chris@cs278.org>
|
||||
*/
|
||||
class ExecutableFinderTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
private $path;
|
||||
|
||||
public function tearDown()
|
||||
{
|
||||
if ($this->path) {
|
||||
// Restore path if it was changed.
|
||||
putenv('PATH='.$this->path);
|
||||
}
|
||||
}
|
||||
|
||||
private function setPath($path)
|
||||
{
|
||||
$this->path = getenv('PATH');
|
||||
putenv('PATH='.$path);
|
||||
}
|
||||
|
||||
public function testFind()
|
||||
{
|
||||
if (!defined('PHP_BINARY')) {
|
||||
$this->markTestSkipped('Requires the PHP_BINARY constant');
|
||||
}
|
||||
|
||||
if (ini_get('open_basedir')) {
|
||||
$this->markTestSkipped('Cannot test when open_basedir is set');
|
||||
}
|
||||
|
||||
$this->setPath(dirname(PHP_BINARY));
|
||||
|
||||
$finder = new ExecutableFinder;
|
||||
$result = $finder->find(basename(PHP_BINARY));
|
||||
|
||||
$this->assertEquals($result, PHP_BINARY);
|
||||
}
|
||||
|
||||
public function testFindWithDefault()
|
||||
{
|
||||
if (ini_get('open_basedir')) {
|
||||
$this->markTestSkipped('Cannot test when open_basedir is set');
|
||||
}
|
||||
|
||||
$expected = 'defaultValue';
|
||||
|
||||
$this->setPath('');
|
||||
|
||||
$finder = new ExecutableFinder;
|
||||
$result = $finder->find('foo', $expected);
|
||||
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
public function testFindWithExtraDirs()
|
||||
{
|
||||
if (!defined('PHP_BINARY')) {
|
||||
$this->markTestSkipped('Requires the PHP_BINARY constant');
|
||||
}
|
||||
|
||||
if (ini_get('open_basedir')) {
|
||||
$this->markTestSkipped('Cannot test when open_basedir is set');
|
||||
}
|
||||
|
||||
$this->setPath('');
|
||||
|
||||
$extraDirs = array(dirname(PHP_BINARY));
|
||||
|
||||
$finder = new ExecutableFinder;
|
||||
$result = $finder->find(basename(PHP_BINARY), null, $extraDirs);
|
||||
|
||||
$this->assertEquals(PHP_BINARY, $result);
|
||||
}
|
||||
|
||||
public function testFindWithOpenBaseDir()
|
||||
{
|
||||
if (!defined('PHP_BINARY')) {
|
||||
$this->markTestSkipped('Requires the PHP_BINARY constant');
|
||||
}
|
||||
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
$this->markTestSkipped('Cannot run test on windows');
|
||||
}
|
||||
|
||||
if (ini_get('open_basedir')) {
|
||||
$this->markTestSkipped('Cannot test when open_basedir is set');
|
||||
}
|
||||
|
||||
ini_set('open_basedir', dirname(PHP_BINARY).PATH_SEPARATOR.'/');
|
||||
|
||||
$finder = new ExecutableFinder;
|
||||
$result = $finder->find(basename(PHP_BINARY));
|
||||
|
||||
$this->assertEquals(PHP_BINARY, $result);
|
||||
}
|
||||
}
|
@ -129,7 +129,7 @@ class AuthenticationProviderManagerTest extends \PHPUnit_Framework_TestCase
|
||||
} elseif (null !== $exception) {
|
||||
$provider->expects($this->once())
|
||||
->method('authenticate')
|
||||
->will($this->throwException($this->getMock($exception, null, array(), '', true)))
|
||||
->will($this->throwException($this->getMock($exception, null, array(), '')))
|
||||
;
|
||||
}
|
||||
|
||||
|
@ -143,7 +143,9 @@ class GetSetMethodNormalizer extends SerializerAwareNormalizer implements Normal
|
||||
$params[] = $data[$paramName];
|
||||
// don't run set for a parameter passed to the constructor
|
||||
unset($data[$paramName]);
|
||||
} elseif (!$constructorParameter->isOptional()) {
|
||||
} elseif ($constructorParameter->isOptional()) {
|
||||
$params[] = $constructorParameter->getDefaultValue();
|
||||
} else {
|
||||
throw new RuntimeException(
|
||||
'Cannot create an instance of '.$class.
|
||||
' from serialized data because its constructor requires '.
|
||||
|
@ -109,6 +109,16 @@ class GetSetMethodNormalizerTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertTrue($obj->isBaz());
|
||||
}
|
||||
|
||||
public function testConstructorDenormalizeWithMissingOptionalArgument()
|
||||
{
|
||||
$obj = $this->normalizer->denormalize(
|
||||
array('foo' => 'test', 'baz' => array(1, 2, 3)),
|
||||
__NAMESPACE__.'\GetConstructorOptionalArgsDummy', 'any');
|
||||
$this->assertEquals('test', $obj->getFoo());
|
||||
$this->assertEquals(array(), $obj->getBar());
|
||||
$this->assertEquals(array(1, 2, 3), $obj->getBaz());
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideCallbacks
|
||||
*/
|
||||
@ -336,3 +346,37 @@ class GetConstructorDummy
|
||||
abstract class SerializerNormalizer implements SerializerInterface, NormalizerInterface
|
||||
{
|
||||
}
|
||||
|
||||
class GetConstructorOptionalArgsDummy
|
||||
{
|
||||
protected $foo;
|
||||
private $bar;
|
||||
private $baz;
|
||||
|
||||
public function __construct($foo, $bar = array(), $baz = array())
|
||||
{
|
||||
$this->foo = $foo;
|
||||
$this->bar = $bar;
|
||||
$this->baz = $baz;
|
||||
}
|
||||
|
||||
public function getFoo()
|
||||
{
|
||||
return $this->foo;
|
||||
}
|
||||
|
||||
public function getBar()
|
||||
{
|
||||
return $this->bar;
|
||||
}
|
||||
|
||||
public function getBaz()
|
||||
{
|
||||
return $this->baz;
|
||||
}
|
||||
|
||||
public function otherMethod()
|
||||
{
|
||||
throw new \RuntimeException("Dummy::otherMethod() should not be called");
|
||||
}
|
||||
}
|
||||
|
@ -278,6 +278,30 @@
|
||||
<source>This value should not be identical to {{ compared_value_type }} {{ compared_value }}.</source>
|
||||
<target>Ši reikšmė neturi būti identiška {{ compared_value_type }} {{ compared_value }}.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="73">
|
||||
<source>The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}.</source>
|
||||
<target>Nuotraukos santykis yra per didelis ({{ ratio }}). Didžiausias leistinas santykis yra {{ max_ratio }}.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="74">
|
||||
<source>The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}.</source>
|
||||
<target>Nuotraukos santykis yra per mažas ({{ ratio }}). Mažiausias leistinas santykis yra {{ min_ratio }}.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="75">
|
||||
<source>The image is square ({{ width }}x{{ height }}px). Square images are not allowed.</source>
|
||||
<target>Nuotrauka yra kvadratinė ({{ width }}x{{ height }}px). Kvadratinės nuotraukos nėra leistinos.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="76">
|
||||
<source>The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed.</source>
|
||||
<target>Nuotrauka orientuota į plotį ({{ width }}x{{ height }}px). Nuotraukos orientuotos į plotį nėra leistinos.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="77">
|
||||
<source>The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed.</source>
|
||||
<target>Nuotrauka orientuota į aukštį ({{ width }}x{{ height }}px). Nuotraukos orientuotos į aukštį nėra leistinos.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="78">
|
||||
<source>An empty file is not allowed.</source>
|
||||
<target>Failas negali būti tuščias.</target>
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
||||
|
@ -278,6 +278,26 @@
|
||||
<source>This value should not be identical to {{ compared_value }}.</source>
|
||||
<target>Deze waarde mag niet identiek zijn aan {{ compared_value }}.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="73">
|
||||
<source>The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}.</source>
|
||||
<target>De afbeeldingsverhouding is te groot ({{ ratio }}). Maximale verhouding is {{ max_ratio }}.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="74">
|
||||
<source>The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}.</source>
|
||||
<target>De afbeeldingsverhouding is te klein ({{ ratio }}). Minimale verhouding is {{ min_ratio }}.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="75">
|
||||
<source>The image is square ({{ width }}x{{ height }}px). Square images are not allowed.</source>
|
||||
<target>De afbeelding is vierkant ({{ width }}x{{ height }}px). Vierkante afbeeldingen zijn niet toegestaan.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="76">
|
||||
<source>The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed.</source>
|
||||
<target>De afbeelding is liggend ({{ width }}x{{ height }}px). Liggende afbeeldingen zijn niet toegestaan.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="77">
|
||||
<source>The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed.</source>
|
||||
<target>De afbeelding is staand ({{ width }}x{{ height }}px). Staande afbeeldingen zijn niet toegestaan.</target>
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
||||
|
@ -278,6 +278,30 @@
|
||||
<source>This value should not be identical to {{ compared_value_type }} {{ compared_value }}.</source>
|
||||
<target>Este valor não deve ser idêntico a {{ compared_value_type }} {{ compared_value }}.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="73">
|
||||
<source>The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}.</source>
|
||||
<target>O formato da imagem é muito grande ({{ ratio }}). O formato máximo é {{ max_ratio }}.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="74">
|
||||
<source>The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}.</source>
|
||||
<target>O formato da imagem é muito pequeno ({{ ratio }}). O formato mínimo esperado é {{ min_ratio }}.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="75">
|
||||
<source>The image is square ({{ width }}x{{ height }}px). Square images are not allowed.</source>
|
||||
<target>A imagem é um quadrado ({{ width }}x{{ height }}px). Imagens quadradas não são permitidas.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="76">
|
||||
<source>The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed.</source>
|
||||
<target>A imagem está orientada à paisagem ({{ width }}x{{ height }}px). Imagens orientadas à paisagem não são permitidas.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="77">
|
||||
<source>The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed.</source>
|
||||
<target>A imagem está orientada ao retrato ({{ width }}x{{ height }}px). Imagens orientadas ao retrato não são permitidas.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="78">
|
||||
<source>An empty file is not allowed.</source>
|
||||
<target>Ficheiro vazio não é permitido.</target>
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
||||
|
@ -278,6 +278,30 @@
|
||||
<source>This value should not be identical to {{ compared_value_type }} {{ compared_value }}.</source>
|
||||
<target>Este valor não deve ser idêntico a {{ compared_value_type }} {{ compared_value }}.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="73">
|
||||
<source>The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}.</source>
|
||||
<target>O formato da imagem é muito grande ({{ ratio }}). O formato máximo é {{ max_ratio }}.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="74">
|
||||
<source>The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}.</source>
|
||||
<target>O formato da imagem é muito pequeno ({{ ratio }}). O formato mínimo esperado é {{ min_ratio }}.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="75">
|
||||
<source>The image is square ({{ width }}x{{ height }}px). Square images are not allowed.</source>
|
||||
<target>A imagem está num formato quadrado ({{ width }}x{{ height }}px). Imagens com formato quadrado não são permitidas.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="76">
|
||||
<source>The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed.</source>
|
||||
<target>A imagem está orientada à paisagem ({{ width }}x{{ height }}px). Imagens orientadas à paisagem não são permitidas.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="77">
|
||||
<source>The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed.</source>
|
||||
<target>A imagem está orientada ao retrato ({{ width }}x{{ height }}px). Imagens orientadas ao retrato não são permitidas.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="78">
|
||||
<source>An empty file is not allowed.</source>
|
||||
<target>Ficheiro vazio não é permitido.</target>
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
||||
|
@ -278,6 +278,26 @@
|
||||
<source>This value should not be identical to {{ compared_value_type }} {{ compared_value }}.</source>
|
||||
<target>Значение не должно быть идентичным {{ compared_value_type }} {{ compared_value }}.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="73">
|
||||
<source>The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}.</source>
|
||||
<target>Соотношение сторон изображения слишком велико ({{ ratio }}). Максимальное соотношение сторон {{ max_ratio }}.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="74">
|
||||
<source>The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}.</source>
|
||||
<target>Соотношение сторон изображения слишком мало ({{ ratio }}). Минимальное соотношение сторон {{ min_ratio }}.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="75">
|
||||
<source>The image is square ({{ width }}x{{ height }}px). Square images are not allowed.</source>
|
||||
<target>Изображение квадратное ({{ width }}x{{ height }}px). Квадратные изображения не разрешены.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="76">
|
||||
<source>The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed.</source>
|
||||
<target>Изображение в альбомной ориентации ({{ width }}x{{ height }}px). Изображения в альбомной ориентации не разрешены.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="77">
|
||||
<source>The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed.</source>
|
||||
<target>Изображение в портретной ориентации ({{ width }}x{{ height }}px). Изображения в портретной ориентации не разрешены.</target>
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
||||
|
@ -278,6 +278,30 @@
|
||||
<source>This value should not be identical to {{ compared_value_type }} {{ compared_value }}.</source>
|
||||
<target>Táto hodnota by nemala byť typu {{ compared_value_type }} a zároveň by nemala byť rovná {{ compared_value }}.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="73">
|
||||
<source>The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}.</source>
|
||||
<target>Pomer strán obrázku je príliš veľký ({{ ratio }}). Maximálny povolený pomer strán obrázku je {{ max_ratio }}.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="74">
|
||||
<source>The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}.</source>
|
||||
<target>Pomer strán obrázku je príliš malý ({{ ratio }}). Minimálny povolený pomer strán obrázku je {{ min_ratio }}.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="75">
|
||||
<source>The image is square ({{ width }}x{{ height }}px). Square images are not allowed.</source>
|
||||
<target>Strany obrázku sú štvorcové ({{ width }}x{{ height }}px). Štvorcové obrázky nie sú povolené.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="76">
|
||||
<source>The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed.</source>
|
||||
<target>Obrázok je orientovaný na šírku ({{ width }}x{{ height }}px). Obrázky orientované na šírku nie sú povolené.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="77">
|
||||
<source>The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed.</source>
|
||||
<target>Obrázok je orientovaný na výšku ({{ width }}x{{ height }}px). Obrázky orientované na výšku nie sú povolené.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="78">
|
||||
<source>An empty file is not allowed.</source>
|
||||
<target>Súbor nesmie byť prázdny.</target>
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
||||
|
@ -199,7 +199,7 @@ abstract class FileValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$file = $this
|
||||
->getMockBuilder('Symfony\Component\HttpFoundation\File\File')
|
||||
->disableOriginalConstructor()
|
||||
->setConstructorArgs(array(__DIR__.'/Fixtures/foo'))
|
||||
->getMock()
|
||||
;
|
||||
$file
|
||||
@ -227,7 +227,7 @@ abstract class FileValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$file = $this
|
||||
->getMockBuilder('Symfony\Component\HttpFoundation\File\File')
|
||||
->disableOriginalConstructor()
|
||||
->setConstructorArgs(array(__DIR__.'/Fixtures/foo'))
|
||||
->getMock()
|
||||
;
|
||||
$file
|
||||
@ -255,7 +255,7 @@ abstract class FileValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$file = $this
|
||||
->getMockBuilder('Symfony\Component\HttpFoundation\File\File')
|
||||
->disableOriginalConstructor()
|
||||
->setConstructorArgs(array(__DIR__.'/Fixtures/foo'))
|
||||
->getMock()
|
||||
;
|
||||
$file
|
||||
@ -289,7 +289,7 @@ abstract class FileValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$file = $this
|
||||
->getMockBuilder('Symfony\Component\HttpFoundation\File\File')
|
||||
->disableOriginalConstructor()
|
||||
->setConstructorArgs(array(__DIR__.'/Fixtures/foo'))
|
||||
->getMock()
|
||||
;
|
||||
$file
|
||||
|
@ -66,6 +66,7 @@ class Parser
|
||||
|
||||
$data = array();
|
||||
$context = null;
|
||||
$allowOverwrite = false;
|
||||
while ($this->moveToNextLine()) {
|
||||
if ($this->isCurrentLineEmpty()) {
|
||||
continue;
|
||||
@ -76,7 +77,7 @@ class Parser
|
||||
throw new ParseException('A YAML file cannot contain tabs as indentation.', $this->getRealCurrentLineNb() + 1, $this->currentLine);
|
||||
}
|
||||
|
||||
$isRef = $isInPlace = $isProcessed = false;
|
||||
$isRef = $mergeNode = false;
|
||||
if (preg_match('#^\-((?P<leadspaces>\s+)(?P<value>.+?))?\s*$#u', $this->currentLine, $values)) {
|
||||
if ($context && 'mapping' == $context) {
|
||||
throw new ParseException('You cannot define a sequence item when in a mapping');
|
||||
@ -132,10 +133,24 @@ class Parser
|
||||
}
|
||||
|
||||
if ('<<' === $key) {
|
||||
$mergeNode = true;
|
||||
$allowOverwrite = true;
|
||||
if (isset($values['value']) && 0 === strpos($values['value'], '*')) {
|
||||
$isInPlace = substr($values['value'], 1);
|
||||
if (!array_key_exists($isInPlace, $this->refs)) {
|
||||
throw new ParseException(sprintf('Reference "%s" does not exist.', $isInPlace), $this->getRealCurrentLineNb() + 1, $this->currentLine);
|
||||
$refName = substr($values['value'], 1);
|
||||
if (!array_key_exists($refName, $this->refs)) {
|
||||
throw new ParseException(sprintf('Reference "%s" does not exist.', $refName), $this->getRealCurrentLineNb() + 1, $this->currentLine);
|
||||
}
|
||||
|
||||
$refValue = $this->refs[$refName];
|
||||
|
||||
if (!is_array($refValue)) {
|
||||
throw new ParseException('YAML merge keys used with a scalar value instead of an array.', $this->getRealCurrentLineNb() + 1, $this->currentLine);
|
||||
}
|
||||
|
||||
foreach ($refValue as $key => $value) {
|
||||
if (!isset($data[$key])) {
|
||||
$data[$key] = $value;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (isset($values['value']) && $values['value'] !== '') {
|
||||
@ -148,40 +163,49 @@ class Parser
|
||||
$parser->refs =& $this->refs;
|
||||
$parsed = $parser->parse($value, $exceptionOnInvalidType, $objectSupport);
|
||||
|
||||
$merged = array();
|
||||
if (!is_array($parsed)) {
|
||||
throw new ParseException('YAML merge keys used with a scalar value instead of an array.', $this->getRealCurrentLineNb() + 1, $this->currentLine);
|
||||
} elseif (isset($parsed[0])) {
|
||||
// Numeric array, merge individual elements
|
||||
foreach (array_reverse($parsed) as $parsedItem) {
|
||||
}
|
||||
|
||||
if (isset($parsed[0])) {
|
||||
// If the value associated with the merge key is a sequence, then this sequence is expected to contain mapping nodes
|
||||
// and each of these nodes is merged in turn according to its order in the sequence. Keys in mapping nodes earlier
|
||||
// in the sequence override keys specified in later mapping nodes.
|
||||
foreach ($parsed as $parsedItem) {
|
||||
if (!is_array($parsedItem)) {
|
||||
throw new ParseException('Merge items must be arrays.', $this->getRealCurrentLineNb() + 1, $parsedItem);
|
||||
}
|
||||
$merged = array_merge($parsedItem, $merged);
|
||||
|
||||
foreach ($parsedItem as $key => $value) {
|
||||
if (!isset($data[$key])) {
|
||||
$data[$key] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Associative array, merge
|
||||
$merged = array_merge($merged, $parsed);
|
||||
// If the value associated with the key is a single mapping node, each of its key/value pairs is inserted into the
|
||||
// current mapping, unless the key already exists in it.
|
||||
foreach ($parsed as $key => $value) {
|
||||
if (!isset($data[$key])) {
|
||||
$data[$key] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$isProcessed = $merged;
|
||||
}
|
||||
} elseif (isset($values['value']) && preg_match('#^&(?P<ref>[^ ]+) *(?P<value>.*)#u', $values['value'], $matches)) {
|
||||
$isRef = $matches['ref'];
|
||||
$values['value'] = $matches['value'];
|
||||
}
|
||||
|
||||
if ($isProcessed) {
|
||||
if ($mergeNode) {
|
||||
// Merge keys
|
||||
$data = $isProcessed;
|
||||
// hash
|
||||
} elseif (!isset($values['value']) || '' == trim($values['value'], ' ') || 0 === strpos(ltrim($values['value'], ' '), '#')) {
|
||||
// hash
|
||||
// if next line is less indented or equal, then it means that the current value is null
|
||||
if (!$this->isNextLineIndented() && !$this->isNextLineUnIndentedCollection()) {
|
||||
// Spec: Keys MUST be unique; first one wins.
|
||||
// Parser cannot abort this mapping earlier, since lines
|
||||
// are processed sequentially.
|
||||
if (!isset($data[$key])) {
|
||||
// But overwriting is allowed when a merge node is used in current block.
|
||||
if ($allowOverwrite || !isset($data[$key])) {
|
||||
$data[$key] = null;
|
||||
}
|
||||
} else {
|
||||
@ -190,23 +214,17 @@ class Parser
|
||||
$parser->refs =& $this->refs;
|
||||
$value = $parser->parse($this->getNextEmbedBlock(), $exceptionOnInvalidType, $objectSupport);
|
||||
// Spec: Keys MUST be unique; first one wins.
|
||||
// Parser cannot abort this mapping earlier, since lines
|
||||
// are processed sequentially.
|
||||
if (!isset($data[$key])) {
|
||||
// But overwriting is allowed when a merge node is used in current block.
|
||||
if ($allowOverwrite || !isset($data[$key])) {
|
||||
$data[$key] = $value;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ($isInPlace) {
|
||||
$data = $this->refs[$isInPlace];
|
||||
} else {
|
||||
$value = $this->parseValue($values['value'], $exceptionOnInvalidType, $objectSupport);;
|
||||
// Spec: Keys MUST be unique; first one wins.
|
||||
// Parser cannot abort this mapping earlier, since lines
|
||||
// are processed sequentially.
|
||||
if (!isset($data[$key])) {
|
||||
$data[$key] = $value;
|
||||
}
|
||||
$value = $this->parseValue($values['value'], $exceptionOnInvalidType, $objectSupport);
|
||||
// Spec: Keys MUST be unique; first one wins.
|
||||
// But overwriting is allowed when a merge node is used in current block.
|
||||
if ($allowOverwrite || !isset($data[$key])) {
|
||||
$data[$key] = $value;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -10,9 +10,19 @@ yaml: |
|
||||
a: Steve
|
||||
b: Clark
|
||||
c: Brian
|
||||
bar: &bar
|
||||
bar:
|
||||
a: before
|
||||
d: other
|
||||
<<: *foo
|
||||
b: new
|
||||
x: Oren
|
||||
c:
|
||||
foo: bar
|
||||
foo: ignore
|
||||
bar: foo
|
||||
duplicate:
|
||||
foo: bar
|
||||
foo: ignore
|
||||
foo2: &foo2
|
||||
a: Ballmer
|
||||
ding: &dong [ fi, fei, fo, fam]
|
||||
@ -24,4 +34,12 @@ yaml: |
|
||||
head:
|
||||
<<: [ *foo , *dong , *foo2 ]
|
||||
php: |
|
||||
array('foo' => array('a' => 'Steve', 'b' => 'Clark', 'c' => 'Brian'), 'bar' => array('a' => 'Steve', 'b' => 'Clark', 'c' => 'Brian', 'x' => 'Oren'), 'foo2' => array('a' => 'Ballmer'), 'ding' => array('fi', 'fei', 'fo', 'fam'), 'check' => array('a' => 'Steve', 'b' => 'Clark', 'c' => 'Brian', 'fi', 'fei', 'fo', 'fam', 'isit' => 'tested'), 'head' => array('a' => 'Ballmer', 'b' => 'Clark', 'c' => 'Brian', 'fi', 'fei', 'fo', 'fam'))
|
||||
array(
|
||||
'foo' => array('a' => 'Steve', 'b' => 'Clark', 'c' => 'Brian'),
|
||||
'bar' => array('a' => 'before', 'd' => 'other', 'b' => 'new', 'c' => array('foo' => 'bar', 'bar' => 'foo'), 'x' => 'Oren'),
|
||||
'duplicate' => array('foo' => 'bar'),
|
||||
'foo2' => array('a' => 'Ballmer'),
|
||||
'ding' => array('fi', 'fei', 'fo', 'fam'),
|
||||
'check' => array('a' => 'Steve', 'b' => 'Clark', 'c' => 'Brian', 'fi', 'fei', 'fo', 'fam', 'isit' => 'tested'),
|
||||
'head' => array('a' => 'Steve', 'b' => 'Clark', 'c' => 'Brian', 'fi', 'fei', 'fo', 'fam')
|
||||
)
|
||||
|
Reference in New Issue
Block a user