merged 2.0
This commit is contained in:
commit
8a4f9ea512
@ -112,8 +112,11 @@ EOT
|
||||
$basename = substr($m->name, strrpos($m->name, '\\') + 1);
|
||||
$output->writeln(sprintf(' > backing up <comment>%s.php</comment> to <comment>%s.php~</comment>', $basename, $basename));
|
||||
}
|
||||
// Getting the metadata for the entity class once more to get the correct path if the namespace has multiple occurrences
|
||||
$entityMetadata = $manager->getClassMetadata($m->getName(), $input->getOption('path'));
|
||||
|
||||
$output->writeln(sprintf(' > generating <comment>%s</comment>', $m->name));
|
||||
$generator->generate(array($m), $metadata->getPath());
|
||||
$generator->generate(array($m), $entityMetadata->getPath());
|
||||
|
||||
if ($m->customRepositoryClassName && false !== strpos($m->customRepositoryClassName, $metadata->getNamespace())) {
|
||||
$repoGenerator->writeEntityRepositoryClass($m->customRepositoryClassName, $metadata->getPath());
|
||||
|
@ -86,6 +86,7 @@
|
||||
<tag name="templating.helper" alias="code" />
|
||||
<argument>%templating.helper.code.file_link_format%</argument>
|
||||
<argument>%kernel.root_dir%</argument>
|
||||
<argument>%kernel.charset%</argument>
|
||||
</service>
|
||||
|
||||
<service id="templating.helper.translator" class="%templating.helper.translator.class%">
|
||||
|
@ -116,7 +116,7 @@
|
||||
</trans-unit>
|
||||
<trans-unit id="29">
|
||||
<source>The uploaded file was too large. Please try to upload a smaller file</source>
|
||||
<target>Nahraný soubor je příliš velký. Nahrejte prosím menší soubor</target>
|
||||
<target>Nahraný soubor je příliš velký. Nahrajte prosím menší soubor</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="30">
|
||||
<source>The CSRF token is invalid. Please try to resubmit the form</source>
|
||||
|
@ -13,6 +13,10 @@ namespace Symfony\Bundle\FrameworkBundle\Templating\Helper;
|
||||
|
||||
use Symfony\Component\Templating\Helper\Helper;
|
||||
|
||||
if (!defined('ENT_SUBSTITUTE')) {
|
||||
define('ENT_SUBSTITUTE', 8);
|
||||
}
|
||||
|
||||
/**
|
||||
* CodeHelper.
|
||||
*
|
||||
@ -22,17 +26,20 @@ class CodeHelper extends Helper
|
||||
{
|
||||
protected $fileLinkFormat;
|
||||
protected $rootDir;
|
||||
protected $charset;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $fileLinkFormat The format for links to source files
|
||||
* @param string $rootDir The project root directory
|
||||
* @param string $charset The charset
|
||||
*/
|
||||
public function __construct($fileLinkFormat, $rootDir)
|
||||
public function __construct($fileLinkFormat, $rootDir, $charset)
|
||||
{
|
||||
$this->fileLinkFormat = empty($fileLinkFormat) ? ini_get('xdebug.file_link_format') : $fileLinkFormat;
|
||||
$this->rootDir = str_replace('\\', '/', $rootDir).'/';
|
||||
$this->charset = $charset;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -173,7 +180,7 @@ class CodeHelper extends Helper
|
||||
}
|
||||
|
||||
if (false !== $link = $this->getFileLink($file, $line)) {
|
||||
return sprintf('<a href="%s" title="Click to open this file" class="file_link">%s</a>', $link, $text);
|
||||
return sprintf('<a href="%s" title="Click to open this file" class="file_link">%s</a>', htmlspecialchars($link, ENT_QUOTES | ENT_SUBSTITUTE, $this->charset), $text);
|
||||
}
|
||||
|
||||
return $text;
|
||||
|
@ -65,6 +65,10 @@ class FilesystemLoader implements LoaderInterface
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!is_readable((string) $storage)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return filemtime((string) $storage) < $time;
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,13 @@ class CodeHelperTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
static public function setUpBeforeClass()
|
||||
{
|
||||
self::$helper = new CodeHelper('format', '/root');
|
||||
self::$helper = new CodeHelper('txmt://open?url=file://%f&line=%l', '/root', 'UTF-8');
|
||||
}
|
||||
|
||||
public function testFormatFile()
|
||||
{
|
||||
$expected = sprintf('<a href="txmt://open?url=file://%s&line=25" title="Click to open this file" class="file_link">%s at line 25</a>', __FILE__, __FILE__);
|
||||
$this->assertEquals($expected, self::$helper->formatFile(__FILE__, 25));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -42,7 +42,7 @@ class XPathExprOr extends XPathExpr
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
$prefix = $this->prefix;
|
||||
$prefix = $this->getPrefix();
|
||||
|
||||
$tmp = array();
|
||||
foreach ($this->items as $i) {
|
||||
|
@ -11,6 +11,8 @@
|
||||
|
||||
namespace Symfony\Component\DependencyInjection;
|
||||
|
||||
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
|
||||
|
||||
/**
|
||||
* Definition represents a service definition.
|
||||
*
|
||||
@ -308,10 +310,15 @@ class Definition
|
||||
*
|
||||
* @return Definition The current instance
|
||||
*
|
||||
* @throws InvalidArgumentException on empty $method param
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
public function addMethodCall($method, array $arguments = array())
|
||||
{
|
||||
if (empty($method)) {
|
||||
throw new InvalidArgumentException(sprintf('Method name cannot be empty.'));
|
||||
}
|
||||
$this->calls[] = array($method, $arguments);
|
||||
|
||||
return $this;
|
||||
|
@ -95,7 +95,7 @@ class ControllerResolver implements ControllerResolverInterface
|
||||
{
|
||||
if (is_array($controller)) {
|
||||
$r = new \ReflectionMethod($controller[0], $controller[1]);
|
||||
} elseif (is_object($controller)) {
|
||||
} elseif (is_object($controller) && !$controller instanceof \Closure) {
|
||||
$r = new \ReflectionObject($controller);
|
||||
$r = $r->getMethod('__invoke');
|
||||
} else {
|
||||
|
@ -50,6 +50,15 @@ class FormatterHelperTest extends \PHPUnit_Framework_TestCase
|
||||
$formatter->formatBlock('Some text to display', 'error', true),
|
||||
'::formatBlock() formats a message in a block'
|
||||
);
|
||||
}
|
||||
|
||||
public function testFormatBlockWithDiacriticLetters()
|
||||
{
|
||||
if (!extension_loaded('mbstring')) {
|
||||
$this->markTestSkipped('This test requires mbstring to work.');
|
||||
}
|
||||
|
||||
$formatter = new FormatterHelper();
|
||||
|
||||
$this->assertEquals(
|
||||
'<error> </error>' . "\n" .
|
||||
|
@ -26,4 +26,18 @@ class OrNodeTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
$this->assertEquals("h1 | h2 | h3", (string) $or->toXpath(), '->toXpath() returns the xpath representation of the node');
|
||||
}
|
||||
|
||||
public function testIssueMissingPrefix()
|
||||
{
|
||||
// h1, h2, h3
|
||||
$element1 = new ElementNode('*', 'h1');
|
||||
$element2 = new ElementNode('*', 'h2');
|
||||
$element3 = new ElementNode('*', 'h3');
|
||||
$or = new OrNode(array($element1, $element2, $element3));
|
||||
|
||||
$xPath = $or->toXPath();
|
||||
$xPath->addPrefix('descendant-or-self::');
|
||||
|
||||
$this->assertEquals("descendant-or-self::h1 | descendant-or-self::h2 | descendant-or-self::h3", (string) $xPath);
|
||||
}
|
||||
}
|
||||
|
@ -95,6 +95,16 @@ class DefinitionTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals(array(array('foo', array('foo'))), $def->getMethodCalls(), '->removeMethodCall() removes a method to call');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
|
||||
* @expectedExceptionMessage Method name cannot be empty.
|
||||
*/
|
||||
public function testExceptionOnEmptyMethodCall()
|
||||
{
|
||||
$def = new Definition('stdClass');
|
||||
$def->addMethodCall('');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Symfony\Component\DependencyInjection\Definition::setFile
|
||||
* @covers Symfony\Component\DependencyInjection\Definition::getFile
|
||||
|
@ -102,6 +102,18 @@ class ControllerResolverTest extends \PHPUnit_Framework_TestCase
|
||||
$controller = function ($foo) {};
|
||||
$this->assertEquals(array('foo'), $resolver->getArguments($request, $controller));
|
||||
|
||||
$request = Request::create('/');
|
||||
$request->attributes->set('foo', 'foo');
|
||||
$controller = function ($foo, $bar = 'bar') {};
|
||||
$this->assertEquals(array('foo', 'bar'), $resolver->getArguments($request, $controller));
|
||||
|
||||
$request = Request::create('/');
|
||||
$request->attributes->set('foo', 'foo');
|
||||
$controller = new self();
|
||||
$this->assertEquals(array('foo', null), $resolver->getArguments($request, $controller));
|
||||
$request->attributes->set('bar', 'bar');
|
||||
$this->assertEquals(array('foo', 'bar'), $resolver->getArguments($request, $controller));
|
||||
|
||||
$request = Request::create('/');
|
||||
$request->attributes->set('foo', 'foo');
|
||||
$request->attributes->set('foobar', 'foobar');
|
||||
@ -119,7 +131,7 @@ class ControllerResolverTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals(array($request), $resolver->getArguments($request, $controller), '->getArguments() injects the request');
|
||||
}
|
||||
|
||||
public function __invoke()
|
||||
public function __invoke($foo, $bar = null)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ class PhpExecutableFinderTest extends \PHPUnit_Framework_TestCase
|
||||
$current = $f->find();
|
||||
|
||||
//TODO maybe php executable is custom or even windows
|
||||
if (!defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
$this->assertEquals($current, PHP_BINDIR.DIRECTORY_SEPARATOR.'php', '::find() returns the executable php with suffixes');
|
||||
}
|
||||
}
|
||||
|
@ -47,7 +47,10 @@ class InlineTest extends \PHPUnit_Framework_TestCase
|
||||
$this->markTestSkipped('Your platform does not support locales.');
|
||||
}
|
||||
|
||||
setlocale(LC_ALL, 'fr_FR.UTF-8', 'fr_FR.UTF8', 'fr_FR.utf-8', 'fr_FR.utf8', 'French_France.1252');
|
||||
$required_locales = array('fr_FR.UTF-8', 'fr_FR.UTF8', 'fr_FR.utf-8', 'fr_FR.utf8', 'French_France.1252');
|
||||
if (false === setlocale(LC_ALL, $required_locales)) {
|
||||
$this->markTestSkipped('Could not set any of required locales: ' . implode(", ", $required_locales));
|
||||
}
|
||||
|
||||
$this->assertEquals('1.2', Inline::dump(1.2));
|
||||
$this->assertContains('fr', strtolower(setlocale(LC_NUMERIC, 0)));
|
||||
|
Reference in New Issue
Block a user