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:
commit
9ce3200436
15
.travis.yml
15
.travis.yml
|
@ -18,8 +18,6 @@ matrix:
|
||||||
- php: 5.6
|
- php: 5.6
|
||||||
env: deps=high
|
env: deps=high
|
||||||
- php: nightly
|
- php: nightly
|
||||||
allow_failures:
|
|
||||||
- php: nightly
|
|
||||||
fast_finish: true
|
fast_finish: true
|
||||||
|
|
||||||
services: mongodb
|
services: mongodb
|
||||||
|
@ -43,12 +41,15 @@ before_install:
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- if [ "$deps" = "no" ]; then export SYMFONY_DEPRECATIONS_HELPER=strict; fi;
|
- 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')
|
- 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;
|
- if [ "$deps" != "no" ]; then php .travis.php $TRAVIS_COMMIT_RANGE $TRAVIS_BRANCH $components; fi;
|
||||||
|
- PHPUNIT="$(readlink -f ./vendor/bin/phpunit) --colors=always"
|
||||||
|
|
||||||
script:
|
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 "$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" = "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" = "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" = "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;
|
||||||
|
|
|
@ -159,6 +159,14 @@ class DbalSessionHandler implements \SessionHandlerInterface
|
||||||
$mergeStmt->bindParam(':id', $sessionId, \PDO::PARAM_STR);
|
$mergeStmt->bindParam(':id', $sessionId, \PDO::PARAM_STR);
|
||||||
$mergeStmt->bindParam(':data', $encoded, \PDO::PARAM_STR);
|
$mergeStmt->bindParam(':data', $encoded, \PDO::PARAM_STR);
|
||||||
$mergeStmt->bindValue(':time', time(), \PDO::PARAM_INT);
|
$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();
|
$mergeStmt->execute();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -224,7 +232,7 @@ class DbalSessionHandler implements \SessionHandlerInterface
|
||||||
// DUAL is Oracle specific dummy table
|
// DUAL is Oracle specific dummy table
|
||||||
return "MERGE INTO $this->table USING DUAL ON ($this->idCol = :id) ".
|
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 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:
|
case $this->con->getDatabasePlatform() instanceof SQLServer2008Platform:
|
||||||
// MERGE is only available since SQL Server 2008 and must be terminated by semicolon
|
// 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
|
// It also requires HOLDLOCK according to http://weblogs.sqlteam.com/dang/archive/2009/01/31/UPSERT-Race-Condition-With-MERGE.aspx
|
||||||
|
|
|
@ -630,7 +630,7 @@ class Response
|
||||||
*/
|
*/
|
||||||
public function mustRevalidate()
|
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');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -105,6 +105,22 @@ class ResponseTest extends ResponseTestCase
|
||||||
$this->assertFalse($response->mustRevalidate());
|
$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()
|
public function testSetNotModified()
|
||||||
{
|
{
|
||||||
$response = new Response();
|
$response = new Response();
|
||||||
|
|
|
@ -139,7 +139,7 @@ abstract class AnnotationClassLoader implements LoaderInterface
|
||||||
|
|
||||||
$defaults = array_replace($globals['defaults'], $annot->getDefaults());
|
$defaults = array_replace($globals['defaults'], $annot->getDefaults());
|
||||||
foreach ($method->getParameters() as $param) {
|
foreach ($method->getParameters() as $param) {
|
||||||
if (!isset($defaults[$param->getName()]) && $param->isOptional()) {
|
if (!isset($defaults[$param->getName()]) && $param->isDefaultValueAvailable()) {
|
||||||
$defaults[$param->getName()] = $param->getDefaultValue();
|
$defaults[$param->getName()] = $param->getDefaultValue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
|
@ -16,6 +16,7 @@ use Symfony\Component\Routing\Annotation\Route;
|
||||||
class AnnotationClassLoaderTest extends AbstractAnnotationLoaderTest
|
class AnnotationClassLoaderTest extends AbstractAnnotationLoaderTest
|
||||||
{
|
{
|
||||||
protected $loader;
|
protected $loader;
|
||||||
|
private $reader;
|
||||||
|
|
||||||
protected function setUp()
|
protected function setUp()
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,6 +13,7 @@ namespace Symfony\Component\Routing\Tests\Loader;
|
||||||
|
|
||||||
use Symfony\Component\Routing\Loader\AnnotationFileLoader;
|
use Symfony\Component\Routing\Loader\AnnotationFileLoader;
|
||||||
use Symfony\Component\Config\FileLocator;
|
use Symfony\Component\Config\FileLocator;
|
||||||
|
use Symfony\Component\Routing\Annotation\Route;
|
||||||
|
|
||||||
class AnnotationFileLoaderTest extends AbstractAnnotationLoaderTest
|
class AnnotationFileLoaderTest extends AbstractAnnotationLoaderTest
|
||||||
{
|
{
|
||||||
|
@ -34,6 +35,19 @@ class AnnotationFileLoaderTest extends AbstractAnnotationLoaderTest
|
||||||
$this->loader->load(__DIR__.'/../Fixtures/AnnotatedClasses/FooClass.php');
|
$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()
|
public function testSupports()
|
||||||
{
|
{
|
||||||
$fixture = __DIR__.'/../Fixtures/annotated.php';
|
$fixture = __DIR__.'/../Fixtures/annotated.php';
|
||||||
|
|
|
@ -14,7 +14,7 @@ namespace Symfony\Component\Templating;
|
||||||
/**
|
/**
|
||||||
* EngineInterface is the interface each engine must implement.
|
* 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
|
* "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
|
* a path on the filesystem (in fact, the template can be stored
|
||||||
* anywhere, like in a database).
|
* anywhere, like in a database).
|
||||||
|
|
Reference in New Issue