Merge branch '5.1' into 5.2

* 5.1:
  [Serializer] Fixed serialize and denormalize return types
  Run intl-data tests on resources change
  [FrameworkBundle] fix preserving some special chars in the query string when redirecting
This commit is contained in:
Fabien Potencier 2020-12-08 08:07:34 +01:00
commit f4e1556199
4 changed files with 56 additions and 6 deletions

47
.github/workflows/intl-data-tests.yml vendored Normal file
View File

@ -0,0 +1,47 @@
name: Intl data tests
on:
push:
paths:
- 'src/Symfony/Component/Intl/Resources/data/**'
pull_request:
paths:
- 'src/Symfony/Component/Intl/Resources/data/**'
jobs:
tests:
name: Tests (intl-data)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Define the ICU version
run: |
SYMFONY_ICU_VERSION=$(php -r 'require "src/Symfony/Component/Intl/Intl.php"; echo Symfony\Component\Intl\Intl::getIcuStubVersion();')
echo "SYMFONY_ICU_VERSION=$SYMFONY_ICU_VERSION" >> $GITHUB_ENV
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
coverage: "none"
extensions: "zip,intl-${{env.SYMFONY_ICU_VERSION}}"
ini-values: "memory_limit=-1"
php-version: "7.4"
- name: Install dependencies
run: |
echo "::group::composer update"
composer update --no-progress --no-suggest --ansi
echo "::endgroup::"
echo "::group::install phpunit"
./phpunit install
echo "::endgroup::"
- name: Report the ICU version
run: icu-config --version && php -i | grep 'ICU version'
- name: Run intl-data tests
run: ./phpunit --group intl-data -v

View File

@ -302,16 +302,19 @@ class RedirectControllerTest extends TestCase
$baseUrl = '/base';
$port = 80;
$request = $this->createRequestObject($scheme, $host, $port, $baseUrl, 'b.se=zaza');
$request = $this->createRequestObject($scheme, $host, $port, $baseUrl, 'b.se=zaza&f[%2525][%26][%3D][p.c]=d');
$request->attributes = new ParameterBag(['_route_params' => ['base2' => 'zaza']]);
$urlGenerator = $this->getMockBuilder(UrlGeneratorInterface::class)->getMock();
$urlGenerator->expects($this->exactly(2))->method('generate')->willReturn('/test?b.se=zaza&base2=zaza')->with('/test', ['b.se' => 'zaza', 'base2' => 'zaza'], UrlGeneratorInterface::ABSOLUTE_URL);
$urlGenerator->expects($this->exactly(2))
->method('generate')
->willReturn('/test?b.se=zaza&base2=zaza&f[%2525][%26][%3D][p.c]=d')
->with('/test', ['b.se' => 'zaza', 'base2' => 'zaza', 'f' => ['%25' => ['&' => ['=' => ['p.c' => 'd']]]]], UrlGeneratorInterface::ABSOLUTE_URL);
$controller = new RedirectController($urlGenerator);
$this->assertRedirectUrl($controller->redirectAction($request, '/test', false, false, false, true), '/test?b.se=zaza&base2=zaza');
$this->assertRedirectUrl($controller->redirectAction($request, '/test', false, false, false, true), '/test?b.se=zaza&base2=zaza&f[%2525][%26][%3D][p.c]=d');
$request->attributes->set('_route_params', ['base2' => 'zaza', 'route' => '/test', 'ignoreAttributes' => false, 'keepRequestMethod' => false, 'keepQueryParams' => true]);
$this->assertRedirectUrl($controller($request), '/test?b.se=zaza&base2=zaza');
$this->assertRedirectUrl($controller($request), '/test?b.se=zaza&base2=zaza&f[%2525][%26][%3D][p.c]=d');
}
public function testRedirectWithQueryWithRouteParamsOveriding()

View File

@ -32,7 +32,7 @@ interface DenormalizerInterface
* @param string $format Format the given data was extracted from
* @param array $context Options available to the denormalizer
*
* @return object|array
* @return mixed
*
* @throws BadMethodCallException Occurs when the normalizer is not called in an expected context
* @throws InvalidArgumentException Occurs when the arguments are not coherent or not supported

View File

@ -32,7 +32,7 @@ interface SerializerInterface
*
* @param mixed $data
*
* @return object|array
* @return mixed
*/
public function deserialize($data, string $type, string $format, array $context = []);
}