Merge branch '2.3' into 2.7

* 2.3:
  Clean wrong whitespaces
  [travis] Build phpunit with local components
  do not remove space between attributes
  [HttpFoundation] fixed the check of 'proxy-revalidate' in Response::mustRevalidate()
  Fix the retrieval of the default value for variadic arguments
  Annotated routes with a variadic parameter
  Fixing DbalSessionHandler to work with a Oracle "limitation" or bug?
  Update EngineInterface.php
  let Travis builds fail when PHP 7 jobs fail

Conflicts:
	.travis.yml
	src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig
This commit is contained in:
Nicolas Grekas 2015-08-05 17:45:00 +02:00
commit 9ce3200436
9 changed files with 70 additions and 11 deletions

View File

@ -18,8 +18,6 @@ matrix:
- php: 5.6
env: deps=high
- php: nightly
allow_failures:
- php: nightly
fast_finish: true
services: mongodb
@ -43,12 +41,15 @@ before_install:
install:
- if [ "$deps" = "no" ]; then export SYMFONY_DEPRECATIONS_HELPER=strict; fi;
- if [ "$deps" = "no" ]; then composer --prefer-source install; fi;
- composer require --no-update phpunit/phpunit '*'
- composer require --no-update phpunit/phpunit-mock-objects '2.3.0' # See https://github.com/sebastianbergmann/phpunit-mock-objects/issues/223
- composer update --prefer-stable --prefer-source phpunit/phpunit
- components=$(find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist -printf '%h\n')
- if [ "$deps" != "no" ]; then php .travis.php $TRAVIS_COMMIT_RANGE $TRAVIS_BRANCH $components; fi;
- PHPUNIT="$(readlink -f ./vendor/bin/phpunit) --colors=always"
script:
- if [ "$deps" = "no" ]; then echo "$components" | parallel --gnu --keep-order 'echo -e "\\nRunning {} tests"; phpunit --exclude-group tty,benchmark,intl-data {} || (echo -e "\\e[41mKO\\e[0m {}" && $(exit 1));'; fi;
- if [ "$deps" = "no" ]; then echo -e "\\nRunning tests requiring tty"; phpunit --group tty || (echo -e "\\e[41mKO\\e[0m tty group" && $(exit 1)); fi;
- if [ "$deps" = "high" ]; then echo "$components" | parallel --gnu --keep-order -j10% 'echo -e "\\nRunning {} tests"; cd {}; composer --prefer-source update; phpunit --exclude-group tty,benchmark,intl-data || (echo -e "\\e[41mKO\\e[0m {}" && $(exit 1));'; fi;
- if [ "$deps" = "low" ]; then echo "$components" | parallel --gnu --keep-order -j10% 'echo -e "\\nRunning {} tests"; cd {}; composer --prefer-source --prefer-lowest --prefer-stable update; phpunit --exclude-group tty,benchmark,intl-data || (echo -e "\\e[41mKO\\e[0m {}" && $(exit 1));'; fi;
- if [ "$deps" = "no" ]; then echo "$components" | parallel --gnu --keep-order 'echo -e "\\nRunning {} tests"; '$PHPUNIT' --exclude-group tty,benchmark,intl-data {} || (echo -e "\\e[41mKO\\e[0m {}" && $(exit 1));'; fi;
- if [ "$deps" = "no" ]; then echo -e "\\nRunning tests requiring tty"; $PHPUNIT --group tty || (echo -e "\\e[41mKO\\e[0m tty group" && $(exit 1)); fi;
- if [ "$deps" = "high" ]; then echo "$components" | parallel --gnu --keep-order -j10% 'echo -e "\\nRunning {} tests"; cd {}; composer --prefer-source update; '$PHPUNIT' --exclude-group tty,benchmark,intl-data || (echo -e "\\e[41mKO\\e[0m {}" && $(exit 1));'; fi;
- if [ "$deps" = "low" ]; then echo "$components" | parallel --gnu --keep-order -j10% 'echo -e "\\nRunning {} tests"; cd {}; composer --prefer-source --prefer-lowest --prefer-stable update; '$PHPUNIT' --exclude-group tty,benchmark,intl-data || (echo -e "\\e[41mKO\\e[0m {}" && $(exit 1));'; fi;

View File

