Skip to content

Commit c5c63dc

Browse files
committed
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
2 parents b0fffac + c87c35e commit c5c63dc

File tree

10 files changed

+43
-13
lines changed

10 files changed

+43
-13
lines changed

phpunit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*/
1212

1313
// Please update when phpunit needs to be reinstalled with fresh deps:
14-
// Cache-Id-Version: 2016-03-23 14:50 UTC
14+
// Cache-Id-Version: 2016-03-25 09:45 UTC
1515

1616
use Symfony\Component\Process\ProcessUtils;
1717

src/Symfony/Component/Filesystem/Filesystem.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -486,13 +486,13 @@ public function tempnam($dir, $prefix)
486486
{
487487
list($scheme, $hierarchy) = $this->getSchemeAndHierarchy($dir);
488488

489-
// If no scheme or scheme is "file" create temp file in local filesystem
490-
if (null === $scheme || 'file' === $scheme) {
489+
// If no scheme or scheme is "file" or "gs" (Google Cloud) create temp file in local filesystem
490+
if (null === $scheme || 'file' === $scheme || 'gs' === $scheme) {
491491
$tmpFile = tempnam($hierarchy, $prefix);
492492

493493
// If tempnam failed or no scheme return the filename otherwise prepend the scheme
494494
if (false !== $tmpFile) {
495-
if (null !== $scheme) {
495+
if (null !== $scheme && 'gs' !== $scheme) {
496496
return $scheme.'://'.$tmpFile;
497497
}
498498

src/Symfony/Component/Form/Tests/Extension/Validator/Constraints/FormValidatorTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
use Symfony\Component\Validator\Constraints\NotNull;
2222
use Symfony\Component\Validator\Constraints\NotBlank;
2323
use Symfony\Component\Validator\Constraints\Valid;
24+
use Symfony\Component\Validator\ExecutionContextInterface;
2425
use Symfony\Component\Validator\Tests\Constraints\AbstractConstraintValidatorTest;
2526

2627
/**

src/Symfony/Component/Form/Tests/Extension/Validator/ValidatorExtensionTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Component\Form\Tests\Extension\Validator;
1313

1414
use Symfony\Component\Form\Extension\Validator\ValidatorExtension;
15+
use Symfony\Component\Validator\ValidatorInterface;
1516

1617
class ValidatorExtensionTest extends \PHPUnit_Framework_TestCase
1718
{

src/Symfony/Component/HttpFoundation/Request.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1346,8 +1346,9 @@ public static function getMimeTypes($format)
13461346
*/
13471347
public function getFormat($mimeType)
13481348
{
1349+
$canonicalMimeType = null;
13491350
if (false !== $pos = strpos($mimeType, ';')) {
1350-
$mimeType = substr($mimeType, 0, $pos);
1351+
$canonicalMimeType = substr($mimeType, 0, $pos);
13511352
}
13521353

13531354
if (null === static::$formats) {
@@ -1358,6 +1359,9 @@ public function getFormat($mimeType)
13581359
if (in_array($mimeType, (array) $mimeTypes)) {
13591360
return $format;
13601361
}
1362+
if (null !== $canonicalMimeType && in_array($canonicalMimeType, (array) $mimeTypes)) {
1363+
return $format;
1364+
}
13611365
}
13621366
}
13631367

src/Symfony/Component/HttpFoundation/Tests/RequestTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,13 @@ public function testGetMimeTypesFromInexistentFormat()
342342
$this->assertEquals(array(), Request::getMimeTypes('foo'));
343343
}
344344

345+
public function testGetFormatWithCustomMimeType()
346+
{
347+
$request = new Request();
348+
$request->setFormat('custom', 'application/vnd.foo.api;myversion=2.3');
349+
$this->assertEquals('custom', $request->getFormat('application/vnd.foo.api;myversion=2.3'));
350+
}
351+
345352
public function getFormatToMimeTypeMapProvider()
346353
{
347354
return array(

src/Symfony/Component/Templating/Tests/DelegatingEngineTest.php

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,7 @@ public function testStreamDelegatesToSupportedEngine()
6666
*/
6767
public function testStreamRequiresStreamingEngine()
6868
{
69-
$engine = $this->getEngineMock('template.php', true);
70-
$engine->expects($this->never())->method('stream');
71-
72-
$delegatingEngine = new DelegatingEngine(array($engine));
69+
$delegatingEngine = new DelegatingEngine(array(new TestEngine()));
7370
$delegatingEngine->stream('template.php', array('foo' => 'bar'));
7471
}
7572

@@ -155,3 +152,23 @@ private function getStreamingEngineMock($template, $supports)
155152
interface MyStreamingEngine extends StreamingEngineInterface, EngineInterface
156153
{
157154
}
155+
156+
class TestEngine implements EngineInterface
157+
{
158+
public function render($name, array $parameters = array())
159+
{
160+
}
161+
162+
public function exists($name)
163+
{
164+
}
165+
166+
public function supports($name)
167+
{
168+
return true;
169+
}
170+
171+
public function stream()
172+
{
173+
}
174+
}

src/Symfony/Component/Validator/Constraints/Callback.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function __construct($options = null)
3838
$options = $options['value'];
3939
}
4040

41-
if (is_array($options) && !isset($options['callback']) && !isset($options['groups'])) {
41+
if (is_array($options) && !isset($options['callback']) && !isset($options['groups']) && !isset($options['payload'])) {
4242
$options = array('callback' => $options);
4343
}
4444

src/Symfony/Component/Validator/Tests/Fixtures/Entity.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public function getData()
8585
}
8686

8787
/**
88-
* @Assert\Callback
88+
* @Assert\Callback(payload="foo")
8989
*/
9090
public function validateMe(ExecutionContextInterface $context)
9191
{

src/Symfony/Component/Validator/Tests/Mapping/Loader/AnnotationLoaderTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function testLoadClassMetadata()
5353
$expected->setGroupSequence(array('Foo', 'Entity'));
5454
$expected->addConstraint(new ConstraintA());
5555
$expected->addConstraint(new Callback(array('Symfony\Component\Validator\Tests\Fixtures\CallbackClass', 'callback')));
56-
$expected->addConstraint(new Callback('validateMe'));
56+
$expected->addConstraint(new Callback(array('callback' => 'validateMe', 'payload' => 'foo')));
5757
$expected->addConstraint(new Callback('validateMeStatic'));
5858
$expected->addPropertyConstraint('firstName', new NotNull());
5959
$expected->addPropertyConstraint('firstName', new Range(array('min' => 3)));
@@ -123,7 +123,7 @@ public function testLoadClassMetadataAndMerge()
123123
$expected->setGroupSequence(array('Foo', 'Entity'));
124124
$expected->addConstraint(new ConstraintA());
125125
$expected->addConstraint(new Callback(array('Symfony\Component\Validator\Tests\Fixtures\CallbackClass', 'callback')));
126-
$expected->addConstraint(new Callback('validateMe'));
126+
$expected->addConstraint(new Callback(array('callback' => 'validateMe', 'payload' => 'foo')));
127127
$expected->addConstraint(new Callback('validateMeStatic'));
128128
$expected->addPropertyConstraint('firstName', new NotNull());
129129
$expected->addPropertyConstraint('firstName', new Range(array('min' => 3)));

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy