Merge branch '4.3' into 4.4

* 4.3:
  [FrameworkBundle] [SecurityBundle] Rename internal WebTestCase to avoid confusion
  ignore not existing translator service
  [FrameworkBundle] [SecurityBundle] Rename internal WebTestCase to avoid confusion
  revert private properties handling
  [HttpFoundation] Fix URLs
  [VarDumper] finish PHP 7.4 support and add tests
  [VarDumper] Use \ReflectionReference for determining if a key is a reference (php >= 7.4)
  Ignore missing translation dependency in FrameworkBundle
  [Security/Http] Don't mark AbstractAuthenticationListener as internal
  Remove dead tests fixtures
  Remove more dead tests fixtures
  [Mime] Add missing changelog entry for BC-break
  [Messenger] fix transport_name option not passing validation
  Remove dead tests fixtures
  [Debug][ExceptionHandler] Add tests for custom handlers
This commit is contained in:
Nicolas Grekas 2019-07-23 13:21:51 +02:00
commit a688787449
74 changed files with 201 additions and 514 deletions

View File

@ -1243,7 +1243,7 @@ class FrameworkExtension extends Extension
if (interface_exists(TranslatorInterface::class) && class_exists(LegacyTranslatorProxy::class)) {
$calls = $validatorBuilder->getMethodCalls();
$calls[1] = ['setTranslator', [new Definition(LegacyTranslatorProxy::class, [new Reference('translator')])]];
$calls[1] = ['setTranslator', [new Definition(LegacyTranslatorProxy::class, [new Reference('translator', ContainerInterface::IGNORE_ON_INVALID_REFERENCE)])]];
$validatorBuilder->setMethodCalls($calls);
}

View File

@ -23,7 +23,7 @@
<argument type="service" id="validator.validator_factory" />
</call>
<call method="setTranslator">
<argument type="service" id="translator" />
<argument type="service" id="translator" on-invalid="ignore" />
</call>
<call method="setTranslationDomain">
<argument>%validator.translation_domain%</argument>

View File

@ -913,9 +913,9 @@ abstract class FrameworkExtensionTest extends TestCase
$this->assertEquals([new Reference('validator.validator_factory')], $calls[0][1]);
$this->assertSame('setTranslator', $calls[1][0]);
if (interface_exists(TranslatorInterface::class) && class_exists(LegacyTranslatorProxy::class)) {
$this->assertEquals([new Definition(LegacyTranslatorProxy::class, [new Reference('translator')])], $calls[1][1]);
$this->assertEquals([new Definition(LegacyTranslatorProxy::class, [new Reference('translator', ContainerInterface::IGNORE_ON_INVALID_REFERENCE)])], $calls[1][1]);
} else {
$this->assertEquals([new Reference('translator')], $calls[1][1]);
$this->assertEquals([new Reference('translator', ContainerInterface::IGNORE_ON_INVALID_REFERENCE)], $calls[1][1]);
}
$this->assertSame('setTranslationDomain', $calls[2][0]);
$this->assertSame(['%validator.translation_domain%'], $calls[2][1]);

View File

@ -1,21 +0,0 @@
<?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 TestBundle\Fabpot\FooBundle\Controller;
/**
* DefaultController.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class DefaultController
{
}

View File

@ -1,30 +0,0 @@
<?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 TestBundle\Fabpot\FooBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;
/**
* Bundle.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class FabpotFooBundle extends Bundle
{
/**
* {@inheritdoc}
*/
public function getParent()
{
return 'SensioFooBundle';
}
}

View File