@ -159,6 +159,14 @@ class DbalSessionHandler implements \SessionHandlerInterface
$mergeStmt->bindParam(':id', $sessionId, \PDO::PARAM_STR);
$mergeStmt->bindParam(':data', $encoded, \PDO::PARAM_STR);
$mergeStmt->bindValue(':time', time(), \PDO::PARAM_INT);
//Oracle has a bug that will intermitently happen if you
//have only 1 bind on a CLOB field for 2 different statements
//(INSERT and UPDATE in this case)
if ('oracle' == $this->con->getDatabasePlatform()->getName()) {
$mergeStmt->bindParam(':data2', $encoded, \PDO::PARAM_STR);
}
$mergeStmt->execute();
return true;
@ -224,7 +232,7 @@ class DbalSessionHandler implements \SessionHandlerInterface
// DUAL is Oracle specific dummy table
return "MERGE INTO $this->table USING DUAL ON ($this->idCol = :id) ".
"WHEN NOT MATCHED THEN INSERT ($this->idCol, $this->dataCol, $this->timeCol) VALUES (:id, :data, :time) ".
"WHEN MATCHED THEN UPDATE SET $this->dataCol = :data, $this->timeCol = :time";
"WHEN MATCHED THEN UPDATE SET $this->dataCol = :data2, $this->timeCol = :time";
case $this->con->getDatabasePlatform() instanceof SQLServer2008Platform:
// MERGE is only available since SQL Server 2008 and must be terminated by semicolon
// It also requires HOLDLOCK according to http://weblogs.sqlteam.com/dang/archive/2009/01/31/UPSERT-Race-Condition-With-MERGE.aspx

View File

@ -630,7 +630,7 @@ class Response
*/
public function mustRevalidate()
{
return $this->headers->hasCacheControlDirective('must-revalidate') || $this->headers->has('proxy-revalidate');
return $this->headers->hasCacheControlDirective('must-revalidate') || $this->headers->hasCacheControlDirective('proxy-revalidate');
}
/**

View File

@ -105,6 +105,22 @@ class ResponseTest extends ResponseTestCase
$this->assertFalse($response->mustRevalidate());
}
public function testMustRevalidateWithMustRevalidateCacheControlHeader()
{
$response = new Response();
$response->headers->set('cache-control', 'must-revalidate');
$this->assertTrue($response->mustRevalidate());
}
public function testMustRevalidateWithProxyRevalidateCacheControlHeader()
{
$response = new Response();
$response->headers->set('cache-control', 'proxy-revalidate');
$this->assertTrue($response->mustRevalidate());
}
public function testSetNotModified()
{
$response = new Response();

View File

@ -139,7 +139,7 @@ abstract class AnnotationClassLoader implements LoaderInterface
$defaults = array_replace($globals['defaults'], $annot->getDefaults());
foreach ($method->getParameters() as $param) {
if (!isset($defaults[$param->getName()]) && $param->isOptional()) {
if (!isset($defaults[$param->getName()]) && $param->isDefaultValueAvailable()) {
$defaults[$param->getName()] = $param->getDefaultValue();
}
}

View File

@ -0,0 +1,19 @@
<?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\Routing\Tests\Fixtures\OtherAnnotatedClasses;
class VariadicClass
{
public function routeAction(...$params)
{
}
}

View File

@ -16,6 +16,7 @@ use Symfony\Component\Routing\Annotation\Route;
class AnnotationClassLoaderTest extends AbstractAnnotationLoaderTest
{
protected $loader;
private $reader;
protected function setUp()
{

View File

@ -13,6 +13,7 @@ namespace Symfony\Component\Routing\Tests\Loader;
use Symfony\Component\Routing\Loader\AnnotationFileLoader;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\Routing\Annotation\Route;
class AnnotationFileLoaderTest extends AbstractAnnotationLoaderTest
{
@ -34,6 +35,19 @@ class AnnotationFileLoaderTest extends AbstractAnnotationLoaderTest
$this->loader->load(__DIR__.'/../Fixtures/AnnotatedClasses/FooClass.php');
}
/**
* @requires PHP 5.6
*/
public function testLoadVariadic()
{
$route = new Route(array('path' => '/path/to/{id}'));
$this->reader->expects($this->once())->method('getClassAnnotation');
$this->reader->expects($this->once())->method('getMethodAnnotations')
->will($this->returnValue(array($route)));
$this->loader->load(__DIR__.'/../Fixtures/OtherAnnotatedClasses/VariadicClass.php');
}
public function testSupports()
{
$fixture = __DIR__.'/../Fixtures/annotated.php';

View File

@ -14,7 +14,7 @@ namespace Symfony\Component\Templating;
/**
* EngineInterface is the interface each engine must implement.
*
* All methods relies on a template name. A template name is a
* All methods rely on a template name. A template name is a
* "logical" name for the template, and as such it does not refer to
* a path on the filesystem (in fact, the template can be stored
* anywhere, like in a database).