Merge branch '5.2' into 5.x
* 5.2: fix code style [Uid] Hardcode UuidV3 & UuidV5 TYPE conditional constants [Uid] Use the Uuid constructor when reconstructing an Ulid from its RFC-4122 version stop using void in test files parse cookie values containing the equal sign make some time dependent tests more resilient fix code style Remove full head content in HTML to text converter do not break when loading schemas from network paths on Windows apply the sort callback on the whole search result
This commit is contained in:
commit
a7600370fa
@ -24,7 +24,7 @@ class HttpCodeActivationStrategyTest extends TestCase
|
||||
/**
|
||||
* @group legacy
|
||||
*/
|
||||
public function testExclusionsWithoutCodeLegacy(): void
|
||||
public function testExclusionsWithoutCodeLegacy()
|
||||
{
|
||||
$this->expectException('LogicException');
|
||||
new HttpCodeActivationStrategy(new RequestStack(), [['urls' => []]], Logger::WARNING);
|
||||
@ -33,7 +33,7 @@ class HttpCodeActivationStrategyTest extends TestCase
|
||||
/**
|
||||
* @group legacy
|
||||
*/
|
||||
public function testExclusionsWithoutUrlsLegacy(): void
|
||||
public function testExclusionsWithoutUrlsLegacy()
|
||||
{
|
||||
$this->expectException('LogicException');
|
||||
new HttpCodeActivationStrategy(new RequestStack(), [['code' => 404]], Logger::WARNING);
|
||||
@ -44,7 +44,7 @@ class HttpCodeActivationStrategyTest extends TestCase
|
||||
*
|
||||
* @group legacy
|
||||
*/
|
||||
public function testIsActivatedLegacy($url, $record, $expected): void
|
||||
public function testIsActivatedLegacy($url, $record, $expected)
|
||||
{
|
||||
$requestStack = new RequestStack();
|
||||
$requestStack->push(Request::create($url));
|
||||
@ -63,13 +63,13 @@ class HttpCodeActivationStrategyTest extends TestCase
|
||||
self::assertEquals($expected, $strategy->isHandlerActivated($record));
|
||||
}
|
||||
|
||||
public function testExclusionsWithoutCode(): void
|
||||
public function testExclusionsWithoutCode()
|
||||
{
|
||||
$this->expectException('LogicException');
|
||||
new HttpCodeActivationStrategy(new RequestStack(), [['urls' => []]], new ErrorLevelActivationStrategy(Logger::WARNING));
|
||||
}
|
||||
|
||||
public function testExclusionsWithoutUrls(): void
|
||||
public function testExclusionsWithoutUrls()
|
||||
{
|
||||
$this->expectException('LogicException');
|
||||
new HttpCodeActivationStrategy(new RequestStack(), [['code' => 404]], new ErrorLevelActivationStrategy(Logger::WARNING));
|
||||
|
@ -26,7 +26,7 @@ class NotFoundActivationStrategyTest extends TestCase
|
||||
*
|
||||
* @group legacy
|
||||
*/
|
||||
public function testIsActivatedLegacy(string $url, array $record, bool $expected): void
|
||||
public function testIsActivatedLegacy(string $url, array $record, bool $expected)
|
||||
{
|
||||
$requestStack = new RequestStack();
|
||||
$requestStack->push(Request::create($url));
|
||||
@ -39,7 +39,7 @@ class NotFoundActivationStrategyTest extends TestCase
|
||||
/**
|
||||
* @dataProvider isActivatedProvider
|
||||
*/
|
||||
public function testIsActivated(string $url, array $record, bool $expected): void
|
||||
public function testIsActivated(string $url, array $record, bool $expected)
|
||||
{
|
||||
$requestStack = new RequestStack();
|
||||
$requestStack->push(Request::create($url));
|
||||
|
@ -74,6 +74,6 @@ final class BodyRenderer implements BodyRendererInterface
|
||||
return $this->converter->convert($html);
|
||||
}
|
||||
|
||||
return strip_tags(preg_replace('{<(head|style)\b.*?</\1>}i', '', $html));
|
||||
return strip_tags(preg_replace('{<(head|style)\b.*?</\1>}is', '', $html));
|
||||
}
|
||||
}
|
||||
|
@ -37,6 +37,23 @@ class BodyRendererTest extends TestCase
|
||||
$this->assertEquals(str_replace('=', '=3D', $html), $body->getParts()[1]->bodyToString());
|
||||
}
|
||||
|
||||
public function testRenderMultiLineHtmlOnly()
|
||||
{
|
||||
$html = <<<HTML
|
||||
<head>
|
||||
<style type="text/css">
|
||||
css
|
||||
</style>
|
||||
</head>
|
||||
<b>HTML</b>
|
||||
HTML;
|
||||
$email = $this->prepareEmail(null, $html);
|
||||
$body = $email->getBody();
|
||||
$this->assertInstanceOf(AlternativePart::class, $body);
|
||||
$this->assertEquals('HTML', str_replace(["\r", "\n"], '', $body->getParts()[0]->bodyToString()));
|
||||
$this->assertEquals(str_replace(['=', "\n"], ['=3D', "\r\n"], $html), $body->getParts()[1]->bodyToString());
|
||||
}
|
||||
|
||||
public function testRenderHtmlOnlyWithTextSet()
|
||||
{
|
||||
$email = $this->prepareEmail(null, '<b>HTML</b>');
|
||||
|
@ -51,7 +51,7 @@ $container->loadFromExtension('framework', [
|
||||
'fallback' => 'fr',
|
||||
'paths' => ['%kernel.project_dir%/Fixtures/translations'],
|
||||
'cache_dir' => '%kernel.cache_dir%/translations',
|
||||
'enabled_locales' => ['fr', 'en']
|
||||
'enabled_locales' => ['fr', 'en'],
|
||||
],
|
||||
'validation' => [
|
||||
'enabled' => true,
|
||||
|
@ -11,7 +11,7 @@ $container->loadFromExtension('framework', [
|
||||
'multiplier' => 2,
|
||||
'max_delay' => 0,
|
||||
'jitter' => 0.3,
|
||||
]
|
||||
],
|
||||
],
|
||||
'scoped_clients' => [
|
||||
'foo' => [
|
||||
|
@ -8,7 +8,7 @@ $container->loadFromExtension('framework', [
|
||||
'type' => 'state_machine',
|
||||
'marking_store' => [
|
||||
'type' => 'method',
|
||||
'property' => 'state'
|
||||
'property' => 'state',
|
||||
],
|
||||
'supports' => [
|
||||
FrameworkExtensionTest::class,
|
||||
@ -33,9 +33,9 @@ $container->loadFromExtension('framework', [
|
||||
'two',
|
||||
],
|
||||
'to' => [
|
||||
'three'
|
||||
]
|
||||
]
|
||||
'three',
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
|
@ -8,7 +8,7 @@ $container->loadFromExtension('framework', [
|
||||
'type' => 'state_machine',
|
||||
'marking_store' => [
|
||||
'type' => 'method',
|
||||
'property' => 'state'
|
||||
'property' => 'state',
|
||||
],
|
||||
'supports' => [
|
||||
FrameworkExtensionTest::class,
|
||||
@ -36,9 +36,9 @@ $container->loadFromExtension('framework', [
|
||||
'two',
|
||||
],
|
||||
'to' => [
|
||||
'three'
|
||||
]
|
||||
]
|
||||
'three',
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
|
@ -1393,7 +1393,7 @@ abstract class FrameworkExtensionTest extends TestCase
|
||||
$this->assertEquals($expected, $chain->getArguments());
|
||||
}
|
||||
|
||||
public function testRedisTagAwareAdapter(): void
|
||||
public function testRedisTagAwareAdapter()
|
||||
{
|
||||
$container = $this->createContainerFromFile('cache', [], true);
|
||||
|
||||
|
@ -629,7 +629,7 @@ class SecurityExtensionTest extends TestCase
|
||||
yield [['user_checker' => TestUserChecker::class], TestUserChecker::class];
|
||||
}
|
||||
|
||||
public function testConfigureCustomFirewallListener(): void
|
||||
public function testConfigureCustomFirewallListener()
|
||||
{
|
||||
$container = $this->getRawContainer();
|
||||
/** @var SecurityExtension $extension */
|
||||
|
@ -52,7 +52,7 @@ class RequestTest extends TestCase
|
||||
$this->assertEquals(['foo' => 'bar'], $request->getServer(), '->getServer() returns the server parameters of the request');
|
||||
}
|
||||
|
||||
public function testAllParameterValuesAreConvertedToString(): void
|
||||
public function testAllParameterValuesAreConvertedToString()
|
||||
{
|
||||
$parameters = [
|
||||
'foo' => 1,
|
||||
|
@ -15,7 +15,6 @@ use Doctrine\DBAL\Connection;
|
||||
use Doctrine\DBAL\Driver\AbstractMySQLDriver;
|
||||
use Doctrine\DBAL\DriverManager;
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\DBAL\Version;
|
||||
use Psr\Cache\CacheItemPoolInterface;
|
||||
use Symfony\Component\Cache\Adapter\PdoAdapter;
|
||||
use Symfony\Component\Cache\Tests\Traits\PdoPruneableTrait;
|
||||
|
@ -215,7 +215,7 @@ class ArrayNode extends BaseNode implements PrototypeNodeInterface
|
||||
if ($child->isRequired()) {
|
||||
$message = sprintf('The child config "%s" under "%s" must be configured', $name, $this->getPath());
|
||||
if ($child->getInfo()) {
|
||||
$message .= sprintf(": %s", $child->getInfo());
|
||||
$message .= sprintf(': %s', $child->getInfo());
|
||||
} else {
|
||||
$message .= '.';
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ class DirectoryResourceTest extends TestCase
|
||||
{
|
||||
$resource = new DirectoryResource($this->directory);
|
||||
$time = time();
|
||||
sleep(1);
|
||||
usleep(1500000);
|
||||
unlink($this->directory.'/tmp.xml');
|
||||
$this->assertFalse($resource->isFresh($time), '->isFresh() returns false if an existing file is removed');
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ class DummyOutput extends BufferedOutput
|
||||
public function getLogs(): array
|
||||
{
|
||||
$logs = [];
|
||||
foreach (explode(PHP_EOL, trim($this->fetch())) as $message) {
|
||||
foreach (explode(\PHP_EOL, trim($this->fetch())) as $message) {
|
||||
preg_match('/^\[(.*)\] (.*)/', $message, $matches);
|
||||
$logs[] = sprintf('%s %s', $matches[1], $matches[2]);
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ class SignalRegistryTest extends TestCase
|
||||
pcntl_signal(\SIGUSR2, \SIG_DFL);
|
||||
}
|
||||
|
||||
public function testOneCallbackForASignal_signalIsHandled()
|
||||
public function testOneCallbackForASignalSignalIsHandled()
|
||||
{
|
||||
$signalRegistry = new SignalRegistry();
|
||||
|
||||
@ -40,7 +40,7 @@ class SignalRegistryTest extends TestCase
|
||||
$this->assertTrue($isHandled);
|
||||
}
|
||||
|
||||
public function testTwoCallbacksForASignal_bothCallbacksAreCalled()
|
||||
public function testTwoCallbacksForASignalBothCallbacksAreCalled()
|
||||
{
|
||||
$signalRegistry = new SignalRegistry();
|
||||
|
||||
@ -60,7 +60,7 @@ class SignalRegistryTest extends TestCase
|
||||
$this->assertTrue($isHandled2);
|
||||
}
|
||||
|
||||
public function testTwoSignals_signalsAreHandled()
|
||||
public function testTwoSignalsSignalsAreHandled()
|
||||
{
|
||||
$signalRegistry = new SignalRegistry();
|
||||
|
||||
@ -85,7 +85,7 @@ class SignalRegistryTest extends TestCase
|
||||
$this->assertTrue($isHandled2);
|
||||
}
|
||||
|
||||
public function testTwoCallbacksForASignal_previousAndRegisteredCallbacksWereCalled()
|
||||
public function testTwoCallbacksForASignalPreviousAndRegisteredCallbacksWereCalled()
|
||||
{
|
||||
$signalRegistry = new SignalRegistry();
|
||||
|
||||
@ -105,7 +105,7 @@ class SignalRegistryTest extends TestCase
|
||||
$this->assertTrue($isHandled2);
|
||||
}
|
||||
|
||||
public function testTwoCallbacksForASignal_previousCallbackFromAnotherRegistry()
|
||||
public function testTwoCallbacksForASignalPreviousCallbackFromAnotherRegistry()
|
||||
{
|
||||
$signalRegistry1 = new SignalRegistry();
|
||||
|
||||
|
@ -21,7 +21,6 @@ use Symfony\Component\DependencyInjection\Argument\ServiceLocator;
|
||||
use Symfony\Component\DependencyInjection\Argument\ServiceLocatorArgument;
|
||||
use Symfony\Component\DependencyInjection\Compiler\AnalyzeServiceReferencesPass;
|
||||
use Symfony\Component\DependencyInjection\Compiler\CheckCircularReferencesPass;
|
||||
use Symfony\Component\DependencyInjection\Compiler\ServiceReferenceGraphEdge;
|
||||
use Symfony\Component\DependencyInjection\Compiler\ServiceReferenceGraphNode;
|
||||
use Symfony\Component\DependencyInjection\Container;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
|
@ -604,6 +604,8 @@ class XmlFileLoader extends FileLoader
|
||||
array_shift($parts);
|
||||
$locationstart = 'phar:///';
|
||||
}
|
||||
} elseif ('\\' === \DIRECTORY_SEPARATOR && 0 === strpos($location, '\\\\')) {
|
||||
$locationstart = '';
|
||||
}
|
||||
$drive = '\\' === \DIRECTORY_SEPARATOR ? array_shift($parts).'/' : '';
|
||||
$location = $locationstart.$drive.implode('/', array_map('rawurlencode', $parts));
|
||||
|
@ -611,7 +611,13 @@ class Finder implements \IteratorAggregate, \Countable
|
||||
}
|
||||
|
||||
if (1 === \count($this->dirs) && 0 === \count($this->iterators)) {
|
||||
return $this->searchInDirectory($this->dirs[0]);
|
||||
$iterator = $this->searchInDirectory($this->dirs[0]);
|
||||
|
||||
if ($this->sort || $this->reverseSorting) {
|
||||
$iterator = (new Iterator\SortableIterator($iterator, $this->sort, $this->reverseSorting))->getIterator();
|
||||
}
|
||||
|
||||
return $iterator;
|
||||
}
|
||||
|
||||
$iterator = new \AppendIterator();
|
||||
@ -623,6 +629,10 @@ class Finder implements \IteratorAggregate, \Countable
|
||||
$iterator->append($it);
|
||||
}
|
||||
|
||||
if ($this->sort || $this->reverseSorting) {
|
||||
$iterator = (new Iterator\SortableIterator($iterator, $this->sort, $this->reverseSorting))->getIterator();
|
||||
}
|
||||
|
||||
return $iterator;
|
||||
}
|
||||
|
||||
@ -767,11 +777,6 @@ class Finder implements \IteratorAggregate, \Countable
|
||||
$iterator = new Iterator\PathFilterIterator($iterator, $this->paths, $notPaths);
|
||||
}
|
||||
|
||||
if ($this->sort || $this->reverseSorting) {
|
||||
$iteratorAggregate = new Iterator\SortableIterator($iterator, $this->sort, $this->reverseSorting);
|
||||
$iterator = $iteratorAggregate->getIterator();
|
||||
}
|
||||
|
||||
return $iterator;
|
||||
}
|
||||
|
||||
|
@ -832,6 +832,39 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
||||
]), $finder->in(self::$tmpDir)->getIterator());
|
||||
}
|
||||
|
||||
public function testSortAcrossDirectories()
|
||||
{
|
||||
$finder = $this->buildFinder()
|
||||
->in([
|
||||
self::$tmpDir,
|
||||
self::$tmpDir.'/qux',
|
||||
self::$tmpDir.'/foo',
|
||||
])
|
||||
->depth(0)
|
||||
->files()
|
||||
->filter(static function (\SplFileInfo $file): bool {
|
||||
return '' !== $file->getExtension();
|
||||
})
|
||||
->sort(static function (\SplFileInfo $a, \SplFileInfo $b): int {
|
||||
return strcmp($a->getExtension(), $b->getExtension()) ?: strcmp($a->getFilename(), $b->getFilename());
|
||||
})
|
||||
;
|
||||
|
||||
$this->assertOrderedIterator($this->toAbsolute([
|
||||
'qux_0_1.php',
|
||||
'qux_1000_1.php',
|
||||
'qux_1002_0.php',
|
||||
'qux_10_2.php',
|
||||
'qux_12_0.php',
|
||||
'qux_2_0.php',
|
||||
'test.php',
|
||||
'qux/baz_100_1.py',
|
||||
'qux/baz_1_2.py',
|
||||
'test.py',
|
||||
'foo/bar.tmp',
|
||||
]), $finder->getIterator());
|
||||
}
|
||||
|
||||
public function testFilter()
|
||||
{
|
||||
$finder = $this->buildFinder();
|
||||
|
@ -31,7 +31,8 @@ abstract class IteratorTestCase extends TestCase
|
||||
|
||||
protected function assertOrderedIterator($expected, \Traversable $iterator)
|
||||
{
|
||||
$values = array_map(function (\SplFileInfo $fileinfo) { return $fileinfo->getPathname(); }, iterator_to_array($iterator));
|
||||
$values = array_map(function (\SplFileInfo $fileinfo) { return str_replace('/', \DIRECTORY_SEPARATOR, $fileinfo->getPathname()); }, iterator_to_array($iterator));
|
||||
$expected = array_map(function ($path) { return str_replace('/', \DIRECTORY_SEPARATOR, $path); }, $expected);
|
||||
|
||||
$this->assertEquals($expected, array_values($values));
|
||||
}
|
||||
|
@ -214,7 +214,7 @@ class PercentToLocalizedStringTransformer implements DataTransformerInterface
|
||||
{
|
||||
if (null !== $this->scale && null !== $this->roundingMode) {
|
||||
// shift number to maintain the correct scale during rounding
|
||||
$roundingCoef = pow(10, $this->scale);
|
||||
$roundingCoef = 10 ** $this->scale;
|
||||
|
||||
if (self::FRACTIONAL == $this->type) {
|
||||
$roundingCoef *= 100;
|
||||
|
@ -77,7 +77,7 @@ class NumberTypeTest extends BaseTypeTest
|
||||
$this->assertSame('12345,68', $form->createView()->vars['value']);
|
||||
}
|
||||
|
||||
public function testStringInputWithFloatData(): void
|
||||
public function testStringInputWithFloatData()
|
||||
{
|
||||
$this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
|
||||
$this->expectExceptionMessage('Expected a numeric string.');
|
||||
@ -88,7 +88,7 @@ class NumberTypeTest extends BaseTypeTest
|
||||
]);
|
||||
}
|
||||
|
||||
public function testStringInputWithIntData(): void
|
||||
public function testStringInputWithIntData()
|
||||
{
|
||||
$this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
|
||||
$this->expectExceptionMessage('Expected a numeric string.');
|
||||
|
@ -83,6 +83,7 @@ class TraceableResponse implements ResponseInterface, StreamableInterface
|
||||
if (false === $this->content) {
|
||||
return $this->response->getContent($throw);
|
||||
}
|
||||
|
||||
return $this->content = $this->response->getContent(false);
|
||||
} finally {
|
||||
if ($this->event && $this->event->isStarted()) {
|
||||
@ -100,6 +101,7 @@ class TraceableResponse implements ResponseInterface, StreamableInterface
|
||||
if (false === $this->content) {
|
||||
return $this->response->toArray($throw);
|
||||
}
|
||||
|
||||
return $this->content = $this->response->toArray(false);
|
||||
} finally {
|
||||
if ($this->event && $this->event->isStarted()) {
|
||||
|
@ -33,7 +33,7 @@ class MockResponseTest extends TestCase
|
||||
$response->toArray();
|
||||
}
|
||||
|
||||
public function testUrlHttpMethodMockResponse(): void
|
||||
public function testUrlHttpMethodMockResponse()
|
||||
{
|
||||
$responseMock = new MockResponse(json_encode(['foo' => 'bar']));
|
||||
$url = 'https://example.com/some-endpoint';
|
||||
|
@ -251,17 +251,23 @@ class HeaderUtils
|
||||
return $query;
|
||||
}
|
||||
|
||||
private static function groupParts(array $matches, string $separators): array
|
||||
private static function groupParts(array $matches, string $separators, bool $first = true): array
|
||||
{
|
||||
$separator = $separators[0];
|
||||
$partSeparators = substr($separators, 1);
|
||||
|
||||
$i = 0;
|
||||
$partMatches = [];
|
||||
$previousMatchWasSeparator = false;
|
||||
foreach ($matches as $match) {
|
||||
if (isset($match['separator']) && $match['separator'] === $separator) {
|
||||
if (!$first && $previousMatchWasSeparator && isset($match['separator']) && $match['separator'] === $separator) {
|
||||
$previousMatchWasSeparator = true;
|
||||
$partMatches[$i][] = $match;
|
||||
} elseif (isset($match['separator']) && $match['separator'] === $separator) {
|
||||
$previousMatchWasSeparator = true;
|
||||
++$i;
|
||||
} else {
|
||||
$previousMatchWasSeparator = false;
|
||||
$partMatches[$i][] = $match;
|
||||
}
|
||||
}
|
||||
@ -269,12 +275,19 @@ class HeaderUtils
|
||||
$parts = [];
|
||||
if ($partSeparators) {
|
||||
foreach ($partMatches as $matches) {
|
||||
$parts[] = self::groupParts($matches, $partSeparators);
|
||||
$parts[] = self::groupParts($matches, $partSeparators, false);
|
||||
}
|
||||
} else {
|
||||
foreach ($partMatches as $matches) {
|
||||
$parts[] = self::unquote($matches[0][0]);
|
||||
}
|
||||
|
||||
if (!$first && 2 < \count($parts)) {
|
||||
$parts = [
|
||||
$parts[0],
|
||||
implode($separator, \array_slice($parts, 1)),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
return $parts;
|
||||
|
@ -72,7 +72,7 @@ class JsonResponse extends Response
|
||||
*/
|
||||
public static function create($data = null, int $status = 200, array $headers = [])
|
||||
{
|
||||
trigger_deprecation('symfony/http-foundation', '5.1', 'The "%s()" method is deprecated, use "new %s()" instead.', __METHOD__, \get_called_class());
|
||||
trigger_deprecation('symfony/http-foundation', '5.1', 'The "%s()" method is deprecated, use "new %s()" instead.', __METHOD__, static::class);
|
||||
|
||||
return new static($data, $status, $headers);
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ class RedirectResponse extends Response
|
||||
*/
|
||||
public static function create($url = '', int $status = 302, array $headers = [])
|
||||
{
|
||||
trigger_deprecation('symfony/http-foundation', '5.1', 'The "%s()" method is deprecated, use "new %s()" instead.', __METHOD__, \get_called_class());
|
||||
trigger_deprecation('symfony/http-foundation', '5.1', 'The "%s()" method is deprecated, use "new %s()" instead.', __METHOD__, static::class);
|
||||
|
||||
return new static($url, $status, $headers);
|
||||
}
|
||||
|
@ -234,7 +234,7 @@ class Response
|
||||
*/
|
||||
public static function create(?string $content = '', int $status = 200, array $headers = [])
|
||||
{
|
||||
trigger_deprecation('symfony/http-foundation', '5.1', 'The "%s()" method is deprecated, use "new %s()" instead.', __METHOD__, \get_called_class());
|
||||
trigger_deprecation('symfony/http-foundation', '5.1', 'The "%s()" method is deprecated, use "new %s()" instead.', __METHOD__, static::class);
|
||||
|
||||
return new static($content, $status, $headers);
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ class StreamedResponse extends Response
|
||||
*/
|
||||
public static function create($callback = null, int $status = 200, array $headers = [])
|
||||
{
|
||||
trigger_deprecation('symfony/http-foundation', '5.1', 'The "%s()" method is deprecated, use "new %s()" instead.', __METHOD__, \get_called_class());
|
||||
trigger_deprecation('symfony/http-foundation', '5.1', 'The "%s()" method is deprecated, use "new %s()" instead.', __METHOD__, static::class);
|
||||
|
||||
return new static($callback, $status, $headers);
|
||||
}
|
||||
|
@ -326,6 +326,12 @@ class CookieTest extends TestCase
|
||||
|
||||
$cookie = Cookie::fromString('foo', true);
|
||||
$this->assertEquals(Cookie::create('foo', null, 0, '/', null, false, false, false, null), $cookie);
|
||||
|
||||
$cookie = Cookie::fromString('foo_cookie=foo=1&bar=2&baz=3; expires=Tue, 22-Sep-2020 06:27:09 GMT; path=/');
|
||||
$this->assertEquals(Cookie::create('foo_cookie', 'foo=1&bar=2&baz=3', strtotime('Tue, 22-Sep-2020 06:27:09 GMT'), '/', null, false, false, true, null), $cookie);
|
||||
|
||||
$cookie = Cookie::fromString('foo_cookie=foo==; expires=Tue, 22-Sep-2020 06:27:09 GMT; path=/');
|
||||
$this->assertEquals(Cookie::create('foo_cookie', 'foo==', strtotime('Tue, 22-Sep-2020 06:27:09 GMT'), '/', null, false, false, true, null), $cookie);
|
||||
}
|
||||
|
||||
public function testFromStringWithHttpOnly()
|
||||
|
@ -16,33 +16,47 @@ use Symfony\Component\HttpFoundation\HeaderUtils;
|
||||
|
||||
class HeaderUtilsTest extends TestCase
|
||||
{
|
||||
public function testSplit()
|
||||
/**
|
||||
* @dataProvider provideHeaderToSplit
|
||||
*/
|
||||
public function testSplit(array $expected, string $header, string $separator)
|
||||
{
|
||||
$this->assertSame(['foo=123', 'bar'], HeaderUtils::split('foo=123,bar', ','));
|
||||
$this->assertSame(['foo=123', 'bar'], HeaderUtils::split('foo=123, bar', ','));
|
||||
$this->assertSame([['foo=123', 'bar']], HeaderUtils::split('foo=123; bar', ',;'));
|
||||
$this->assertSame([['foo=123'], ['bar']], HeaderUtils::split('foo=123, bar', ',;'));
|
||||
$this->assertSame(['foo', '123, bar'], HeaderUtils::split('foo=123, bar', '='));
|
||||
$this->assertSame(['foo', '123, bar'], HeaderUtils::split(' foo = 123, bar ', '='));
|
||||
$this->assertSame([['foo', '123'], ['bar']], HeaderUtils::split('foo=123, bar', ',='));
|
||||
$this->assertSame([[['foo', '123']], [['bar'], ['foo', '456']]], HeaderUtils::split('foo=123, bar; foo=456', ',;='));
|
||||
$this->assertSame([[['foo', 'a,b;c=d']]], HeaderUtils::split('foo="a,b;c=d"', ',;='));
|
||||
$this->assertSame($expected, HeaderUtils::split($header, $separator));
|
||||
}
|
||||
|
||||
$this->assertSame(['foo', 'bar'], HeaderUtils::split('foo,,,, bar', ','));
|
||||
$this->assertSame(['foo', 'bar'], HeaderUtils::split(',foo, bar,', ','));
|
||||
$this->assertSame(['foo', 'bar'], HeaderUtils::split(' , foo, bar, ', ','));
|
||||
$this->assertSame(['foo bar'], HeaderUtils::split('foo "bar"', ','));
|
||||
$this->assertSame(['foo bar'], HeaderUtils::split('"foo" bar', ','));
|
||||
$this->assertSame(['foo bar'], HeaderUtils::split('"foo" "bar"', ','));
|
||||
public function provideHeaderToSplit(): array
|
||||
{
|
||||
return [
|
||||
[['foo=123', 'bar'], 'foo=123,bar', ','],
|
||||
[['foo=123', 'bar'], 'foo=123, bar', ','],
|
||||
[[['foo=123', 'bar']], 'foo=123; bar', ',;'],
|
||||
[[['foo=123'], ['bar']], 'foo=123, bar', ',;'],
|
||||
[['foo', '123, bar'], 'foo=123, bar', '='],
|
||||
[['foo', '123, bar'], ' foo = 123, bar ', '='],
|
||||
[[['foo', '123'], ['bar']], 'foo=123, bar', ',='],
|
||||
[[[['foo', '123']], [['bar'], ['foo', '456']]], 'foo=123, bar; foo=456', ',;='],
|
||||
[[[['foo', 'a,b;c=d']]], 'foo="a,b;c=d"', ',;='],
|
||||
|
||||
[['foo', 'bar'], 'foo,,,, bar', ','],
|
||||
[['foo', 'bar'], ',foo, bar,', ','],
|
||||
[['foo', 'bar'], ' , foo, bar, ', ','],
|
||||
[['foo bar'], 'foo "bar"', ','],
|
||||
[['foo bar'], '"foo" bar', ','],
|
||||
[['foo bar'], '"foo" "bar"', ','],
|
||||
|
||||
[[['foo_cookie', 'foo=1&bar=2&baz=3'], ['expires', 'Tue, 22-Sep-2020 06:27:09 GMT'], ['path', '/']], 'foo_cookie=foo=1&bar=2&baz=3; expires=Tue, 22-Sep-2020 06:27:09 GMT; path=/', ';='],
|
||||
[[['foo_cookie', 'foo=='], ['expires', 'Tue, 22-Sep-2020 06:27:09 GMT'], ['path', '/']], 'foo_cookie=foo==; expires=Tue, 22-Sep-2020 06:27:09 GMT; path=/', ';='],
|
||||
[[['foo_cookie', 'foo=a=b'], ['expires', 'Tue, 22-Sep-2020 06:27:09 GMT'], ['path', '/']], 'foo_cookie=foo="a=b"; expires=Tue, 22-Sep-2020 06:27:09 GMT; path=/', ';='],
|
||||
|
||||
// These are not a valid header values. We test that they parse anyway,
|
||||
// and that both the valid and invalid parts are returned.
|
||||
$this->assertSame([], HeaderUtils::split('', ','));
|
||||
$this->assertSame([], HeaderUtils::split(',,,', ','));
|
||||
$this->assertSame(['foo', 'bar', 'baz'], HeaderUtils::split('foo, "bar", "baz', ','));
|
||||
$this->assertSame(['foo', 'bar, baz'], HeaderUtils::split('foo, "bar, baz', ','));
|
||||
$this->assertSame(['foo', 'bar, baz\\'], HeaderUtils::split('foo, "bar, baz\\', ','));
|
||||
$this->assertSame(['foo', 'bar, baz\\'], HeaderUtils::split('foo, "bar, baz\\\\', ','));
|
||||
[[], '', ','],
|
||||
[[], ',,,', ','],
|
||||
[['foo', 'bar', 'baz'], 'foo, "bar", "baz', ','],
|
||||
[['foo', 'bar, baz'], 'foo, "bar, baz', ','],
|
||||
[['foo', 'bar, baz\\'], 'foo, "bar, baz\\', ','],
|
||||
[['foo', 'bar, baz\\'], 'foo, "bar, baz\\\\', ','],
|
||||
];
|
||||
}
|
||||
|
||||
public function testCombine()
|
||||
|
@ -24,8 +24,8 @@ use Symfony\Component\Lock\Store\PostgreSqlStore;
|
||||
*/
|
||||
class PostgreSqlDbalStoreTest extends AbstractStoreTest
|
||||
{
|
||||
use SharedLockStoreTestTrait;
|
||||
use BlockingStoreTestTrait;
|
||||
use SharedLockStoreTestTrait;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
|
@ -24,8 +24,8 @@ use Symfony\Component\Lock\Store\PostgreSqlStore;
|
||||
*/
|
||||
class PostgreSqlStoreTest extends AbstractStoreTest
|
||||
{
|
||||
use SharedLockStoreTestTrait;
|
||||
use BlockingStoreTestTrait;
|
||||
use SharedLockStoreTestTrait;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
|
@ -40,7 +40,7 @@ final class SesTransportFactory extends AbstractTransportFactory
|
||||
throw new \LogicException(sprintf('You cannot use "%s" as the HttpClient component or AsyncAws package is not installed. Try running "composer require async-aws/ses".', __CLASS__));
|
||||
}
|
||||
|
||||
trigger_deprecation('symfony/amazon-mailer', '5.1', 'Using the "%s" transport without AsyncAws is deprecated. Try running "composer require async-aws/ses".', $scheme, \get_called_class());
|
||||
trigger_deprecation('symfony/amazon-mailer', '5.1', 'Using the "%s" transport without AsyncAws is deprecated. Try running "composer require async-aws/ses".', $scheme, static::class);
|
||||
|
||||
$user = $this->getUser($dsn);
|
||||
$password = $this->getPassword($dsn);
|
||||
|
@ -22,6 +22,9 @@ use Symfony\Component\Mime\Email;
|
||||
use Symfony\Component\Mime\Exception\InvalidArgumentException;
|
||||
use Symfony\Component\Mime\RawMessage;
|
||||
|
||||
/**
|
||||
* @group time-sensitive
|
||||
*/
|
||||
class SmtpTransportTest extends TestCase
|
||||
{
|
||||
public function testToString()
|
||||
@ -83,7 +86,7 @@ class SmtpTransportTest extends TestCase
|
||||
$this->assertNotContains("NOOP\r\n", $stream->getCommands());
|
||||
|
||||
$stream->clearCommands();
|
||||
sleep(1);
|
||||
usleep(1500000);
|
||||
|
||||
$transport->send(new RawMessage('Message 3'), $envelope);
|
||||
$this->assertContains("NOOP\r\n", $stream->getCommands());
|
||||
|
@ -21,7 +21,7 @@ use Symfony\Component\Messenger\Transport\Serialization\SerializerInterface;
|
||||
|
||||
class AmazonSqsSenderTest extends TestCase
|
||||
{
|
||||
public function testSend(): void
|
||||
public function testSend()
|
||||
{
|
||||
$envelope = new Envelope(new DummyMessage('Oy'));
|
||||
$encoded = ['body' => '...', 'headers' => ['type' => DummyMessage::class]];
|
||||
@ -38,7 +38,7 @@ class AmazonSqsSenderTest extends TestCase
|
||||
$sender->send($envelope);
|
||||
}
|
||||
|
||||
public function testSendWithAmazonSqsFifoStamp(): void
|
||||
public function testSendWithAmazonSqsFifoStamp()
|
||||
{
|
||||
$envelope = (new Envelope(new DummyMessage('Oy')))
|
||||
->with($stamp = new AmazonSqsFifoStamp('testGroup', 'testDeduplicationId'));
|
||||
|
@ -347,7 +347,7 @@ class ConnectionTest extends TestCase
|
||||
$factory->method('createQueue')->will($this->onConsecutiveCalls($amqpQueue0, $amqpQueue1));
|
||||
|
||||
$amqpExchange->expects($this->once())->method('declareExchange');
|
||||
$amqpExchange->expects($this->once())->method('publish')->with('body', 'routing_key', AMQP_NOPARAM, ['headers' => [], 'delivery_mode' => 2, 'timestamp' => time()]);
|
||||
$amqpExchange->expects($this->once())->method('publish')->with('body', 'routing_key', \AMQP_NOPARAM, ['headers' => [], 'delivery_mode' => 2, 'timestamp' => time()]);
|
||||
$amqpQueue0->expects($this->once())->method('declareQueue');
|
||||
$amqpQueue0->expects($this->exactly(2))->method('bind')->withConsecutive(
|
||||
[self::DEFAULT_EXCHANGE_NAME, 'binding_key0'],
|
||||
|
@ -10,7 +10,7 @@ use Symfony\Component\Messenger\Stamp\ErrorDetailsStamp;
|
||||
|
||||
final class AddErrorDetailsStampListenerTest extends TestCase
|
||||
{
|
||||
public function testExceptionDetailsAreAdded(): void
|
||||
public function testExceptionDetailsAreAdded()
|
||||
{
|
||||
$listener = new AddErrorDetailsStampListener();
|
||||
|
||||
|
@ -25,7 +25,7 @@ use Symfony\Component\Serializer\Serializer as SymfonySerializer;
|
||||
|
||||
class ErrorDetailsStampTest extends TestCase
|
||||
{
|
||||
public function testGetters(): void
|
||||
public function testGetters()
|
||||
{
|
||||
$exception = new \Exception('exception message');
|
||||
$flattenException = FlattenException::createFromThrowable($exception);
|
||||
@ -37,7 +37,7 @@ class ErrorDetailsStampTest extends TestCase
|
||||
$this->assertEquals($flattenException, $stamp->getFlattenException());
|
||||
}
|
||||
|
||||
public function testUnwrappingHandlerFailedException(): void
|
||||
public function testUnwrappingHandlerFailedException()
|
||||
{
|
||||
$wrappedException = new \Exception('I am inside', 123);
|
||||
$envelope = new Envelope(new \stdClass());
|
||||
@ -52,7 +52,7 @@ class ErrorDetailsStampTest extends TestCase
|
||||
$this->assertEquals($flattenException, $stamp->getFlattenException());
|
||||
}
|
||||
|
||||
public function testDeserialization(): void
|
||||
public function testDeserialization()
|
||||
{
|
||||
$exception = new \Exception('exception message');
|
||||
$stamp = ErrorDetailsStamp::create($exception);
|
||||
|
@ -21,7 +21,7 @@ use Symfony\Component\Notifier\Transport\Transports;
|
||||
|
||||
class TransportsTest extends TestCase
|
||||
{
|
||||
public function testSendToTransportDefinedByMessage(): void
|
||||
public function testSendToTransportDefinedByMessage()
|
||||
{
|
||||
$transports = new Transports([
|
||||
'one' => $one = $this->createMock(TransportInterface::class),
|
||||
@ -39,7 +39,7 @@ class TransportsTest extends TestCase
|
||||
$this->assertSame('one', $sentMessage->getTransport());
|
||||
}
|
||||
|
||||
public function testSendToFirstSupportedTransportIfMessageDoesNotDefineATransport(): void
|
||||
public function testSendToFirstSupportedTransportIfMessageDoesNotDefineATransport()
|
||||
{
|
||||
$transports = new Transports([
|
||||
'one' => $one = $this->createMock(TransportInterface::class),
|
||||
@ -63,7 +63,7 @@ class TransportsTest extends TestCase
|
||||
$this->assertSame('two', $sentMessage->getTransport());
|
||||
}
|
||||
|
||||
public function testThrowExceptionIfNoSupportedTransportWasFound(): void
|
||||
public function testThrowExceptionIfNoSupportedTransportWasFound()
|
||||
{
|
||||
$transports = new Transports([
|
||||
'one' => $one = $this->createMock(TransportInterface::class),
|
||||
@ -79,7 +79,7 @@ class TransportsTest extends TestCase
|
||||
$transports->send($message);
|
||||
}
|
||||
|
||||
public function testThrowExceptionIfTransportDefinedByMessageIsNotSupported(): void
|
||||
public function testThrowExceptionIfTransportDefinedByMessageIsNotSupported()
|
||||
{
|
||||
$transports = new Transports([
|
||||
'one' => $one = $this->createMock(TransportInterface::class),
|
||||
|
@ -55,7 +55,7 @@ abstract class TransportFactoryTestCase extends TestCase
|
||||
/**
|
||||
* @dataProvider supportsProvider
|
||||
*/
|
||||
public function testSupports(bool $expected, string $dsn): void
|
||||
public function testSupports(bool $expected, string $dsn)
|
||||
{
|
||||
$factory = $this->createFactory();
|
||||
|
||||
@ -65,7 +65,7 @@ abstract class TransportFactoryTestCase extends TestCase
|
||||
/**
|
||||
* @dataProvider createProvider
|
||||
*/
|
||||
public function testCreate(string $expected, string $dsn): void
|
||||
public function testCreate(string $expected, string $dsn)
|
||||
{
|
||||
$factory = $this->createFactory();
|
||||
$transport = $factory->create(Dsn::fromString($dsn));
|
||||
@ -76,7 +76,7 @@ abstract class TransportFactoryTestCase extends TestCase
|
||||
/**
|
||||
* @dataProvider unsupportedSchemeProvider
|
||||
*/
|
||||
public function testUnsupportedSchemeException(string $dsn, string $message = null): void
|
||||
public function testUnsupportedSchemeException(string $dsn, string $message = null)
|
||||
{
|
||||
$factory = $this->createFactory();
|
||||
|
||||
@ -93,7 +93,7 @@ abstract class TransportFactoryTestCase extends TestCase
|
||||
/**
|
||||
* @dataProvider incompleteDsnProvider
|
||||
*/
|
||||
public function testIncompleteDsnException(string $dsn, string $message = null): void
|
||||
public function testIncompleteDsnException(string $dsn, string $message = null)
|
||||
{
|
||||
$factory = $this->createFactory();
|
||||
|
||||
|
@ -47,7 +47,7 @@ abstract class TransportTestCase extends TestCase
|
||||
/**
|
||||
* @dataProvider toStringProvider
|
||||
*/
|
||||
public function testToString(string $expected, TransportInterface $transport): void
|
||||
public function testToString(string $expected, TransportInterface $transport)
|
||||
{
|
||||
$this->assertSame($expected, (string) $transport);
|
||||
}
|
||||
@ -55,7 +55,7 @@ abstract class TransportTestCase extends TestCase
|
||||
/**
|
||||
* @dataProvider supportedMessagesProvider
|
||||
*/
|
||||
public function testSupportedMessages(MessageInterface $message, ?TransportInterface $transport = null): void
|
||||
public function testSupportedMessages(MessageInterface $message, ?TransportInterface $transport = null)
|
||||
{
|
||||
if (null === $transport) {
|
||||
$transport = $this->createTransport();
|
||||
@ -67,7 +67,7 @@ abstract class TransportTestCase extends TestCase
|
||||
/**
|
||||
* @dataProvider unsupportedMessagesProvider
|
||||
*/
|
||||
public function testUnsupportedMessages(MessageInterface $message, ?TransportInterface $transport = null): void
|
||||
public function testUnsupportedMessages(MessageInterface $message, ?TransportInterface $transport = null)
|
||||
{
|
||||
if (null === $transport) {
|
||||
$transport = $this->createTransport();
|
||||
@ -79,7 +79,7 @@ abstract class TransportTestCase extends TestCase
|
||||
/**
|
||||
* @dataProvider unsupportedMessagesProvider
|
||||
*/
|
||||
public function testUnsupportedMessagesTrowUnsupportedMessageTypeExceptionWhenSend(MessageInterface $message, ?TransportInterface $transport = null): void
|
||||
public function testUnsupportedMessagesTrowUnsupportedMessageTypeExceptionWhenSend(MessageInterface $message, ?TransportInterface $transport = null)
|
||||
{
|
||||
if (null === $transport) {
|
||||
$transport = $this->createTransport();
|
||||
@ -90,7 +90,7 @@ abstract class TransportTestCase extends TestCase
|
||||
$transport->send($message);
|
||||
}
|
||||
|
||||
public function testCanSetCustomHost(): void
|
||||
public function testCanSetCustomHost()
|
||||
{
|
||||
$transport = $this->createTransport();
|
||||
|
||||
@ -99,7 +99,7 @@ abstract class TransportTestCase extends TestCase
|
||||
$this->assertStringContainsString(sprintf('://%s', $customHost), (string) $transport);
|
||||
}
|
||||
|
||||
public function testCanSetCustomPort(): void
|
||||
public function testCanSetCustomPort()
|
||||
{
|
||||
$transport = $this->createTransport();
|
||||
|
||||
@ -111,7 +111,7 @@ abstract class TransportTestCase extends TestCase
|
||||
$this->assertMatchesRegularExpression(sprintf('/^.*\/\/.*\:%s.*$/', $customPort), (string) $transport);
|
||||
}
|
||||
|
||||
public function testCanSetCustomHostAndPort(): void
|
||||
public function testCanSetCustomHostAndPort()
|
||||
{
|
||||
$transport = $this->createTransport();
|
||||
|
||||
|
@ -41,7 +41,7 @@ class ConstructorExtractorTest extends TestCase
|
||||
$this->assertEquals([new Type(Type::BUILTIN_TYPE_STRING)], $this->extractor->getTypes('Foo', 'bar', []));
|
||||
}
|
||||
|
||||
public function testGetTypes_ifNoExtractors()
|
||||
public function testGetTypesIfNoExtractors()
|
||||
{
|
||||
$extractor = new ConstructorExtractor([]);
|
||||
$this->assertNull($extractor->getTypes('Foo', 'bar', []));
|
||||
|
@ -122,7 +122,7 @@ final class PhpDocTypeHelper
|
||||
$collectionKeyType = $this->getTypes($type->getKeyType())[0];
|
||||
|
||||
$collectionValueTypes = $this->getTypes($type->getValueType());
|
||||
if (\count($collectionValueTypes) != 1) {
|
||||
if (1 != \count($collectionValueTypes)) {
|
||||
// the Type class does not support union types yet, so assume that no type was defined
|
||||
$collectionValueType = null;
|
||||
} else {
|
||||
|
@ -35,7 +35,7 @@ abstract class AbstractAuthenticator implements AuthenticatorInterface
|
||||
public function createAuthenticatedToken(PassportInterface $passport, string $firewallName): TokenInterface
|
||||
{
|
||||
if (!$passport instanceof UserPassportInterface) {
|
||||
throw new LogicException(sprintf('Passport does not contain a user, overwrite "createAuthenticatedToken()" in "%s" to create a custom authenticated token.', \get_class($this)));
|
||||
throw new LogicException(sprintf('Passport does not contain a user, overwrite "createAuthenticatedToken()" in "%s" to create a custom authenticated token.', static::class));
|
||||
}
|
||||
|
||||
return new PostAuthenticationToken($passport->getUser(), $firewallName, $passport->getUser()->getRoles());
|
||||
|
@ -156,7 +156,7 @@ class AuthenticatorManagerTest extends TestCase
|
||||
yield [false];
|
||||
}
|
||||
|
||||
public function testAuthenticateRequestCanModifyTokenFromEvent(): void
|
||||
public function testAuthenticateRequestCanModifyTokenFromEvent()
|
||||
{
|
||||
$authenticator = $this->createAuthenticator();
|
||||
$this->request->attributes->set('_security_authenticators', [$authenticator]);
|
||||
@ -191,7 +191,7 @@ class AuthenticatorManagerTest extends TestCase
|
||||
$manager->authenticateUser($this->user, $authenticator, $this->request);
|
||||
}
|
||||
|
||||
public function testAuthenticateUserCanModifyTokenFromEvent(): void
|
||||
public function testAuthenticateUserCanModifyTokenFromEvent()
|
||||
{
|
||||
$authenticator = $this->createAuthenticator();
|
||||
$authenticator->expects($this->any())->method('createAuthenticatedToken')->willReturn($this->token);
|
||||
|
@ -7,9 +7,9 @@ use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory;
|
||||
use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryCompiler;
|
||||
use Symfony\Component\Serializer\Mapping\Loader\AnnotationLoader;
|
||||
use Symfony\Component\Serializer\Tests\Fixtures\Dummy;
|
||||
use Symfony\Component\Serializer\Tests\Fixtures\Annotations\MaxDepthDummy;
|
||||
use Symfony\Component\Serializer\Tests\Fixtures\Annotations\SerializedNameDummy;
|
||||
use Symfony\Component\Serializer\Tests\Fixtures\Dummy;
|
||||
|
||||
final class ClassMetadataFactoryCompilerTest extends TestCase
|
||||
{
|
||||
|
@ -7,8 +7,8 @@ use Symfony\Component\Serializer\Mapping\AttributeMetadata;
|
||||
use Symfony\Component\Serializer\Mapping\ClassMetadata;
|
||||
use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface;
|
||||
use Symfony\Component\Serializer\Mapping\Factory\CompiledClassMetadataFactory;
|
||||
use Symfony\Component\Serializer\Tests\Fixtures\Dummy;
|
||||
use Symfony\Component\Serializer\Tests\Fixtures\Annotations\SerializedNameDummy;
|
||||
use Symfony\Component\Serializer\Tests\Fixtures\Dummy;
|
||||
|
||||
/**
|
||||
* @author Fabien Bourigault <bourigaultfabien@gmail.com>
|
||||
|
@ -18,8 +18,8 @@ use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface;
|
||||
use Symfony\Component\Serializer\Mapping\Loader\AnnotationLoader;
|
||||
use Symfony\Component\Serializer\NameConverter\MetadataAwareNameConverter;
|
||||
use Symfony\Component\Serializer\NameConverter\NameConverterInterface;
|
||||
use Symfony\Component\Serializer\Tests\Fixtures\OtherSerializedNameDummy;
|
||||
use Symfony\Component\Serializer\Tests\Fixtures\Annotations\SerializedNameDummy;
|
||||
use Symfony\Component\Serializer\Tests\Fixtures\OtherSerializedNameDummy;
|
||||
|
||||
/**
|
||||
* @author Fabien Bourigault <bourigaultfabien@gmail.com>
|
||||
|
@ -14,8 +14,8 @@ use Symfony\Component\Serializer\Normalizer\ObjectNormalizer;
|
||||
use Symfony\Component\Serializer\Normalizer\PropertyNormalizer;
|
||||
use Symfony\Component\Serializer\Serializer;
|
||||
use Symfony\Component\Serializer\Tests\Fixtures\AbstractNormalizerDummy;
|
||||
use Symfony\Component\Serializer\Tests\Fixtures\Dummy;
|
||||
use Symfony\Component\Serializer\Tests\Fixtures\Annotations\IgnoreDummy;
|
||||
use Symfony\Component\Serializer\Tests\Fixtures\Dummy;
|
||||
use Symfony\Component\Serializer\Tests\Fixtures\NullableConstructorArgumentDummy;
|
||||
use Symfony\Component\Serializer\Tests\Fixtures\StaticConstructorDummy;
|
||||
use Symfony\Component\Serializer\Tests\Fixtures\StaticConstructorNormalizer;
|
||||
|
@ -27,8 +27,8 @@ use Symfony\Component\Serializer\Normalizer\GetSetMethodNormalizer;
|
||||
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
|
||||
use Symfony\Component\Serializer\Serializer;
|
||||
use Symfony\Component\Serializer\SerializerInterface;
|
||||
use Symfony\Component\Serializer\Tests\Fixtures\CircularReferenceDummy;
|
||||
use Symfony\Component\Serializer\Tests\Fixtures\Annotations\GroupDummy;
|
||||
use Symfony\Component\Serializer\Tests\Fixtures\CircularReferenceDummy;
|
||||
use Symfony\Component\Serializer\Tests\Fixtures\SiblingHolder;
|
||||
use Symfony\Component\Serializer\Tests\Normalizer\Features\CallbacksTestTrait;
|
||||
use Symfony\Component\Serializer\Tests\Normalizer\Features\CircularReferenceTestTrait;
|
||||
|
@ -25,9 +25,9 @@ use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
|
||||
use Symfony\Component\Serializer\Normalizer\PropertyNormalizer;
|
||||
use Symfony\Component\Serializer\Serializer;
|
||||
use Symfony\Component\Serializer\SerializerInterface;
|
||||
use Symfony\Component\Serializer\Tests\Fixtures\Dummy;
|
||||
use Symfony\Component\Serializer\Tests\Fixtures\Annotations\GroupDummy;
|
||||
use Symfony\Component\Serializer\Tests\Fixtures\Annotations\GroupDummyChild;
|
||||
use Symfony\Component\Serializer\Tests\Fixtures\Dummy;
|
||||
use Symfony\Component\Serializer\Tests\Fixtures\Php74Dummy;
|
||||
use Symfony\Component\Serializer\Tests\Fixtures\PropertyCircularReferenceDummy;
|
||||
use Symfony\Component\Serializer\Tests\Fixtures\PropertySiblingHolder;
|
||||
|
@ -3,7 +3,6 @@
|
||||
namespace Symfony\Component\Serializer\Tests\Normalizer;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Serializer\Exception\InvalidArgumentException;
|
||||
use Symfony\Component\Serializer\Normalizer\UidNormalizer;
|
||||
use Symfony\Component\Uid\AbstractUid;
|
||||
use Symfony\Component\Uid\Ulid;
|
||||
|
@ -20,7 +20,7 @@ final class PseudoLocalizationTranslatorTest extends TestCase
|
||||
/**
|
||||
* @dataProvider provideTrans
|
||||
*/
|
||||
public function testTrans(string $expected, string $input, array $options = []): void
|
||||
public function testTrans(string $expected, string $input, array $options = [])
|
||||
{
|
||||
mt_srand(987);
|
||||
$this->assertSame($expected, (new PseudoLocalizationTranslator(new IdentityTranslator(), $options))->trans($input));
|
||||
@ -50,7 +50,7 @@ final class PseudoLocalizationTranslatorTest extends TestCase
|
||||
/**
|
||||
* @dataProvider provideInvalidExpansionFactor
|
||||
*/
|
||||
public function testInvalidExpansionFactor(float $expansionFactor): void
|
||||
public function testInvalidExpansionFactor(float $expansionFactor)
|
||||
{
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
$this->expectExceptionMessage('The expansion factor must be greater than or equal to 1.');
|
||||
|
@ -18,7 +18,7 @@ namespace Symfony\Component\Uid;
|
||||
*/
|
||||
class NilUuid extends Uuid
|
||||
{
|
||||
protected const TYPE = \UUID_TYPE_NULL;
|
||||
protected const TYPE = -1;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
@ -59,7 +59,7 @@ class Ulid extends AbstractUid
|
||||
public static function fromString(string $ulid): parent
|
||||
{
|
||||
if (36 === \strlen($ulid) && Uuid::isValid($ulid)) {
|
||||
$ulid = Uuid::fromString($ulid)->toBinary();
|
||||
$ulid = (new Uuid($ulid))->toBinary();
|
||||
} elseif (22 === \strlen($ulid) && 22 === strspn($ulid, BinaryUtil::BASE58[''])) {
|
||||
$ulid = BinaryUtil::fromBase($ulid, BinaryUtil::BASE58);
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ namespace Symfony\Component\Uid;
|
||||
*/
|
||||
class Uuid extends AbstractUid
|
||||
{
|
||||
protected const TYPE = \UUID_TYPE_DEFAULT;
|
||||
protected const TYPE = 0;
|
||||
|
||||
public function __construct(string $uuid)
|
||||
{
|
||||
|
@ -20,7 +20,7 @@ namespace Symfony\Component\Uid;
|
||||
*/
|
||||
class UuidV1 extends Uuid
|
||||
{
|
||||
protected const TYPE = \UUID_TYPE_TIME;
|
||||
protected const TYPE = 1;
|
||||
|
||||
public function __construct(string $uuid = null)
|
||||
{
|
||||
|
@ -22,5 +22,5 @@ namespace Symfony\Component\Uid;
|
||||
*/
|
||||
class UuidV3 extends Uuid
|
||||
{
|
||||
protected const TYPE = \UUID_TYPE_MD5;
|
||||
protected const TYPE = 3;
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ namespace Symfony\Component\Uid;
|
||||
*/
|
||||
class UuidV4 extends Uuid
|
||||
{
|
||||
protected const TYPE = \UUID_TYPE_RANDOM;
|
||||
protected const TYPE = 4;
|
||||
|
||||
public function __construct(string $uuid = null)
|
||||
{
|
||||
|
@ -22,5 +22,5 @@ namespace Symfony\Component\Uid;
|
||||
*/
|
||||
class UuidV5 extends Uuid
|
||||
{
|
||||
protected const TYPE = \UUID_TYPE_SHA1;
|
||||
protected const TYPE = 5;
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ class Regex extends Constraint
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @param string|array $pattern The pattern to evaluate or an array of options.
|
||||
* @param string|array $pattern The pattern to evaluate or an array of options
|
||||
*/
|
||||
public function __construct(
|
||||
$pattern,
|
||||
|
@ -44,7 +44,7 @@ class Timezone extends Constraint
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @param int|array|null $zone A combination of {@see \DateTimeZone} class constants or a set of options.
|
||||
* @param int|array|null $zone A combination of {@see \DateTimeZone} class constants or a set of options
|
||||
*/
|
||||
public function __construct(
|
||||
$zone = null,
|
||||
|
@ -34,7 +34,7 @@ class Type extends Constraint
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @param string|array $type One ore multiple types to validate against or a set of options.
|
||||
* @param string|array $type One ore multiple types to validate against or a set of options
|
||||
*/
|
||||
public function __construct($type, string $message = null, array $groups = null, $payload = null, array $options = [])
|
||||
{
|
||||
|
@ -26,7 +26,7 @@ use Symfony\Component\Validator\Tests\Dummy\DummyClassOne;
|
||||
*/
|
||||
class DebugCommandTest extends TestCase
|
||||
{
|
||||
public function testOutputWithClassArgument(): void
|
||||
public function testOutputWithClassArgument()
|
||||
{
|
||||
$validator = $this->createMock(MetadataFactoryInterface::class);
|
||||
$classMetadata = $this->createMock(ClassMetadataInterface::class);
|
||||
@ -90,7 +90,7 @@ TXT
|
||||
);
|
||||
}
|
||||
|
||||
public function testOutputWithPathArgument(): void
|
||||
public function testOutputWithPathArgument()
|
||||
{
|
||||
$validator = $this->createMock(MetadataFactoryInterface::class);
|
||||
$classMetadata = $this->createMock(ClassMetadataInterface::class);
|
||||
@ -171,7 +171,7 @@ TXT
|
||||
);
|
||||
}
|
||||
|
||||
public function testOutputWithInvalidClassArgument(): void
|
||||
public function testOutputWithInvalidClassArgument()
|
||||
{
|
||||
$validator = $this->createMock(MetadataFactoryInterface::class);
|
||||
|
||||
|
@ -161,7 +161,6 @@ class LanguageValidatorTest extends ConstraintValidatorTestCase
|
||||
eval('return new \Symfony\Component\Validator\Constraints\Language(alpha3: true, message: "myMessage");')
|
||||
);
|
||||
|
||||
|
||||
$this->buildViolation('myMessage')
|
||||
->setParameter('{{ value }}', '"DE"')
|
||||
->setCode(Language::NO_SUCH_LANGUAGE_ERROR)
|
||||
|
@ -17,10 +17,11 @@ class ConstraintChoiceWithPreset extends Choice
|
||||
{
|
||||
public $type;
|
||||
|
||||
public function __construct(string $type) {
|
||||
public function __construct(string $type)
|
||||
{
|
||||
parent::__construct($type);
|
||||
|
||||
if ($this->type === 'A') {
|
||||
if ('A' === $this->type) {
|
||||
$this->choices = ['A', 'B', 'C'];
|
||||
} else {
|
||||
$this->choices = ['D', 'E', 'F'];
|
||||
|
Reference in New Issue
Block a user