Merge branch '3.0'

* 3.0:
  bumped Symfony version to 2.8.5
  updated VERSION for 2.8.4
  updated CHANGELOG for 2.8.4
  Revert "bug #18275 [Form] Fix BC break introduced in #14403 (HeahDude)"
  improved comment
  [FileSystem] Add support for Google App Engine.
  [2.8] fix mocks
  bumped Symfony version to 2.7.12
  [Form] Fix BC break introduced in #14403
  updated VERSION for 2.7.11
  updated CHANGELOG for 2.7.11
  [Request] Fix support of custom mime types with parameters
  fix mocks
  fix mocks
  [Validator] do not treat payload as callback
This commit is contained in:
Fabien Potencier 2016-03-27 18:15:51 +02:00
commit c5c63dc142
10 changed files with 43 additions and 13 deletions

View File

@ -11,7 +11,7 @@
*/
// Please update when phpunit needs to be reinstalled with fresh deps:
// Cache-Id-Version: 2016-03-23 14:50 UTC
// Cache-Id-Version: 2016-03-25 09:45 UTC
use Symfony\Component\Process\ProcessUtils;

View File

@ -486,13 +486,13 @@ class Filesystem
{
list($scheme, $hierarchy) = $this->getSchemeAndHierarchy($dir);
// If no scheme or scheme is "file" create temp file in local filesystem
if (null === $scheme || 'file' === $scheme) {
// If no scheme or scheme is "file" or "gs" (Google Cloud) create temp file in local filesystem
if (null === $scheme || 'file' === $scheme || 'gs' === $scheme) {
$tmpFile = tempnam($hierarchy, $prefix);
// If tempnam failed or no scheme return the filename otherwise prepend the scheme
if (false !== $tmpFile) {
if (null !== $scheme) {
if (null !== $scheme && 'gs' !== $scheme) {
return $scheme.'://'.$tmpFile;
}

View File

@ -21,6 +21,7 @@ use Symfony\Component\Form\SubmitButtonBuilder;
use Symfony\Component\Validator\Constraints\NotNull;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Constraints\Valid;
use Symfony\Component\Validator\ExecutionContextInterface;
use Symfony\Component\Validator\Tests\Constraints\AbstractConstraintValidatorTest;
/**

View File

@ -12,6 +12,7 @@
namespace Symfony\Component\Form\Tests\Extension\Validator;
use Symfony\Component\Form\Extension\Validator\ValidatorExtension;
use Symfony\Component\Validator\ValidatorInterface;
class ValidatorExtensionTest extends \PHPUnit_Framework_TestCase
{

View File

@ -1346,8 +1346,9 @@ class Request
*/
public function getFormat($mimeType)
{
$canonicalMimeType = null;
if (false !== $pos = strpos($mimeType, ';')) {
$mimeType = substr($mimeType, 0, $pos);
$canonicalMimeType = substr($mimeType, 0, $pos);
}
if (null === static::$formats) {
@ -1358,6 +1359,9 @@ class Request
if (in_array($mimeType, (array) $mimeTypes)) {
return $format;
}
if (null !== $canonicalMimeType && in_array($canonicalMimeType, (array) $mimeTypes)) {
return $format;
}
}
}

View File

@ -342,6 +342,13 @@ class RequestTest extends \PHPUnit_Framework_TestCase
$this->assertEquals(array(), Request::getMimeTypes('foo'));
}
public function testGetFormatWithCustomMimeType()
{
$request = new Request();
$request->setFormat('custom', 'application/vnd.foo.api;myversion=2.3');
$this->assertEquals('custom', $request->getFormat('application/vnd.foo.api;myversion=2.3'));
}
public function getFormatToMimeTypeMapProvider()
{
return array(

View File

@ -66,10 +66,7 @@ class DelegatingEngineTest extends \PHPUnit_Framework_TestCase
*/
public function testStreamRequiresStreamingEngine()
{
$engine = $this->getEngineMock('template.php', true);
$engine->expects($this->never())->method('stream');
$delegatingEngine = new DelegatingEngine(array($engine));
$delegatingEngine = new DelegatingEngine(array(new TestEngine()));
$delegatingEngine->stream('template.php', array('foo' => 'bar'));
}
@ -155,3 +152,23 @@ class DelegatingEngineTest extends \PHPUnit_Framework_TestCase
interface MyStreamingEngine extends StreamingEngineInterface, EngineInterface
{
}
class TestEngine implements EngineInterface
{
public function render($name, array $parameters = array())
{
}
public function exists($name)
{
}
public function supports($name)
{
return true;
}
public function stream()
{
}
}

View File

@ -38,7 +38,7 @@ class Callback extends Constraint
$options = $options['value'];
}
if (is_array($options) && !isset($options['callback']) && !isset($options['groups'])) {
if (is_array($options) && !isset($options['callback']) && !isset($options['groups']) && !isset($options['payload'])) {
$options = array('callback' => $options);
}

View File

@ -85,7 +85,7 @@ class Entity extends EntityParent implements EntityInterface
}
/**
* @Assert\Callback
* @Assert\Callback(payload="foo")
*/
public function validateMe(ExecutionContextInterface $context)
{

View File

@ -53,7 +53,7 @@ class AnnotationLoaderTest extends \PHPUnit_Framework_TestCase
$expected->setGroupSequence(array('Foo', 'Entity'));
$expected->addConstraint(new ConstraintA());
$expected->addConstraint(new Callback(array('Symfony\Component\Validator\Tests\Fixtures\CallbackClass', 'callback')));
$expected->addConstraint(new Callback('validateMe'));
$expected->addConstraint(new Callback(array('callback' => 'validateMe', 'payload' => 'foo')));
$expected->addConstraint(new Callback('validateMeStatic'));
$expected->addPropertyConstraint('firstName', new NotNull());
$expected->addPropertyConstraint('firstName', new Range(array('min' => 3)));
@ -123,7 +123,7 @@ class AnnotationLoaderTest extends \PHPUnit_Framework_TestCase
$expected->setGroupSequence(array('Foo', 'Entity'));
$expected->addConstraint(new ConstraintA());
$expected->addConstraint(new Callback(array('Symfony\Component\Validator\Tests\Fixtures\CallbackClass', 'callback')));
$expected->addConstraint(new Callback('validateMe'));
$expected->addConstraint(new Callback(array('callback' => 'validateMe', 'payload' => 'foo')));
$expected->addConstraint(new Callback('validateMeStatic'));
$expected->addPropertyConstraint('firstName', new NotNull());
$expected->addPropertyConstraint('firstName', new Range(array('min' => 3)));