diff --git a/.gitignore b/.gitignore index fc673fa663..418cb5f976 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,6 @@ phpunit.xml composer.lock composer.phar autoload.php +package*.tar +packages.json /vendor/ diff --git a/.travis.sh b/.travis.sh new file mode 100644 index 0000000000..9eeecbeeb8 --- /dev/null +++ b/.travis.sh @@ -0,0 +1,25 @@ +branch=$1 +if [ -z "$branch" ]; then + echo 'Usage: branch dir1 dir2 ... dirN' + exit 1 +fi +shift +components=$* +if [ -z "$components" ]; then + echo 'Usage: branch dir1 dir2 ... dirN' + exit 1 +fi +echo '{"packages": {' > packages.json +components=$( + for c in $components; do + sed -i ':a;N;$!ba;s#^{\n\(\s*\)\("name"\)#{\n\1"repositories": \[{ "type": "composer", "url": "file://'$(pwd)'/" }\],\n\1\2#' $c/composer.json + n=$(php -r '$n=json_decode(file_get_contents("'$c'/composer.json"));echo $n->name;') + echo '"'$n'": {"'$branch'.x-dev": ' >> packages.json + cat $c/composer.json >> packages.json + echo '"version": "'$branch.x-dev'",\n "dist": {"type": "tar", "url": "file://'$(pwd)/$c'/package'$branch'.tar"}\n}},' >> packages.json + echo $c + done; +) +sed -i ':a;N;$!ba;s/\n}\n"/,\n "/g' packages.json +sed -i ':a;N;$!ba;s/}},$/\n}}\n}}/' packages.json +echo "$components" | parallel --gnu "cd {}; tar -cf package$branch.tar --exclude='package*.tar' *" diff --git a/.travis.yml b/.travis.yml index 88a1c760ba..745d385f40 100644 --- a/.travis.yml +++ b/.travis.yml @@ -39,6 +39,8 @@ before_install: install: - if [ "$deps" = "no" ]; then composer --prefer-source install; fi; + - components=$(find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist -printf '%h\n') + - if [ "$deps" != "no" ]; then sh .travis.sh $TRAVIS_BRANCH $components; fi; script: - components=$(find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist -printf '%h\n') diff --git a/src/Symfony/Bridge/Doctrine/DataCollector/DoctrineDataCollector.php b/src/Symfony/Bridge/Doctrine/DataCollector/DoctrineDataCollector.php index 89137d1055..b4a2acd4e6 100644 --- a/src/Symfony/Bridge/Doctrine/DataCollector/DoctrineDataCollector.php +++ b/src/Symfony/Bridge/Doctrine/DataCollector/DoctrineDataCollector.php @@ -117,8 +117,10 @@ class DoctrineDataCollector extends DataCollector private function sanitizeQuery($connectionName, $query) { $query['explainable'] = true; - $query['params'] = (array) $query['params']; - foreach ($query['params'] as $j => &$param) { + if (!is_array($query['params'])) { + $query['params'] = array($query['params']); + } + foreach ($query['params'] as $j => $param) { if (isset($query['types'][$j])) { // Transform the param according to the type $type = $query['types'][$j]; @@ -131,7 +133,7 @@ class DoctrineDataCollector extends DataCollector } } - list($param, $explainable) = $this->sanitizeParam($param); + list($query['params'][$j], $explainable) = $this->sanitizeParam($param); if (!$explainable) { $query['explainable'] = false; } diff --git a/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Instantiator/RuntimeInstantiatorTest.php b/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Instantiator/RuntimeInstantiatorTest.php index e9f5145834..a6605c2a53 100644 --- a/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Instantiator/RuntimeInstantiatorTest.php +++ b/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Instantiator/RuntimeInstantiatorTest.php @@ -31,7 +31,7 @@ class RuntimeInstantiatorTest extends \PHPUnit_Framework_TestCase /** * {@inheritdoc} */ - public function setUp() + protected function setUp() { $this->instantiator = new RuntimeInstantiator(); } diff --git a/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/PhpDumper/ProxyDumperTest.php b/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/PhpDumper/ProxyDumperTest.php index 969a668308..8ef46b4d96 100644 --- a/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/PhpDumper/ProxyDumperTest.php +++ b/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/PhpDumper/ProxyDumperTest.php @@ -31,7 +31,7 @@ class ProxyDumperTest extends \PHPUnit_Framework_TestCase /** * {@inheritdoc} */ - public function setUp() + protected function setUp() { $this->dumper = new ProxyDumper(); } diff --git a/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_3_layout.html.twig b/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_3_layout.html.twig index 6135d1016a..0a144f692c 100644 --- a/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_3_layout.html.twig +++ b/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_3_layout.html.twig @@ -15,7 +15,7 @@ {%- endblock textarea_widget %} {% block button_widget -%} - {% set attr = attr|merge({class: (attr.class|default('') ~ ' btn')|trim}) %} + {% set attr = attr|merge({class: (attr.class|default('btn-default') ~ ' btn')|trim}) %} {{- parent() -}} {%- endblock %} diff --git a/src/Symfony/Bridge/Twig/Translation/TwigExtractor.php b/src/Symfony/Bridge/Twig/Translation/TwigExtractor.php index c43a0bded0..2045bf2755 100644 --- a/src/Symfony/Bridge/Twig/Translation/TwigExtractor.php +++ b/src/Symfony/Bridge/Twig/Translation/TwigExtractor.php @@ -84,7 +84,7 @@ class TwigExtractor implements ExtractorInterface $this->twig->parse($this->twig->tokenize($template)); foreach ($visitor->getMessages() as $message) { - $catalogue->set(trim($message[0]), $this->prefix.trim($message[0]), $message[1] ? $message[1] : $this->defaultDomain); + $catalogue->set(trim($message[0]), $this->prefix.trim($message[0]), $message[1] ?: $this->defaultDomain); } $visitor->disable(); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerNameParserTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerNameParserTest.php index 55d2a4729e..4718c1eb0b 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerNameParserTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerNameParserTest.php @@ -29,7 +29,7 @@ class ControllerNameParserTest extends TestCase $this->loader->register(); } - public function tearDown() + protected function tearDown() { spl_autoload_unregister(array($this->loader, 'loadClass')); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Translation/TranslatorTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Translation/TranslatorTest.php index 1ae14e83d0..2df09ce1a6 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Translation/TranslatorTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Translation/TranslatorTest.php @@ -26,7 +26,7 @@ class TranslatorTest extends \PHPUnit_Framework_TestCase $this->deleteTmpDir(); } - public function tearDown() + protected function tearDown() { $this->deleteTmpDir(); } diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/Resources/views/base.html.twig b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/Resources/views/base.html.twig index c3dddd319b..caf6f6efb6 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/Resources/views/base.html.twig +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/Resources/views/base.html.twig @@ -1,7 +1,7 @@ - + {% block title %}Welcome!{% endblock %} {% block stylesheets %}{% endblock %} diff --git a/src/Symfony/Bundle/TwigBundle/Controller/ExceptionController.php b/src/Symfony/Bundle/TwigBundle/Controller/ExceptionController.php index 226661e40e..3bab43b523 100644 --- a/src/Symfony/Bundle/TwigBundle/Controller/ExceptionController.php +++ b/src/Symfony/Bundle/TwigBundle/Controller/ExceptionController.php @@ -62,7 +62,7 @@ class ExceptionController $code = $exception->getStatusCode(); - return Response::create($this->twig->render( + return new Response($this->twig->render( $this->findTemplate($request, $request->getRequestFormat(), $code, $showException), array( 'status_code' => $code, @@ -71,7 +71,7 @@ class ExceptionController 'logger' => $logger, 'currentContent' => $currentContent, ) - ))->setCharset('UTF-8'); + )); } /** diff --git a/src/Symfony/Bundle/TwigBundle/DependencyInjection/TwigExtension.php b/src/Symfony/Bundle/TwigBundle/DependencyInjection/TwigExtension.php index 1cb5c56119..70ed9eed9c 100644 --- a/src/Symfony/Bundle/TwigBundle/DependencyInjection/TwigExtension.php +++ b/src/Symfony/Bundle/TwigBundle/DependencyInjection/TwigExtension.php @@ -36,13 +36,13 @@ class TwigExtension extends Extension $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); $loader->load('twig.xml'); - foreach ($configs as &$config) { + foreach ($configs as $key => $config) { if (isset($config['globals'])) { foreach ($config['globals'] as $name => $value) { if (is_array($value) && isset($value['key'])) { - $config['globals'][$name] = array( + $configs[$key]['globals'][$name] = array( 'key' => $name, - 'value' => $config['globals'][$name], + 'value' => $value, ); } } diff --git a/src/Symfony/Bundle/TwigBundle/Resources/views/Exception/error.html.twig b/src/Symfony/Bundle/TwigBundle/Resources/views/Exception/error.html.twig index 30b51e4760..138a60ad96 100644 --- a/src/Symfony/Bundle/TwigBundle/Resources/views/Exception/error.html.twig +++ b/src/Symfony/Bundle/TwigBundle/Resources/views/Exception/error.html.twig @@ -1,7 +1,7 @@ - + An Error Occurred: {{ status_text }} diff --git a/src/Symfony/Bundle/TwigBundle/Tests/Controller/ExceptionControllerTest.php b/src/Symfony/Bundle/TwigBundle/Tests/Controller/ExceptionControllerTest.php index 15a453f2fe..5eddf232d6 100644 --- a/src/Symfony/Bundle/TwigBundle/Tests/Controller/ExceptionControllerTest.php +++ b/src/Symfony/Bundle/TwigBundle/Tests/Controller/ExceptionControllerTest.php @@ -40,8 +40,7 @@ class ExceptionControllerTest extends TestCase $request->headers->set('X-Php-Ob-Level', 1); $controller = new ExceptionController($twig, false); - $response = $controller->showAction($request, $flatten); - $this->assertEquals('UTF-8', $response->getCharset(), 'Request charset is explicitly set to UTF-8'); + $controller->showAction($request, $flatten); } public function testShowActionCanBeForcedToShowErrorPage() diff --git a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Compiler/TwigLoaderPassTest.php b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Compiler/TwigLoaderPassTest.php index 6bf5cd9baa..08e9d4602d 100644 --- a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Compiler/TwigLoaderPassTest.php +++ b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Compiler/TwigLoaderPassTest.php @@ -29,7 +29,7 @@ class TwigLoaderPassTest extends \PHPUnit_Framework_TestCase */ private $pass; - public function setUp() + protected function setUp() { $this->builder = $this->getMock( 'Symfony\Component\DependencyInjection\ContainerBuilder', diff --git a/src/Symfony/Bundle/TwigBundle/Tests/TokenParser/LegacyRenderTokenParserTest.php b/src/Symfony/Bundle/TwigBundle/Tests/TokenParser/LegacyRenderTokenParserTest.php index 3e415abf3e..a11ae8b9b8 100644 --- a/src/Symfony/Bundle/TwigBundle/Tests/TokenParser/LegacyRenderTokenParserTest.php +++ b/src/Symfony/Bundle/TwigBundle/Tests/TokenParser/LegacyRenderTokenParserTest.php @@ -17,7 +17,7 @@ use Symfony\Bundle\TwigBundle\Node\RenderNode; class LegacyRenderTokenParserTest extends TestCase { - public function setUp() + protected function setUp() { $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); } diff --git a/src/Symfony/Bundle/WebProfilerBundle/Controller/ExceptionController.php b/src/Symfony/Bundle/WebProfilerBundle/Controller/ExceptionController.php index abd75d440e..fd0dbecd2b 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Controller/ExceptionController.php +++ b/src/Symfony/Bundle/WebProfilerBundle/Controller/ExceptionController.php @@ -55,24 +55,23 @@ class ExceptionController $template = $this->getTemplate(); if (!$this->twig->getLoader()->exists($template)) { - $handler = new ExceptionHandler(); + $handler = new ExceptionHandler($this->debug, $this->twig->getCharset()); return new Response($handler->getContent($exception), 200, array('Content-Type' => 'text/html')); } $code = $exception->getStatusCode(); - return Response::create( - $this->twig->render($template, array( + return new Response($this->twig->render( + $template, + array( 'status_code' => $code, 'status_text' => Response::$statusTexts[$code], 'exception' => $exception, 'logger' => null, 'currentContent' => '', - )), - 200, - array('Content-Type' => 'text/html') - )->setCharset('UTF-8'); + ) + ), 200, array('Content-Type' => 'text/html')); } /** @@ -96,16 +95,12 @@ class ExceptionController $template = $this->getTemplate(); if (!$this->templateExists($template)) { - $handler = new ExceptionHandler(); + $handler = new ExceptionHandler($this->debug, $this->twig->getCharset()); - $response = new Response($handler->getStylesheet($exception), 200, array('Content-Type' => 'text/css')); - } else { - $response = new Response($this->twig->render('@WebProfiler/Collector/exception.css.twig'), 200, array('Content-Type' => 'text/css')); + return new Response($handler->getStylesheet($exception), 200, array('Content-Type' => 'text/css')); } - $response->setCharset('UTF-8'); - - return $response; + return new Response($this->twig->render('@WebProfiler/Collector/exception.css.twig'), 200, array('Content-Type' => 'text/css')); } protected function getTemplate() diff --git a/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php b/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php index d78ce2f675..2748910a19 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php +++ b/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php @@ -99,20 +99,16 @@ class ProfilerController throw new NotFoundHttpException(sprintf('Panel "%s" is not available for token "%s".', $panel, $token)); } - return Response::create( - $this->twig->render($this->getTemplateManager()->getName($profile, $panel), array( - 'token' => $token, - 'profile' => $profile, - 'collector' => $profile->getCollector($panel), - 'panel' => $panel, - 'page' => $page, - 'request' => $request, - 'templates' => $this->getTemplateManager()->getTemplates($profile), - 'is_ajax' => $request->isXmlHttpRequest(), - )), - 200, - array('Content-Type' => 'text/html') - )->setCharset('UTF-8'); + return new Response($this->twig->render($this->getTemplateManager()->getName($profile, $panel), array( + 'token' => $token, + 'profile' => $profile, + 'collector' => $profile->getCollector($panel), + 'panel' => $panel, + 'page' => $page, + 'request' => $request, + 'templates' => $this->getTemplateManager()->getTemplates($profile), + 'is_ajax' => $request->isXmlHttpRequest(), + )), 200, array('Content-Type' => 'text/html')); } /** @@ -151,13 +147,9 @@ class ProfilerController $this->profiler->disable(); - return Response::create( - $this->twig->render('@WebProfiler/Profiler/info.html.twig', array( - 'about' => $about, - )), - 200, - array('Content-Type' => 'text/html') - )->setCharset('UTF-8'); + return new Response($this->twig->render('@WebProfiler/Profiler/info.html.twig', array( + 'about' => $about, + )), 200, array('Content-Type' => 'text/html')); } /** @@ -205,17 +197,13 @@ class ProfilerController // the profiler is not enabled } - return Response::create( - $this->twig->render('@WebProfiler/Profiler/toolbar.html.twig', array( - 'position' => $position, - 'profile' => $profile, - 'templates' => $this->getTemplateManager()->getTemplates($profile), - 'profiler_url' => $url, - 'token' => $token, - )), - 200, - array('Content-Type' => 'text/html') - )->setCharset('UTF-8'); + return new Response($this->twig->render('@WebProfiler/Profiler/toolbar.html.twig', array( + 'position' => $position, + 'profile' => $profile, + 'templates' => $this->getTemplateManager()->getTemplates($profile), + 'profiler_url' => $url, + 'token' => $token, + )), 200, array('Content-Type' => 'text/html')); } /** @@ -253,7 +241,7 @@ class ProfilerController $token = $session->get('_profiler_search_token'); } - return Response::create( + return new Response( $this->twig->render('@WebProfiler/Profiler/search.html.twig', array( 'token' => $token, 'ip' => $ip, @@ -266,7 +254,7 @@ class ProfilerController )), 200, array('Content-Type' => 'text/html') - )->setCharset('UTF-8'); + ); } /** @@ -296,22 +284,18 @@ class ProfilerController $end = $request->query->get('end', null); $limit = $request->query->get('limit'); - return Response::create( - $this->twig->render('@WebProfiler/Profiler/results.html.twig', array( - 'token' => $token, - 'profile' => $profile, - 'tokens' => $this->profiler->find($ip, $url, $limit, $method, $start, $end), - 'ip' => $ip, - 'method' => $method, - 'url' => $url, - 'start' => $start, - 'end' => $end, - 'limit' => $limit, - 'panel' => null, - )), - 200, - array('Content-Type' => 'text/html') - )->setCharset('UTF-8'); + return new Response($this->twig->render('@WebProfiler/Profiler/results.html.twig', array( + 'token' => $token, + 'profile' => $profile, + 'tokens' => $this->profiler->find($ip, $url, $limit, $method, $start, $end), + 'ip' => $ip, + 'method' => $method, + 'url' => $url, + 'start' => $start, + 'end' => $end, + 'limit' => $limit, + 'panel' => null, + )), 200, array('Content-Type' => 'text/html')); } /** @@ -385,7 +369,7 @@ class ProfilerController phpinfo(); $phpinfo = ob_get_clean(); - return Response::create($phpinfo, 200, array('Content-Type' => 'text/html'))->setCharset('UTF-8'); + return new Response($phpinfo, 200, array('Content-Type' => 'text/html')); } /** diff --git a/src/Symfony/Bundle/WebProfilerBundle/Controller/RouterController.php b/src/Symfony/Bundle/WebProfilerBundle/Controller/RouterController.php index 800f209a6f..f4a84bf568 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Controller/RouterController.php +++ b/src/Symfony/Bundle/WebProfilerBundle/Controller/RouterController.php @@ -68,14 +68,10 @@ class RouterController $request = $profile->getCollector('request'); - return Response::create( - $this->twig->render('@WebProfiler/Router/panel.html.twig', array( - 'request' => $request, - 'router' => $profile->getCollector('router'), - 'traces' => $matcher->getTraces($request->getPathInfo()), - )), - 200, - array('Content-Type' => 'text/html') - )->setCharset('UTF-8'); + return new Response($this->twig->render('@WebProfiler/Router/panel.html.twig', array( + 'request' => $request, + 'router' => $profile->getCollector('router'), + 'traces' => $matcher->getTraces($request->getPathInfo()), + )), 200, array('Content-Type' => 'text/html')); } } diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base.html.twig index e4258a205d..3567708a72 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base.html.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base.html.twig @@ -1,8 +1,8 @@ - - + + {% block title 'Profiler' %}