@ -14,7 +14,7 @@ namespace Symfony\Bundle\FrameworkBundle\Tests\Functional;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase as BaseWebTestCase;
use Symfony\Component\Filesystem\Filesystem;
class WebTestCase extends BaseWebTestCase
abstract class AbstractWebTestCase extends BaseWebTestCase
{
public static function assertRedirect($response, $location)
{

View File

@ -11,7 +11,7 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\Functional;
class AnnotatedControllerTest extends WebTestCase
class AnnotatedControllerTest extends AbstractWebTestCase
{
/**
* @dataProvider getRoutes

View File

@ -19,7 +19,7 @@ use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\HttpKernel\Debug\TraceableEventDispatcher;
use Symfony\Component\Templating\EngineInterface as ComponentEngineInterface;
class AutowiringTypesTest extends WebTestCase
class AutowiringTypesTest extends AbstractWebTestCase
{
public function testAnnotationReaderAutowiring()
{

View File

@ -18,7 +18,7 @@ use Symfony\Component\Console\Tester\CommandTester;
/**
* @group functional
*/
class CachePoolClearCommandTest extends WebTestCase
class CachePoolClearCommandTest extends AbstractWebTestCase
{
protected function setUp()
{

View File

@ -16,7 +16,7 @@ use Symfony\Component\Cache\Adapter\RedisAdapter;
use Symfony\Component\Cache\Adapter\TagAwareAdapter;
use Symfony\Component\Cache\Exception\InvalidArgumentException;
class CachePoolsTest extends WebTestCase
class CachePoolsTest extends AbstractWebTestCase
{
public function testCachePools()
{

View File

@ -19,7 +19,7 @@ use Symfony\Component\Console\Tester\CommandTester;
/**
* @group functional
*/
class ConfigDebugCommandTest extends WebTestCase
class ConfigDebugCommandTest extends AbstractWebTestCase
{
private $application;

View File

@ -19,7 +19,7 @@ use Symfony\Component\Console\Tester\CommandTester;
/**
* @group functional
*/
class ConfigDumpReferenceCommandTest extends WebTestCase
class ConfigDumpReferenceCommandTest extends AbstractWebTestCase
{
private $application;

View File

@ -18,7 +18,7 @@ use Symfony\Component\Console\Tester\ApplicationTester;
/**
* @group functional
*/
class ContainerDebugCommandTest extends WebTestCase
class ContainerDebugCommandTest extends AbstractWebTestCase
{
public function testDumpContainerIfNotExists()
{

View File

@ -14,7 +14,7 @@ namespace Symfony\Bundle\FrameworkBundle\Tests\Functional;
/**
* Checks that the container compiles correctly when all the bundle features are enabled.
*/
class ContainerDumpTest extends WebTestCase
class ContainerDumpTest extends AbstractWebTestCase
{
public function testContainerCompilationInDebug()
{

View File

@ -17,7 +17,7 @@ use Symfony\Component\Console\Tester\ApplicationTester;
/**
* @group functional
*/
class DebugAutowiringCommandTest extends WebTestCase
class DebugAutowiringCommandTest extends AbstractWebTestCase
{
public function testBasicFunctionality()
{

View File

@ -11,7 +11,7 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\Functional;
class FragmentTest extends WebTestCase
class FragmentTest extends AbstractWebTestCase
{
/**
* @dataProvider getConfigs

View File

@ -11,7 +11,7 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\Functional;
class ProfilerTest extends WebTestCase
class ProfilerTest extends AbstractWebTestCase
{
/**
* @dataProvider getConfigs

View File

@ -13,7 +13,7 @@ namespace Symfony\Bundle\FrameworkBundle\Tests\Functional;
use Symfony\Component\PropertyInfo\Type;
class PropertyInfoTest extends WebTestCase
class PropertyInfoTest extends AbstractWebTestCase
{
public function testPhpDocPriority()
{

View File

@ -17,7 +17,7 @@ use Symfony\Component\Console\Tester\CommandTester;
/**
* @group functional
*/
class RouterDebugCommandTest extends WebTestCase
class RouterDebugCommandTest extends AbstractWebTestCase
{
private $application;

View File

@ -14,7 +14,7 @@ namespace Symfony\Bundle\FrameworkBundle\Tests\Functional;
/**
* @author Kévin Dunglas <dunglas@gmail.com>
*/
class SerializerTest extends WebTestCase
class SerializerTest extends AbstractWebTestCase
{
public function testDeserializeArrayOfObject()
{

View File

@ -11,7 +11,7 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\Functional;
class SessionTest extends WebTestCase
class SessionTest extends AbstractWebTestCase
{
/**
* Tests session attributes persist.

View File

@ -11,7 +11,7 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\Functional;
class SubRequestsTest extends WebTestCase
class SubRequestsTest extends AbstractWebTestCase
{
public function testStateAfterSubRequest()
{

View File

@ -18,7 +18,7 @@ use Symfony\Bundle\FrameworkBundle\Tests\Functional\Bundle\TestBundle\TestServic
use Symfony\Bundle\FrameworkBundle\Tests\Functional\Bundle\TestBundle\TestServiceContainer\UnusedPrivateService;
use Symfony\Component\DependencyInjection\ContainerInterface;
class TestServiceContainerTest extends WebTestCase
class TestServiceContainerTest extends AbstractWebTestCase
{
public function testThatPrivateServicesAreUnavailableIfTestConfigIsDisabled()
{

View File

@ -12,10 +12,10 @@
namespace Symfony\Bundle\FrameworkBundle\Tests;
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
use Symfony\Bundle\FrameworkBundle\Tests\Functional\WebTestCase;
use Symfony\Bundle\FrameworkBundle\Tests\Functional\AbstractWebTestCase;
use Symfony\Component\HttpFoundation\Response;
class KernelBrowserTest extends WebTestCase
class KernelBrowserTest extends AbstractWebTestCase
{
public function testRebootKernelBetweenRequests()
{

View File

@ -148,10 +148,3 @@ class AddSecurityVotersPassTest extends TestCase
$compilerPass->process($container);
}
}
class VoterWithoutInterface
{
public function vote()
{
}
}

View File

@ -14,7 +14,7 @@ namespace Symfony\Bundle\SecurityBundle\Tests\Functional;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase as BaseWebTestCase;
use Symfony\Component\Filesystem\Filesystem;
class WebTestCase extends BaseWebTestCase
abstract class AbstractWebTestCase extends BaseWebTestCase
{
public static function assertRedirect($response, $location)
{

View File

@ -11,7 +11,7 @@
namespace Symfony\Bundle\SecurityBundle\Tests\Functional;
class AuthenticationCommencingTest extends WebTestCase
class AuthenticationCommencingTest extends AbstractWebTestCase
{
public function testAuthenticationIsCommencingIfAccessDeniedExceptionIsWrapped()
{

View File

@ -14,7 +14,7 @@ namespace Symfony\Bundle\SecurityBundle\Tests\Functional;
use Symfony\Component\Security\Core\Authorization\AccessDecisionManager;
use Symfony\Component\Security\Core\Authorization\TraceableAccessDecisionManager;
class AutowiringTypesTest extends WebTestCase
class AutowiringTypesTest extends AbstractWebTestCase
{
public function testAccessDecisionManagerAutowiring()
{

View File

@ -11,7 +11,7 @@
namespace Symfony\Bundle\SecurityBundle\Tests\Functional;
class CsrfFormLoginTest extends WebTestCase
class CsrfFormLoginTest extends AbstractWebTestCase
{
/**
* @dataProvider getConfigs

View File

@ -13,7 +13,7 @@ namespace Symfony\Bundle\SecurityBundle\Tests\Functional;
use Symfony\Bundle\SecurityBundle\Tests\Functional\Bundle\FirewallEntryPointBundle\Security\EntryPointStub;
class FirewallEntryPointTest extends WebTestCase
class FirewallEntryPointTest extends AbstractWebTestCase
{
public function testItUsesTheConfiguredEntryPointWhenUsingUnknownCredentials()
{

View File

@ -11,7 +11,7 @@
namespace Symfony\Bundle\SecurityBundle\Tests\Functional;
class FormLoginTest extends WebTestCase
class FormLoginTest extends AbstractWebTestCase
{
/**
* @dataProvider getConfigs

View File

@ -13,7 +13,7 @@ namespace Symfony\Bundle\SecurityBundle\Tests\Functional;
use Symfony\Component\HttpKernel\Kernel;
class JsonLoginLdapTest extends WebTestCase
class JsonLoginLdapTest extends AbstractWebTestCase
{
public function testKernelBoot()
{

View File

@ -16,7 +16,7 @@ use Symfony\Component\HttpFoundation\JsonResponse;
/**
* @author Kévin Dunglas <dunglas@gmail.com>
*/
class JsonLoginTest extends WebTestCase
class JsonLoginTest extends AbstractWebTestCase
{
public function testDefaultJsonLoginSuccess()
{

View File

@ -11,7 +11,7 @@
namespace Symfony\Bundle\SecurityBundle\Tests\Functional;
class LocalizedRoutesAsPathTest extends WebTestCase
class LocalizedRoutesAsPathTest extends AbstractWebTestCase
{
/**
* @dataProvider getLocales

View File

@ -11,7 +11,7 @@
namespace Symfony\Bundle\SecurityBundle\Tests\Functional;
class LogoutTest extends WebTestCase
class LogoutTest extends AbstractWebTestCase
{
public function testSessionLessRememberMeLogout()
{

View File

@ -11,7 +11,7 @@
namespace Symfony\Bundle\SecurityBundle\Tests\Functional;
class MissingUserProviderTest extends WebTestCase
class MissingUserProviderTest extends AbstractWebTestCase
{
/**
* @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException

View File

@ -11,7 +11,7 @@
namespace Symfony\Bundle\SecurityBundle\Tests\Functional;
class SecurityRoutingIntegrationTest extends WebTestCase
class SecurityRoutingIntegrationTest extends AbstractWebTestCase
{
/**
* @dataProvider getConfigs

View File

@ -14,7 +14,7 @@ namespace Symfony\Bundle\SecurityBundle\Tests\Functional;
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
use Symfony\Component\Security\Core\User\User;
class SecurityTest extends WebTestCase
class SecurityTest extends AbstractWebTestCase
{
public function testServiceIsFunctional()
{

View File

@ -14,7 +14,7 @@ namespace Symfony\Bundle\SecurityBundle\Tests\Functional;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\Security\Http\Firewall\SwitchUserListener;
class SwitchUserTest extends WebTestCase
class SwitchUserTest extends AbstractWebTestCase
{
/**
* @dataProvider getTestParameters

View File

@ -27,7 +27,7 @@ use Symfony\Component\Security\Core\Encoder\SodiumPasswordEncoder;
*
* @author Sarah Khalil <mkhalil.sarah@gmail.com>
*/
class UserPasswordEncoderCommandTest extends WebTestCase
class UserPasswordEncoderCommandTest extends AbstractWebTestCase
{
/** @var CommandTester */
private $passwordEncoderCommandTester;

View File

@ -94,11 +94,3 @@ class SecurityUserValueResolverTest extends TestCase
$this->assertSame([null], $argumentResolver->getArguments(Request::create('/'), function (UserInterface $user = null) {}));
}
}
abstract class DummyUser implements UserInterface
{
}
abstract class DummySubUser extends DummyUser
{
}

View File

@ -91,7 +91,7 @@ content="0;url=data:text/html;base64,PHNjcmlwdD5hbGVydCgndGVzdDMnKTwvc2NyaXB0Pg"
ob_start();
$handler->sendPhpResponse(new MethodNotAllowedHttpException(['POST']));
$response = ob_get_clean();
ob_get_clean();
$expectedHeaders = [
['HTTP/1.0 405', true, null],
@ -114,35 +114,65 @@ content="0;url=data:text/html;base64,PHNjcmlwdD5hbGVydCgndGVzdDMnKTwvc2NyaXB0Pg"
public function testHandle()
{
$exception = new \Exception('foo');
$handler = new ExceptionHandler(true);
ob_start();
$handler = $this->getMockBuilder('Symfony\Component\Debug\ExceptionHandler')->setMethods(['sendPhpResponse'])->getMock();
$handler
->expects($this->exactly(2))
->method('sendPhpResponse');
$handler->handle(new \Exception('foo'));
$handler->handle($exception);
$this->assertThatTheExceptionWasOutput(ob_get_clean(), \Exception::class, 'Exception', 'foo');
}
$handler->setHandler(function ($e) use ($exception) {
$this->assertSame($exception, $e);
public function testHandleWithACustomHandlerThatOutputsSomething()
{
$handler = new ExceptionHandler(true);
ob_start();
$handler->setHandler(function () {
echo 'ccc';
});
$handler->handle($exception);
$handler->handle(new \Exception());
ob_end_flush(); // Necessary because of this PHP bug : https://bugs.php.net/bug.php?id=76563
$this->assertSame('ccc', ob_get_clean());
}
public function testHandleWithACustomHandlerThatOutputsNothing()
{
$handler = new ExceptionHandler(true);
$handler->setHandler(function () {});
$handler->handle(new \Exception('ccc'));
$this->assertThatTheExceptionWasOutput(ob_get_clean(), \Exception::class, 'Exception', 'ccc');
}
public function testHandleWithACustomHandlerThatFails()
{
$handler = new ExceptionHandler(true);
$handler->setHandler(function () {
throw new \RuntimeException();
});
$handler->handle(new \Exception('ccc'));
$this->assertThatTheExceptionWasOutput(ob_get_clean(), \Exception::class, 'Exception', 'ccc');
}
public function testHandleOutOfMemoryException()
{
$exception = new OutOfMemoryException('foo', 0, E_ERROR, __FILE__, __LINE__);
$handler = $this->getMockBuilder('Symfony\Component\Debug\ExceptionHandler')->setMethods(['sendPhpResponse'])->getMock();
$handler
->expects($this->once())
->method('sendPhpResponse');
$handler->setHandler(function ($e) {
$handler = new ExceptionHandler(true);
ob_start();
$handler->setHandler(function () {
$this->fail('OutOfMemoryException should bypass the handler');
});
$handler->handle($exception);
$handler->handle(new OutOfMemoryException('foo', 0, E_ERROR, __FILE__, __LINE__));
$this->assertThatTheExceptionWasOutput(ob_get_clean(), OutOfMemoryException::class, 'OutOfMemoryException', 'foo');
}
private function assertThatTheExceptionWasOutput($content, $expectedClass, $expectedTitle, $expectedMessage)
{
$this->assertContains(sprintf('<span class="exception_title"><abbr title="%s">%s</abbr></span>', $expectedClass, $expectedTitle), $content);
$this->assertContains(sprintf('<p class="break-long-words trace-message">%s</p>', $expectedMessage), $content);
}
}

View File

@ -1,24 +0,0 @@
<?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\Debug\Tests;
use Symfony\Component\Debug\ExceptionHandler;
class MockExceptionHandler extends ExceptionHandler
{
public $e;
public function handle(\Exception $e)
{
$this->e = $e;
}
}

View File

@ -1,8 +0,0 @@
<?php
namespace Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\OtherDir\Component1\Dir3;
class Service3
{
}

View File

@ -1,7 +0,0 @@
<?php
namespace Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Sub;
abstract class NoLoadAbstractBar
{
}

View File

@ -1,7 +0,0 @@
<?php
namespace Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Sub;
interface NoLoadBarInterface
{
}

View File

@ -1,7 +0,0 @@
<?php
namespace Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Sub;
trait NoLoadBarTrait
{
}

View File

@ -118,20 +118,6 @@ class CannotBeAutowired
}
}
class CannotBeAutowiredForwardOrder
{
public function __construct(CollisionA $a, CollisionInterface $b, CollisionB $c)
{
}
}
class CannotBeAutowiredReverseOrder
{
public function __construct(CollisionA $a, CollisionB $c, CollisionInterface $b)
{
}
}
class Lille
{
}

View File

@ -18,7 +18,6 @@ use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\DependencyInjection\ServiceLocator;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\AbstractTypeExtension;
use Symfony\Component\Form\Command\DebugCommand;
use Symfony\Component\Form\DependencyInjection\FormPass;
@ -418,14 +417,6 @@ class FormPassTest extends TestCase
}
}
class FormPassTest_Type1 extends AbstractType
{
}
class FormPassTest_Type2 extends AbstractType
{
}
class Type1TypeExtension extends AbstractTypeExtension
{
public static function getExtendedTypes(): iterable

View File

@ -17,7 +17,7 @@ namespace Symfony\Component\HttpFoundation\Session\Storage\Handler;
* @author Markus Bachmann <markus.bachmann@bachi.biz>
*
* @see https://packagist.org/packages/mongodb/mongodb
* @see http://php.net/manual/en/set.mongodb.php
* @see https://php.net/mongodb
*/
class MongoDbSessionHandler extends AbstractSessionHandler
{

View File

@ -23,7 +23,7 @@ class NativeFileSessionHandler extends \SessionHandler
* Default null will leave setting as defined by PHP.
* '/path', 'N;/path', or 'N;octal-mode;/path
*
* @see http://php.net/session.configuration.php#ini.session.save-path for further details.
* @see https://php.net/manual/session.configuration.php#ini.session.save-path for further details.
*
* @throws \InvalidArgumentException On invalid $savePath
* @throws \RuntimeException When failing to create the save directory

View File

@ -1,18 +0,0 @@
<?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\HttpKernel\Tests\Fixtures\ExtensionAbsentBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;
class ExtensionAbsentBundle extends Bundle
{
}

View File

@ -1,22 +0,0 @@
<?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\HttpKernel\Tests\Fixtures\ExtensionLoadedBundle\DependencyInjection;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\Extension;
class ExtensionLoadedExtension extends Extension
{
public function load(array $configs, ContainerBuilder $container)
{
}
}

View File

@ -1,18 +0,0 @@
<?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\HttpKernel\Tests\Fixtures\ExtensionLoadedBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;
class ExtensionLoadedBundle extends Bundle
{
}

View File

@ -1,17 +0,0 @@
<?php
namespace Symfony\Component\HttpKernel\Tests\Fixtures\ExtensionPresentBundle\Command;
use Symfony\Component\Console\Command\Command;
/**
* This command has a required parameter on the constructor and will be ignored by the default Bundle implementation.
*
* @see Bundle::registerCommands()
*/
class BarCommand extends Command
{
public function __construct($example, $name = 'bar')
{
}
}

View File

@ -1,22 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\HttpKernel\Tests\Fixtures\ExtensionPresentBundle\Command;
use Symfony\Component\Console\Command\Command;
class FooCommand extends Command
{
protected function configure()
{
$this->setName('foo');
}
}

View File

@ -687,14 +687,6 @@ class DummyReceiver implements ReceiverInterface
}
}
class InvalidReceiver
{
}
class InvalidSender
{
}
class UndefinedMessageHandler
{
public function __invoke(UndefinedMessage $message)

View File

@ -22,6 +22,8 @@ class AmqpTransportFactory implements TransportFactoryInterface
{
public function createTransport(string $dsn, array $options, SerializerInterface $serializer): TransportInterface
{
unset($options['transport_name']);
return new AmqpTransport(Connection::fromDsn($dsn, $options), $serializer);
}

View File

@ -31,6 +31,7 @@ class DoctrineTransportFactory implements TransportFactoryInterface
public function createTransport(string $dsn, array $options, SerializerInterface $serializer): TransportInterface
{
unset($options['transport_name']);
$configuration = Connection::buildConfiguration($dsn, $options);
try {

View File

@ -23,6 +23,8 @@ class RedisTransportFactory implements TransportFactoryInterface
{
public function createTransport(string $dsn, array $options, SerializerInterface $serializer): TransportInterface
{
unset($options['transport_name']);
return new RedisTransport(Connection::fromDsn($dsn, $options), $serializer);
}

View File

@ -0,0 +1,12 @@
CHANGELOG
=========
4.3.3
-----
* [BC BREAK] Renamed method `Headers::getAll()` to `Headers::all()`.
4.3.0
-----
* Introduced the component as experimental

View File

@ -43,28 +43,6 @@ class PropertyAccessorCollectionTest_Car
}
}
class PropertyAccessorCollectionTest_CarOnlyAdder
{
public function addAxis($axis)
{
}
public function getAxes()
{
}
}
class PropertyAccessorCollectionTest_CarOnlyRemover
{
public function removeAxis($axis)
{
}
public function getAxes()
{
}
}
class PropertyAccessorCollectionTest_CarNoAdderAndRemover
{
public function getAxes()

View File

@ -1,42 +0,0 @@
<?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\PropertyInfo\Tests\Fixtures;
class Php71DummyParent
{
public $string;
public function __construct(string $string)
{
$this->string = $string;
}
}
class Php71DummyChild extends Php71DummyParent
{
public function __construct(string $string)
{
parent::__construct($string);
}
}
class Php71DummyChild2 extends Php71DummyParent
{
}
class Php71DummyChild3 extends Php71DummyParent
{
public function __construct()
{
parent::__construct('hello');
}
}

View File

@ -48,8 +48,6 @@ use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
*
* @author Fabien Potencier <fabien@symfony.com>
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
*
* @internal since Symfony 4.3
*/
abstract class AbstractAuthenticationListener implements ListenerInterface
{

View File

@ -89,11 +89,3 @@ class UserValueResolverTest extends TestCase
$this->assertSame([null], $argumentResolver->getArguments(Request::create('/'), function (UserInterface $user = null) {}));
}
}
abstract class DummyUser implements UserInterface
{
}
abstract class DummySubUser extends DummyUser
{
}

View File

@ -687,43 +687,6 @@ class GetConstructorArgsWithDefaultValueDummy
}
}
class GetCamelizedDummy
{
private $kevinDunglas;
private $fooBar;
private $bar_foo;
public function __construct($kevinDunglas = null)
{
$this->kevinDunglas = $kevinDunglas;
}
public function getKevinDunglas()
{
return $this->kevinDunglas;
}
public function setFooBar($fooBar)
{
$this->fooBar = $fooBar;
}
public function getFooBar()
{
return $this->fooBar;
}
public function setBar_foo($bar_foo)
{
$this->bar_foo = $bar_foo;
}
public function getBar_foo()
{
return $this->bar_foo;
}
}
class ObjectConstructorArgsWithPrivateMutatorDummy
{
private $foo;

View File

@ -461,18 +461,6 @@ class PropertyConstructorDummy
}
}
class PropertyCamelizedDummy
{
private $kevinDunglas;
public $fooBar;
public $bar_foo;
public function __construct($kevinDunglas = null)
{
$this->kevinDunglas = $kevinDunglas;
}
}
class StaticPropertyDummy
{
private static $property = 'value';

View File

@ -1,37 +0,0 @@
<?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\Validator\Tests\Fixtures;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\ConstraintValidator;
use Symfony\Component\Validator\Context\ExecutionContextInterface;
class ConstraintAValidator extends ConstraintValidator
{
public static $passedContext;
public function initialize(ExecutionContextInterface $context)
{
parent::initialize($context);
self::$passedContext = $context;
}
public function validate($value, Constraint $constraint)
{
if ('VALID' != $value) {
$this->context->addViolation('message', ['param' => 'value']);
return;
}
}
}

View File

@ -1,26 +0,0 @@
<?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\Validator\Tests\Fixtures;
use Symfony\Component\Validator\Mapping\ClassMetadata;
class FakeClassMetadata extends ClassMetadata
{
public function addCustomPropertyMetadata($propertyName, $metadata)
{
if (!isset($this->members[$propertyName])) {
$this->members[$propertyName] = [];
}
$this->members[$propertyName][] = $metadata;
}
}

View File

@ -1,16 +0,0 @@
<?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\Validator\Tests\Fixtures;
class InvalidConstraintValidator
{
}

View File

@ -62,8 +62,8 @@ class Caster
foreach ($a as $k => $v) {
if (isset($k[0]) ? "\0" !== $k[0] : \PHP_VERSION_ID >= 70200) {
if (!isset($publicProperties[$class])) {
foreach (get_class_vars($class) as $prop => $v) {
$publicProperties[$class][$prop] = true;
foreach ((new \ReflectionClass($class))->getProperties(\ReflectionProperty::IS_PUBLIC) as $prop) {
$publicProperties[$class][$prop->name] = true;
}
}
if (!isset($publicProperties[$class][$k])) {

View File

@ -40,7 +40,7 @@ class VarCloner extends AbstractCloner
$currentDepth = 0; // Current tree depth
$currentDepthFinalIndex = 0; // Final $queue index for current tree depth
$minimumDepthReached = 0 === $minDepth; // Becomes true when minimum tree depth has been reached
$cookie = (object) []; // Unique object used to detect hard references
$cookie = (object) []; // Unique object used to detect hard references
$a = null; // Array cast for nested structures
$stub = null; // Stub capturing the main properties of an original item value
// or null if the original value is used directly
@ -80,8 +80,15 @@ class VarCloner extends AbstractCloner
}
foreach ($vals as $k => $v) {
// $v is the original value or a stub object in case of hard references
$refs[$k] = $cookie;
if ($zvalIsRef = $vals[$k] === $cookie) {
if (\PHP_VERSION_ID >= 70400) {
$zvalIsRef = null !== \ReflectionReference::fromArrayElement($vals, $k);
} else {
$refs[$k] = $cookie;
$zvalIsRef = $vals[$k] === $cookie;
}
if ($zvalIsRef) {
$vals[$k] = &$stub; // Break hard references to make $queue completely
unset($stub); // independent from the original structure
if ($v instanceof Stub && isset($hardRefs[spl_object_id($v)])) {

View File

@ -13,6 +13,7 @@ namespace Symfony\Component\VarDumper\Tests\Cloner;
use PHPUnit\Framework\TestCase;
use Symfony\Component\VarDumper\Cloner\VarCloner;
use Symfony\Component\VarDumper\Tests\Fixtures\Php74;
/**
* @author Nicolas Grekas <p@tchwork.com>
@ -433,6 +434,73 @@ Symfony\Component\VarDumper\Cloner\Data Object
[useRefHandles:Symfony\Component\VarDumper\Cloner\Data:private] => -1
)
EOTXT;
$this->assertStringMatchesFormat($expected, print_r($clone, true));
}
/**
* @requires PHP 7.4
*/
public function testPhp74()
{
$data = new Php74();
$cloner = new VarCloner();
$clone = $cloner->cloneVar($data);
$expected = <<<'EOTXT'
Symfony\Component\VarDumper\Cloner\Data Object
(
[data:Symfony\Component\VarDumper\Cloner\Data:private] => Array
(
[0] => Array
(
[0] => Symfony\Component\VarDumper\Cloner\Stub Object
(
[type] => 4
[class] => Symfony\Component\VarDumper\Tests\Fixtures\Php74
[value] =>
[cut] => 0
[handle] => %i
[refCount] => 0
[position] => 1
[attr] => Array
(
)
)
)
[1] => Array
(
[p1] => 123
[p2] => Symfony\Component\VarDumper\Cloner\Stub Object
(
[type] => 4
[class] => stdClass
[value] =>
[cut] => 0
[handle] => %i
[refCount] => 0
[position] => 0
[attr] => Array
(
)
)
)
)
[position:Symfony\Component\VarDumper\Cloner\Data:private] => 0
[key:Symfony\Component\VarDumper\Cloner\Data:private] => 0
[maxDepth:Symfony\Component\VarDumper\Cloner\Data:private] => 20
[maxItemsPerDepth:Symfony\Component\VarDumper\Cloner\Data:private] => -1
[useRefHandles:Symfony\Component\VarDumper\Cloner\Data:private] => -1
)
EOTXT;
$this->assertStringMatchesFormat($expected, print_r($clone, true));
}

View File

@ -0,0 +1,14 @@
<?php
namespace Symfony\Component\VarDumper\Tests\Fixtures;
class Php74
{
public $p1 = 123;
public \stdClass $p2;
public function __construct()
{
$this->p2 = new \stdClass();
}
}