Remove unused local variables in tests

This commit is contained in:
Thomas Calvet 2019-10-24 14:44:17 +02:00
parent 5d097d2eb5
commit c07cee8f61
77 changed files with 118 additions and 133 deletions

View File

@ -187,7 +187,7 @@ class EntityTypeTest extends BaseTypeTest
public function testConfigureQueryBuilderWithNonQueryBuilderAndNonClosure() public function testConfigureQueryBuilderWithNonQueryBuilderAndNonClosure()
{ {
$this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException'); $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
$field = $this->factory->createNamed('name', static::TESTED_TYPE, null, [ $this->factory->createNamed('name', static::TESTED_TYPE, null, [
'em' => 'default', 'em' => 'default',
'class' => self::SINGLE_IDENT_CLASS, 'class' => self::SINGLE_IDENT_CLASS,
'query_builder' => new \stdClass(), 'query_builder' => new \stdClass(),

View File

@ -28,7 +28,6 @@ class SearchAndRenderBlockNode extends FunctionExpression
preg_match('/_([^_]+)$/', $this->getAttribute('name'), $matches); preg_match('/_([^_]+)$/', $this->getAttribute('name'), $matches);
$label = null;
$arguments = iterator_to_array($this->getNode('arguments')); $arguments = iterator_to_array($this->getNode('arguments'));
$blockNameSuffix = $matches[1]; $blockNameSuffix = $matches[1];

View File

@ -180,10 +180,10 @@ class AppVariableTest extends TestCase
$flashMessages = $this->setFlashMessages(); $flashMessages = $this->setFlashMessages();
$this->assertEquals($flashMessages, $this->appVariable->getFlashes([])); $this->assertEquals($flashMessages, $this->appVariable->getFlashes([]));
$flashMessages = $this->setFlashMessages(); $this->setFlashMessages();
$this->assertEquals([], $this->appVariable->getFlashes('this-does-not-exist')); $this->assertEquals([], $this->appVariable->getFlashes('this-does-not-exist'));
$flashMessages = $this->setFlashMessages(); $this->setFlashMessages();
$this->assertEquals( $this->assertEquals(
['this-does-not-exist' => []], ['this-does-not-exist' => []],
$this->appVariable->getFlashes(['this-does-not-exist']) $this->appVariable->getFlashes(['this-does-not-exist'])

View File

@ -52,7 +52,7 @@ class LintCommandTest extends TestCase
$filename = $this->createFile(''); $filename = $this->createFile('');
unlink($filename); unlink($filename);
$ret = $tester->execute(['filename' => [$filename]], ['decorated' => false]); $tester->execute(['filename' => [$filename]], ['decorated' => false]);
} }
public function testLintFileCompileTimeException() public function testLintFileCompileTimeException()

View File

@ -34,7 +34,7 @@ class StopwatchExtensionTest extends TestCase
$twig->addExtension(new StopwatchExtension($this->getStopwatch($events))); $twig->addExtension(new StopwatchExtension($this->getStopwatch($events)));
try { try {
$nodes = $twig->render('template'); $twig->render('template');
} catch (RuntimeError $e) { } catch (RuntimeError $e) {
throw $e->getPrevious(); throw $e->getPrevious();
} }

View File

@ -49,21 +49,21 @@ class TranslationExtensionTest extends TestCase
{ {
$this->expectException('Twig\Error\SyntaxError'); $this->expectException('Twig\Error\SyntaxError');
$this->expectExceptionMessage('Unexpected token. Twig was looking for the "with", "from", or "into" keyword in "index" at line 3.'); $this->expectExceptionMessage('Unexpected token. Twig was looking for the "with", "from", or "into" keyword in "index" at line 3.');
$output = $this->getTemplate("{% trans \n\nfoo %}{% endtrans %}")->render(); $this->getTemplate("{% trans \n\nfoo %}{% endtrans %}")->render();
} }
public function testTransComplexBody() public function testTransComplexBody()
{ {
$this->expectException('Twig\Error\SyntaxError'); $this->expectException('Twig\Error\SyntaxError');
$this->expectExceptionMessage('A message inside a trans tag must be a simple text in "index" at line 2.'); $this->expectExceptionMessage('A message inside a trans tag must be a simple text in "index" at line 2.');
$output = $this->getTemplate("{% trans %}\n{{ 1 + 2 }}{% endtrans %}")->render(); $this->getTemplate("{% trans %}\n{{ 1 + 2 }}{% endtrans %}")->render();
} }
public function testTransChoiceComplexBody() public function testTransChoiceComplexBody()
{ {
$this->expectException('Twig\Error\SyntaxError'); $this->expectException('Twig\Error\SyntaxError');
$this->expectExceptionMessage('A message inside a transchoice tag must be a simple text in "index" at line 2.'); $this->expectExceptionMessage('A message inside a transchoice tag must be a simple text in "index" at line 2.');
$output = $this->getTemplate("{% transchoice count %}\n{{ 1 + 2 }}{% endtranschoice %}")->render(); $this->getTemplate("{% transchoice count %}\n{{ 1 + 2 }}{% endtranschoice %}")->render();
} }
public function getTransTests() public function getTransTests()

View File

@ -425,7 +425,6 @@ class TextDescriptor extends Descriptor
$tableHeaders = ['Order', 'Callable', 'Priority']; $tableHeaders = ['Order', 'Callable', 'Priority'];
$tableRows = []; $tableRows = [];
$order = 1;
foreach ($eventListeners as $order => $listener) { foreach ($eventListeners as $order => $listener) {
$tableRows[] = [sprintf('#%d', $order + 1), $this->formatCallable($listener), $eventDispatcher->getListenerPriority($event, $listener)]; $tableRows[] = [sprintf('#%d', $order + 1), $this->formatCallable($listener), $eventDispatcher->getListenerPriority($event, $listener)];
} }

View File

@ -1043,8 +1043,6 @@ class FrameworkExtension extends Extension
$container->getDefinition('assets.url_package')->setPrivate(true); $container->getDefinition('assets.url_package')->setPrivate(true);
$container->getDefinition('assets.static_version_strategy')->setPrivate(true); $container->getDefinition('assets.static_version_strategy')->setPrivate(true);
$defaultVersion = null;
if ($config['version_strategy']) { if ($config['version_strategy']) {
$defaultVersion = new Reference($config['version_strategy']); $defaultVersion = new Reference($config['version_strategy']);
} else { } else {

View File

@ -277,8 +277,7 @@ abstract class ControllerTraitTest extends TestCase
$this->expectException('Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException'); $this->expectException('Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException');
$controller = $this->createController(); $controller = $this->createController();
/* @var BinaryFileResponse $response */ $controller->file('some-file.txt', 'test.php');
$response = $controller->file('some-file.txt', 'test.php');
} }
public function testIsGranted() public function testIsGranted()

View File

@ -51,7 +51,7 @@ class AddConstraintValidatorsPassTest extends TestCase
$this->expectException('InvalidArgumentException'); $this->expectException('InvalidArgumentException');
$this->expectExceptionMessage('The service "my_abstract_constraint_validator" tagged "validator.constraint_validator" must not be abstract.'); $this->expectExceptionMessage('The service "my_abstract_constraint_validator" tagged "validator.constraint_validator" must not be abstract.');
$container = new ContainerBuilder(); $container = new ContainerBuilder();
$validatorFactory = $container->register('validator.validator_factory') $container->register('validator.validator_factory')
->addArgument([]); ->addArgument([]);
$container->register('my_abstract_constraint_validator') $container->register('my_abstract_constraint_validator')

View File

@ -251,7 +251,7 @@ abstract class FrameworkExtensionTest extends TestCase
*/ */
public function testDeprecatedWorkflowMissingType() public function testDeprecatedWorkflowMissingType()
{ {
$container = $this->createContainerFromFile('workflows_without_type'); $this->createContainerFromFile('workflows_without_type');
} }
public function testWorkflowCannotHaveBothTypeAndService() public function testWorkflowCannotHaveBothTypeAndService()

View File

@ -26,7 +26,7 @@ class TestExtension extends Extension implements PrependExtensionInterface
public function load(array $configs, ContainerBuilder $container) public function load(array $configs, ContainerBuilder $container)
{ {
$configuration = $this->getConfiguration($configs, $container); $configuration = $this->getConfiguration($configs, $container);
$config = $this->processConfiguration($configuration, $configs); $this->processConfiguration($configuration, $configs);
$container->setAlias('test.annotation_reader', new Alias('annotation_reader', true)); $container->setAlias('test.annotation_reader', new Alias('annotation_reader', true));
} }

View File

@ -59,7 +59,7 @@ class SessionTest extends AbstractWebTestCase
} }
// set flash // set flash
$crawler = $client->request('GET', '/session_setflash/Hello%20world.'); $client->request('GET', '/session_setflash/Hello%20world.');
// check flash displays on redirect // check flash displays on redirect
$this->assertStringContainsString('Hello world.', $client->followRedirect()->text()); $this->assertStringContainsString('Hello world.', $client->followRedirect()->text());

View File

@ -162,7 +162,7 @@ class TranslatorTest extends TestCase
$this->expectException('InvalidArgumentException'); $this->expectException('InvalidArgumentException');
$this->expectExceptionMessage('Missing third $defaultLocale argument.'); $this->expectExceptionMessage('Missing third $defaultLocale argument.');
$container = $this->getMockBuilder(ContainerInterface::class)->getMock(); $container = $this->getMockBuilder(ContainerInterface::class)->getMock();
$translator = new Translator($container, new MessageFormatter()); new Translator($container, new MessageFormatter());
} }
/** /**

View File

@ -61,7 +61,7 @@ class AbstractFactoryTest extends TestCase
$options['failure_handler'] = $serviceId; $options['failure_handler'] = $serviceId;
} }
list($container, $authProviderId, $listenerId, $entryPointId) = $this->callFactory('foo', $options, 'user_provider', 'entry_point'); list($container) = $this->callFactory('foo', $options, 'user_provider', 'entry_point');
$definition = $container->getDefinition('abstract_listener.foo'); $definition = $container->getDefinition('abstract_listener.foo');
$arguments = $definition->getArguments(); $arguments = $definition->getArguments();
@ -99,7 +99,7 @@ class AbstractFactoryTest extends TestCase
$options['success_handler'] = $serviceId; $options['success_handler'] = $serviceId;
} }
list($container, $authProviderId, $listenerId, $entryPointId) = $this->callFactory('foo', $options, 'user_provider', 'entry_point'); list($container) = $this->callFactory('foo', $options, 'user_provider', 'entry_point');
$definition = $container->getDefinition('abstract_listener.foo'); $definition = $container->getDefinition('abstract_listener.foo');
$arguments = $definition->getArguments(); $arguments = $definition->getArguments();

View File

@ -159,7 +159,7 @@ class GuardAuthenticationFactoryTest extends TestCase
'authenticators' => ['authenticator123', 'authenticatorABC'], 'authenticators' => ['authenticator123', 'authenticatorABC'],
'entry_point' => 'authenticatorABC', 'entry_point' => 'authenticatorABC',
]; ];
list($container, $entryPointId) = $this->executeCreate($config, null); list(, $entryPointId) = $this->executeCreate($config, null);
$this->assertEquals('authenticatorABC', $entryPointId); $this->assertEquals('authenticatorABC', $entryPointId);
} }
@ -172,7 +172,7 @@ class GuardAuthenticationFactoryTest extends TestCase
$userProviderId = 'my_user_provider'; $userProviderId = 'my_user_provider';
$factory = new GuardAuthenticationFactory(); $factory = new GuardAuthenticationFactory();
list($providerId, $listenerId, $entryPointId) = $factory->create($container, $id, $config, $userProviderId, $defaultEntryPointId); list(, , $entryPointId) = $factory->create($container, $id, $config, $userProviderId, $defaultEntryPointId);
return [$container, $entryPointId]; return [$container, $entryPointId];
} }

View File

@ -198,6 +198,6 @@ class CookieTest extends TestCase
{ {
$this->expectException('UnexpectedValueException'); $this->expectException('UnexpectedValueException');
$this->expectExceptionMessage('The cookie expiration time "string" is not valid.'); $this->expectExceptionMessage('The cookie expiration time "string" is not valid.');
$cookie = new Cookie('foo', 'bar', 'string'); new Cookie('foo', 'bar', 'string');
} }
} }

View File

@ -70,7 +70,7 @@ class MaxIdLengthAdapterTest extends TestCase
{ {
$this->expectException('Symfony\Component\Cache\Exception\InvalidArgumentException'); $this->expectException('Symfony\Component\Cache\Exception\InvalidArgumentException');
$this->expectExceptionMessage('Namespace must be 26 chars max, 40 given ("----------------------------------------")'); $this->expectExceptionMessage('Namespace must be 26 chars max, 40 given ("----------------------------------------")');
$cache = $this->getMockBuilder(MaxIdLengthAdapter::class) $this->getMockBuilder(MaxIdLengthAdapter::class)
->setConstructorArgs([str_repeat('-', 40)]) ->setConstructorArgs([str_repeat('-', 40)])
->getMock(); ->getMock();
} }

View File

@ -19,7 +19,7 @@ class DelegatingLoaderTest extends TestCase
{ {
public function testConstructor() public function testConstructor()
{ {
$loader = new DelegatingLoader($resolver = new LoaderResolver()); new DelegatingLoader($resolver = new LoaderResolver());
$this->assertTrue(true, '__construct() takes a loader resolver as its first argument'); $this->assertTrue(true, '__construct() takes a loader resolver as its first argument');
} }

View File

@ -67,7 +67,7 @@ EOF
$loadedClass = 123; $loadedClass = 123;
$res = new ClassExistenceResource('MissingFooClass', false); new ClassExistenceResource('MissingFooClass', false);
$this->assertSame(123, $loadedClass); $this->assertSame(123, $loadedClass);
} finally { } finally {

View File

@ -67,7 +67,7 @@ class DirectoryResourceTest extends TestCase
{ {
$this->expectException('InvalidArgumentException'); $this->expectException('InvalidArgumentException');
$this->expectExceptionMessageRegExp('/The directory ".*" does not exist./'); $this->expectExceptionMessageRegExp('/The directory ".*" does not exist./');
$resource = new DirectoryResource('/____foo/foobar'.mt_rand(1, 999999)); new DirectoryResource('/____foo/foobar'.mt_rand(1, 999999));
} }
public function testIsFresh() public function testIsFresh()
@ -165,7 +165,7 @@ class DirectoryResourceTest extends TestCase
{ {
$resource = new DirectoryResource($this->directory, '/\.(foo|xml)$/'); $resource = new DirectoryResource($this->directory, '/\.(foo|xml)$/');
$unserialized = unserialize(serialize($resource)); unserialize(serialize($resource));
$this->assertSame(realpath($this->directory), $resource->getResource()); $this->assertSame(realpath($this->directory), $resource->getResource());
$this->assertSame('/\.(foo|xml)$/', $resource->getPattern()); $this->assertSame('/\.(foo|xml)$/', $resource->getPattern());

View File

@ -57,7 +57,7 @@ class FileResourceTest extends TestCase
{ {
$this->expectException('InvalidArgumentException'); $this->expectException('InvalidArgumentException');
$this->expectExceptionMessageRegExp('/The file ".*" does not exist./'); $this->expectExceptionMessageRegExp('/The file ".*" does not exist./');
$resource = new FileResource('/____foo/foobar'.mt_rand(1, 999999)); new FileResource('/____foo/foobar'.mt_rand(1, 999999));
} }
public function testIsFresh() public function testIsFresh()
@ -76,7 +76,7 @@ class FileResourceTest extends TestCase
public function testSerializeUnserialize() public function testSerializeUnserialize()
{ {
$unserialized = unserialize(serialize($this->resource)); unserialize(serialize($this->resource));
$this->assertSame(realpath($this->file), $this->resource->getResource()); $this->assertSame(realpath($this->file), $this->resource->getResource());
} }

View File

@ -521,7 +521,7 @@ class ApplicationTest extends TestCase
// Subnamespace + plural // Subnamespace + plural
try { try {
$a = $application->find('foo3:'); $application->find('foo3:');
$this->fail('->find() should throw an Symfony\Component\Console\Exception\CommandNotFoundException if a command is ambiguous because of a subnamespace, with alternatives'); $this->fail('->find() should throw an Symfony\Component\Console\Exception\CommandNotFoundException if a command is ambiguous because of a subnamespace, with alternatives');
} catch (\Exception $e) { } catch (\Exception $e) {
$this->assertInstanceOf('Symfony\Component\Console\Exception\CommandNotFoundException', $e); $this->assertInstanceOf('Symfony\Component\Console\Exception\CommandNotFoundException', $e);

View File

@ -104,7 +104,7 @@ class ProgressIndicatorTest extends TestCase
{ {
$this->expectException('InvalidArgumentException'); $this->expectException('InvalidArgumentException');
$this->expectExceptionMessage('Must have at least 2 indicator value characters.'); $this->expectExceptionMessage('Must have at least 2 indicator value characters.');
$bar = new ProgressIndicator($this->getOutputStream(), null, 100, ['1']); new ProgressIndicator($this->getOutputStream(), null, 100, ['1']);
} }
public function testCannotStartAlreadyStartedIndicator() public function testCannotStartAlreadyStartedIndicator()

View File

@ -404,7 +404,7 @@ class DebugClassLoader
} }
if (isset($dirFiles[$file])) { if (isset($dirFiles[$file])) {
return $real .= $dirFiles[$file]; return $real.$dirFiles[$file];
} }
$kFile = strtolower($file); $kFile = strtolower($file);
@ -423,7 +423,7 @@ class DebugClassLoader
self::$darwinCache[$kDir][1] = $dirFiles; self::$darwinCache[$kDir][1] = $dirFiles;
} }
return $real .= $dirFiles[$kFile]; return $real.$dirFiles[$kFile];
} }
/** /**

View File

@ -256,7 +256,7 @@ class FlattenExceptionTest extends TestCase
// assertEquals() does not like NAN values. // assertEquals() does not like NAN values.
$this->assertEquals($array[$i][0], 'float'); $this->assertEquals($array[$i][0], 'float');
$this->assertNan($array[$i++][1]); $this->assertNan($array[$i][1]);
} }
public function testRecursionInArguments() public function testRecursionInArguments()

View File

@ -219,7 +219,7 @@ EOF;
foreach ($ids as $id) { foreach ($ids as $id) {
$c .= ' '.$this->doExport($id)." => true,\n"; $c .= ' '.$this->doExport($id)." => true,\n";
} }
$files['removed-ids.php'] = $c .= "];\n"; $files['removed-ids.php'] = $c."];\n";
} }
foreach ($this->generateServiceFiles() as $file => $c) { foreach ($this->generateServiceFiles() as $file => $c) {

View File

@ -25,28 +25,28 @@ class AnalyzeServiceReferencesPassTest extends TestCase
{ {
$container = new ContainerBuilder(); $container = new ContainerBuilder();
$a = $container $container
->register('a') ->register('a')
->addArgument($ref1 = new Reference('b')) ->addArgument($ref1 = new Reference('b'))
; ;
$b = $container $container
->register('b') ->register('b')
->addMethodCall('setA', [$ref2 = new Reference('a')]) ->addMethodCall('setA', [$ref2 = new Reference('a')])
; ;
$c = $container $container
->register('c') ->register('c')
->addArgument($ref3 = new Reference('a')) ->addArgument($ref3 = new Reference('a'))
->addArgument($ref4 = new Reference('b')) ->addArgument($ref4 = new Reference('b'))
; ;
$d = $container $container
->register('d') ->register('d')
->setProperty('foo', $ref5 = new Reference('b')) ->setProperty('foo', $ref5 = new Reference('b'))
; ;
$e = $container $container
->register('e') ->register('e')
->setConfigurator([$ref6 = new Reference('b'), 'methodName']) ->setConfigurator([$ref6 = new Reference('b'), 'methodName'])
; ;

View File

@ -43,7 +43,7 @@ class IntegrationTest extends TestCase
->addArgument(new Reference('c')) ->addArgument(new Reference('c'))
; ;
$b = $container $container
->register('b', '\stdClass') ->register('b', '\stdClass')
->addArgument(new Reference('c')) ->addArgument(new Reference('c'))
->setPublic(false) ->setPublic(false)

View File

@ -390,7 +390,7 @@ class ResolveChildDefinitionsPassTest extends TestCase
->setBindings(['a' => '1', 'b' => '2']) ->setBindings(['a' => '1', 'b' => '2'])
; ;
$child = $container->setDefinition('child', new ChildDefinition('parent')) $container->setDefinition('child', new ChildDefinition('parent'))
->setBindings(['b' => 'B', 'c' => 'C']) ->setBindings(['b' => 'B', 'c' => 'C'])
; ;

View File

@ -87,8 +87,8 @@ class ResolveClassPassTest extends TestCase
$this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException'); $this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
$this->expectExceptionMessage('Service definition "App\Foo\Child" has a parent but no class, and its name looks like a FQCN. Either the class is missing or you want to inherit it from the parent service. To resolve this ambiguity, please rename this service to a non-FQCN (e.g. using dots), or create the missing class.'); $this->expectExceptionMessage('Service definition "App\Foo\Child" has a parent but no class, and its name looks like a FQCN. Either the class is missing or you want to inherit it from the parent service. To resolve this ambiguity, please rename this service to a non-FQCN (e.g. using dots), or create the missing class.');
$container = new ContainerBuilder(); $container = new ContainerBuilder();
$parent = $container->register('App\Foo', null); $container->register('App\Foo', null);
$child = $container->setDefinition('App\Foo\Child', new ChildDefinition('App\Foo')); $container->setDefinition('App\Foo\Child', new ChildDefinition('App\Foo'));
(new ResolveClassPass())->process($container); (new ResolveClassPass())->process($container);
} }

View File

@ -1265,7 +1265,7 @@ class ContainerBuilderTest extends TestCase
$this->expectExceptionMessage('The definition for "DateTime" has no class attribute, and appears to reference a class or interface in the global namespace.'); $this->expectExceptionMessage('The definition for "DateTime" has no class attribute, and appears to reference a class or interface in the global namespace.');
$container = new ContainerBuilder(); $container = new ContainerBuilder();
$definition = $container->register(\DateTime::class); $container->register(\DateTime::class);
$container->compile(); $container->compile();
} }
@ -1295,7 +1295,7 @@ class ContainerBuilderTest extends TestCase
$this->expectExceptionMessage('The definition for "123_abc" has no class.'); $this->expectExceptionMessage('The definition for "123_abc" has no class.');
$container = new ContainerBuilder(); $container = new ContainerBuilder();
$definition = $container->register('123_abc'); $container->register('123_abc');
$container->compile(); $container->compile();
} }
@ -1305,7 +1305,7 @@ class ContainerBuilderTest extends TestCase
$this->expectExceptionMessage('The definition for "\foo" has no class.'); $this->expectExceptionMessage('The definition for "\foo" has no class.');
$container = new ContainerBuilder(); $container = new ContainerBuilder();
$definition = $container->register('\\foo'); $container->register('\\foo');
$container->compile(); $container->compile();
} }

View File

@ -886,7 +886,7 @@ class PhpDumperTest extends TestCase
->setPublic(true) ->setPublic(true)
->addArgument($baz); ->addArgument($baz);
$passConfig = $container->getCompiler()->getPassConfig(); $container->getCompiler()->getPassConfig();
$container->compile(); $container->compile();
$dumper = new PhpDumper($container); $dumper = new PhpDumper($container);
@ -978,7 +978,6 @@ class PhpDumperTest extends TestCase
$container->compile(); $container->compile();
$dumper = new PhpDumper($container); $dumper = new PhpDumper($container);
$dump = $dumper->dump();
$this->assertStringEqualsFile(self::$fixturesPath.'/php/services_adawson.php', $dumper->dump()); $this->assertStringEqualsFile(self::$fixturesPath.'/php/services_adawson.php', $dumper->dump());
} }

View File

@ -808,7 +808,6 @@ class XmlFileLoaderTest extends TestCase
$container->compile(); $container->compile();
$dumper = new PhpDumper($container); $dumper = new PhpDumper($container);
$dump = $dumper->dump();
$this->assertStringEqualsFile(self::$fixturesPath.'/php/services_tsantos.php', $dumper->dump()); $this->assertStringEqualsFile(self::$fixturesPath.'/php/services_tsantos.php', $dumper->dump());
} }

View File

@ -19,7 +19,7 @@ class ChoiceFormFieldTest extends FormFieldTestCase
{ {
$node = $this->createNode('textarea', ''); $node = $this->createNode('textarea', '');
try { try {
$field = new ChoiceFormField($node); new ChoiceFormField($node);
$this->fail('->initialize() throws a \LogicException if the node is not an input or a select'); $this->fail('->initialize() throws a \LogicException if the node is not an input or a select');
} catch (\LogicException $e) { } catch (\LogicException $e) {
$this->assertTrue(true, '->initialize() throws a \LogicException if the node is not an input or a select'); $this->assertTrue(true, '->initialize() throws a \LogicException if the node is not an input or a select');
@ -27,7 +27,7 @@ class ChoiceFormFieldTest extends FormFieldTestCase
$node = $this->createNode('input', '', ['type' => 'text']); $node = $this->createNode('input', '', ['type' => 'text']);
try { try {
$field = new ChoiceFormField($node); new ChoiceFormField($node);
$this->fail('->initialize() throws a \LogicException if the node is an input with a type different from checkbox or radio'); $this->fail('->initialize() throws a \LogicException if the node is an input with a type different from checkbox or radio');
} catch (\LogicException $e) { } catch (\LogicException $e) {
$this->assertTrue(true, '->initialize() throws a \LogicException if the node is an input with a type different from checkbox or radio'); $this->assertTrue(true, '->initialize() throws a \LogicException if the node is an input with a type different from checkbox or radio');

View File

@ -24,7 +24,7 @@ class FileFormFieldTest extends FormFieldTestCase
$node = $this->createNode('textarea', ''); $node = $this->createNode('textarea', '');
try { try {
$field = new FileFormField($node); new FileFormField($node);
$this->fail('->initialize() throws a \LogicException if the node is not an input field'); $this->fail('->initialize() throws a \LogicException if the node is not an input field');
} catch (\LogicException $e) { } catch (\LogicException $e) {
$this->assertTrue(true, '->initialize() throws a \LogicException if the node is not an input field'); $this->assertTrue(true, '->initialize() throws a \LogicException if the node is not an input field');
@ -32,7 +32,7 @@ class FileFormFieldTest extends FormFieldTestCase
$node = $this->createNode('input', '', ['type' => 'text']); $node = $this->createNode('input', '', ['type' => 'text']);
try { try {
$field = new FileFormField($node); new FileFormField($node);
$this->fail('->initialize() throws a \LogicException if the node is not a file input field'); $this->fail('->initialize() throws a \LogicException if the node is not a file input field');
} catch (\LogicException $e) { } catch (\LogicException $e) {
$this->assertTrue(true, '->initialize() throws a \LogicException if the node is not a file input field'); $this->assertTrue(true, '->initialize() throws a \LogicException if the node is not a file input field');

View File

@ -24,7 +24,7 @@ class InputFormFieldTest extends FormFieldTestCase
$node = $this->createNode('textarea', ''); $node = $this->createNode('textarea', '');
try { try {
$field = new InputFormField($node); new InputFormField($node);
$this->fail('->initialize() throws a \LogicException if the node is not an input'); $this->fail('->initialize() throws a \LogicException if the node is not an input');
} catch (\LogicException $e) { } catch (\LogicException $e) {
$this->assertTrue(true, '->initialize() throws a \LogicException if the node is not an input'); $this->assertTrue(true, '->initialize() throws a \LogicException if the node is not an input');
@ -32,7 +32,7 @@ class InputFormFieldTest extends FormFieldTestCase
$node = $this->createNode('input', '', ['type' => 'checkbox']); $node = $this->createNode('input', '', ['type' => 'checkbox']);
try { try {
$field = new InputFormField($node); new InputFormField($node);
$this->fail('->initialize() throws a \LogicException if the node is a checkbox'); $this->fail('->initialize() throws a \LogicException if the node is a checkbox');
} catch (\LogicException $e) { } catch (\LogicException $e) {
$this->assertTrue(true, '->initialize() throws a \LogicException if the node is a checkbox'); $this->assertTrue(true, '->initialize() throws a \LogicException if the node is a checkbox');
@ -40,7 +40,7 @@ class InputFormFieldTest extends FormFieldTestCase
$node = $this->createNode('input', '', ['type' => 'file']); $node = $this->createNode('input', '', ['type' => 'file']);
try { try {
$field = new InputFormField($node); new InputFormField($node);
$this->fail('->initialize() throws a \LogicException if the node is a file'); $this->fail('->initialize() throws a \LogicException if the node is a file');
} catch (\LogicException $e) { } catch (\LogicException $e) {
$this->assertTrue(true, '->initialize() throws a \LogicException if the node is a file'); $this->assertTrue(true, '->initialize() throws a \LogicException if the node is a file');

View File

@ -24,7 +24,7 @@ class TextareaFormFieldTest extends FormFieldTestCase
$node = $this->createNode('input', ''); $node = $this->createNode('input', '');
try { try {
$field = new TextareaFormField($node); new TextareaFormField($node);
$this->fail('->initialize() throws a \LogicException if the node is not a textarea'); $this->fail('->initialize() throws a \LogicException if the node is not a textarea');
} catch (\LogicException $e) { } catch (\LogicException $e) {
$this->assertTrue(true, '->initialize() throws a \LogicException if the node is not a textarea'); $this->assertTrue(true, '->initialize() throws a \LogicException if the node is not a textarea');

View File

@ -39,14 +39,14 @@ class FormTest extends TestCase
$nodes = $dom->getElementsByTagName('input'); $nodes = $dom->getElementsByTagName('input');
try { try {
$form = new Form($nodes->item(0), 'http://example.com'); new Form($nodes->item(0), 'http://example.com');
$this->fail('__construct() throws a \\LogicException if the node has no form ancestor'); $this->fail('__construct() throws a \\LogicException if the node has no form ancestor');
} catch (\LogicException $e) { } catch (\LogicException $e) {
$this->assertTrue(true, '__construct() throws a \\LogicException if the node has no form ancestor'); $this->assertTrue(true, '__construct() throws a \\LogicException if the node has no form ancestor');
} }
try { try {
$form = new Form($nodes->item(1), 'http://example.com'); new Form($nodes->item(1), 'http://example.com');
$this->fail('__construct() throws a \\LogicException if the input type is not submit, button, or image'); $this->fail('__construct() throws a \\LogicException if the input type is not submit, button, or image');
} catch (\LogicException $e) { } catch (\LogicException $e) {
$this->assertTrue(true, '__construct() throws a \\LogicException if the input type is not submit, button, or image'); $this->assertTrue(true, '__construct() throws a \\LogicException if the input type is not submit, button, or image');
@ -55,7 +55,7 @@ class FormTest extends TestCase
$nodes = $dom->getElementsByTagName('button'); $nodes = $dom->getElementsByTagName('button');
try { try {
$form = new Form($nodes->item(0), 'http://example.com'); new Form($nodes->item(0), 'http://example.com');
$this->fail('__construct() throws a \\LogicException if the node has no form ancestor'); $this->fail('__construct() throws a \\LogicException if the node has no form ancestor');
} catch (\LogicException $e) { } catch (\LogicException $e) {
$this->assertTrue(true, '__construct() throws a \\LogicException if the node has no form ancestor'); $this->assertTrue(true, '__construct() throws a \\LogicException if the node has no form ancestor');
@ -63,11 +63,19 @@ class FormTest extends TestCase
} }
/** /**
* __construct() should throw \\LogicException if the form attribute is invalid. * @dataProvider constructorThrowsExceptionIfNoRelatedFormProvider
*
* __construct() should throw a \LogicException if the form attribute is invalid.
*/ */
public function testConstructorThrowsExceptionIfNoRelatedForm() public function testConstructorThrowsExceptionIfNoRelatedForm(\DOMElement $node)
{ {
$this->expectException('LogicException'); $this->expectException('LogicException');
new Form($node, 'http://example.com');
}
public function constructorThrowsExceptionIfNoRelatedFormProvider()
{
$dom = new \DOMDocument(); $dom = new \DOMDocument();
$dom->loadHTML(' $dom->loadHTML('
<html> <html>
@ -81,8 +89,10 @@ class FormTest extends TestCase
$nodes = $dom->getElementsByTagName('input'); $nodes = $dom->getElementsByTagName('input');
$form = new Form($nodes->item(0), 'http://example.com'); return [
$form = new Form($nodes->item(1), 'http://example.com'); [$nodes->item(0)],
[$nodes->item(1)],
];
} }
public function testConstructorLoadsOnlyFieldsOfTheRightForm() public function testConstructorLoadsOnlyFieldsOfTheRightForm()

View File

@ -37,10 +37,6 @@ class RegisterListenersPassTest extends TestCase
public function testValidEventSubscriber() public function testValidEventSubscriber()
{ {
$services = [
'my_event_subscriber' => [0 => []],
];
$builder = new ContainerBuilder(); $builder = new ContainerBuilder();
$eventDispatcherDefinition = $builder->register('event_dispatcher'); $eventDispatcherDefinition = $builder->register('event_dispatcher');
$builder->register('my_event_subscriber', 'Symfony\Component\EventDispatcher\Tests\DependencyInjection\SubscriberService') $builder->register('my_event_subscriber', 'Symfony\Component\EventDispatcher\Tests\DependencyInjection\SubscriberService')

View File

@ -98,7 +98,7 @@ class ExpressionLanguageTest extends TestCase
$this->expectException('InvalidArgumentException'); $this->expectException('InvalidArgumentException');
$this->expectExceptionMessage('Cache argument has to implement Psr\Cache\CacheItemPoolInterface.'); $this->expectExceptionMessage('Cache argument has to implement Psr\Cache\CacheItemPoolInterface.');
$cacheMock = $this->getMockBuilder('Psr\Cache\CacheItemSpoolInterface')->getMock(); $cacheMock = $this->getMockBuilder('Psr\Cache\CacheItemSpoolInterface')->getMock();
$expressionLanguage = new ExpressionLanguage($cacheMock); new ExpressionLanguage($cacheMock);
} }
public function testConstantFunction() public function testConstantFunction()
@ -196,7 +196,7 @@ class ExpressionLanguageTest extends TestCase
$cacheMock = $this->getMockBuilder('Psr\Cache\CacheItemPoolInterface')->getMock(); $cacheMock = $this->getMockBuilder('Psr\Cache\CacheItemPoolInterface')->getMock();
$cacheItemMock = $this->getMockBuilder('Psr\Cache\CacheItemInterface')->getMock(); $cacheItemMock = $this->getMockBuilder('Psr\Cache\CacheItemInterface')->getMock();
$expressionLanguage = new ExpressionLanguage($cacheMock); $expressionLanguage = new ExpressionLanguage($cacheMock);
$savedParsedExpressions = []; $savedParsedExpression = null;
$cacheMock $cacheMock
->expects($this->exactly(2)) ->expects($this->exactly(2))

View File

@ -68,7 +68,7 @@ class ParserCacheAdapterTest extends TestCase
->willReturn($value) ->willReturn($value)
; ;
$cacheItem = $parserCacheAdapter->save($cacheItemMock); $parserCacheAdapter->save($cacheItemMock);
} }
public function testGetItems() public function testGetItems()

View File

@ -181,10 +181,10 @@ class DateTimeToLocalizedStringTransformerTest extends TestCase
public function testTransformWrapsIntlErrors() public function testTransformWrapsIntlErrors()
{ {
$transformer = new DateTimeToLocalizedStringTransformer();
$this->markTestIncomplete('Checking for intl errors needs to be reimplemented'); $this->markTestIncomplete('Checking for intl errors needs to be reimplemented');
$transformer = new DateTimeToLocalizedStringTransformer();
// HOW TO REPRODUCE? // HOW TO REPRODUCE?
//$this->expectException('Symfony\Component\Form\Extension\Core\DataTransformer\TransformationFailedException'); //$this->expectException('Symfony\Component\Form\Extension\Core\DataTransformer\TransformationFailedException');

View File

@ -153,7 +153,7 @@ class UploadedFileTest extends TestCase
UPLOAD_ERR_OK UPLOAD_ERR_OK
); );
$movedFile = $file->move(__DIR__.'/Fixtures/directory'); $file->move(__DIR__.'/Fixtures/directory');
} }
public function testMoveLocalFileIsAllowedInTestMode() public function testMoveLocalFileIsAllowedInTestMode()

View File

@ -59,7 +59,7 @@ class HeaderBagTest extends TestCase
{ {
$this->expectException('RuntimeException'); $this->expectException('RuntimeException');
$bag = new HeaderBag(['foo' => 'Tue']); $bag = new HeaderBag(['foo' => 'Tue']);
$headerDate = $bag->getDate('foo'); $bag->getDate('foo');
} }
public function testGetCacheControlHeader() public function testGetCacheControlHeader()

View File

@ -29,13 +29,13 @@ class RedirectResponseTest extends TestCase
public function testRedirectResponseConstructorNullUrl() public function testRedirectResponseConstructorNullUrl()
{ {
$this->expectException('InvalidArgumentException'); $this->expectException('InvalidArgumentException');
$response = new RedirectResponse(null); new RedirectResponse(null);
} }
public function testRedirectResponseConstructorWrongStatusCode() public function testRedirectResponseConstructorWrongStatusCode()
{ {
$this->expectException('InvalidArgumentException'); $this->expectException('InvalidArgumentException');
$response = new RedirectResponse('foo.bar', 404); new RedirectResponse('foo.bar', 404);
} }
public function testGenerateLocationHeader() public function testGenerateLocationHeader()

View File

@ -41,7 +41,7 @@ class NativeFileSessionHandlerTest extends TestCase
*/ */
public function testConstructSavePath($savePath, $expectedSavePath, $path) public function testConstructSavePath($savePath, $expectedSavePath, $path)
{ {
$handler = new NativeFileSessionHandler($savePath); new NativeFileSessionHandler($savePath);
$this->assertEquals($expectedSavePath, ini_get('session.save_path')); $this->assertEquals($expectedSavePath, ini_get('session.save_path'));
$this->assertDirectoryExists(realpath($path)); $this->assertDirectoryExists(realpath($path));
@ -62,13 +62,13 @@ class NativeFileSessionHandlerTest extends TestCase
public function testConstructException() public function testConstructException()
{ {
$this->expectException('InvalidArgumentException'); $this->expectException('InvalidArgumentException');
$handler = new NativeFileSessionHandler('something;invalid;with;too-many-args'); new NativeFileSessionHandler('something;invalid;with;too-many-args');
} }
public function testConstructDefault() public function testConstructDefault()
{ {
$path = ini_get('session.save_path'); $path = ini_get('session.save_path');
$storage = new NativeSessionStorage(['name' => 'TESTING'], new NativeFileSessionHandler()); new NativeSessionStorage(['name' => 'TESTING'], new NativeFileSessionHandler());
$this->assertEquals($path, ini_get('session.save_path')); $this->assertEquals($path, ini_get('session.save_path'));
} }

View File

@ -28,7 +28,7 @@ class NullSessionHandlerTest extends TestCase
{ {
public function testSaveHandlers() public function testSaveHandlers()
{ {
$storage = $this->getStorage(); $this->getStorage();
$this->assertEquals('user', ini_get('session.save_handler')); $this->assertEquals('user', ini_get('session.save_handler'));
} }

View File

@ -54,7 +54,7 @@ class PdoSessionHandlerTest extends TestCase
$pdo = $this->getMemorySqlitePdo(); $pdo = $this->getMemorySqlitePdo();
$pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_SILENT); $pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_SILENT);
$storage = new PdoSessionHandler($pdo); new PdoSessionHandler($pdo);
} }
public function testInexistentTable() public function testInexistentTable()

View File

@ -145,7 +145,7 @@ class NativeSessionStorageTest extends TestCase
{ {
$this->iniSet('session.cache_limiter', 'nocache'); $this->iniSet('session.cache_limiter', 'nocache');
$storage = new NativeSessionStorage(); new NativeSessionStorage();
$this->assertEquals('', ini_get('session.cache_limiter')); $this->assertEquals('', ini_get('session.cache_limiter'));
} }
@ -153,7 +153,7 @@ class NativeSessionStorageTest extends TestCase
{ {
$this->iniSet('session.cache_limiter', 'nocache'); $this->iniSet('session.cache_limiter', 'nocache');
$storage = new NativeSessionStorage(['cache_limiter' => 'public']); new NativeSessionStorage(['cache_limiter' => 'public']);
$this->assertEquals('public', ini_get('session.cache_limiter')); $this->assertEquals('public', ini_get('session.cache_limiter'));
} }

View File

@ -49,7 +49,6 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter
} }
} }
$content = null;
try { try {
$content = $request->getContent(); $content = $request->getContent();
} catch (\LogicException $e) { } catch (\LogicException $e) {
@ -59,7 +58,6 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter
$sessionMetadata = []; $sessionMetadata = [];
$sessionAttributes = []; $sessionAttributes = [];
$session = null;
$flashes = []; $flashes = [];
if ($request->hasSession()) { if ($request->hasSession()) {
$session = $request->getSession(); $session = $request->getSession();

View File

@ -130,7 +130,6 @@ class ResponseCacheStrategy implements ResponseCacheStrategyInterface
$response->headers->set('Cache-Control', implode(', ', array_keys($flags))); $response->headers->set('Cache-Control', implode(', ', array_keys($flags)));
$maxAge = null; $maxAge = null;
$sMaxage = null;
if (is_numeric($this->ageDirectives['max-age'])) { if (is_numeric($this->ageDirectives['max-age'])) {
$maxAge = $this->ageDirectives['max-age'] + $this->age; $maxAge = $this->ageDirectives['max-age'] + $this->age;

View File

@ -256,7 +256,7 @@ class RegisterControllerArgumentLocatorsPassTest extends TestCase
public function testControllersAreMadePublic() public function testControllersAreMadePublic()
{ {
$container = new ContainerBuilder(); $container = new ContainerBuilder();
$resolver = $container->register('argument_resolver.service')->addArgument([]); $container->register('argument_resolver.service')->addArgument([]);
$container->register('foo', ArgumentWithoutTypeController::class) $container->register('foo', ArgumentWithoutTypeController::class)
->setPublic(false) ->setPublic(false)

View File

@ -52,7 +52,7 @@ class StoreTest extends TestCase
public function testUnlockFileThatDoesExist() public function testUnlockFileThatDoesExist()
{ {
$cacheKey = $this->storeSimpleEntry(); $this->storeSimpleEntry();
$this->store->lock($this->request); $this->store->lock($this->request);
$this->assertTrue($this->store->unlock($this->request)); $this->assertTrue($this->store->unlock($this->request));
@ -92,7 +92,7 @@ class StoreTest extends TestCase
{ {
$cacheKey = $this->storeSimpleEntry(); $cacheKey = $this->storeSimpleEntry();
$entries = $this->getStoreMetadata($cacheKey); $entries = $this->getStoreMetadata($cacheKey);
list($req, $res) = $entries[0]; list(, $res) = $entries[0];
$this->assertEquals('en9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08', $res['x-content-digest'][0]); $this->assertEquals('en9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08', $res['x-content-digest'][0]);
} }
@ -208,7 +208,7 @@ class StoreTest extends TestCase
{ {
$req1 = Request::create('/test', 'get', [], [], [], ['HTTP_FOO' => 'Foo', 'HTTP_BAR' => 'Bar']); $req1 = Request::create('/test', 'get', [], [], [], ['HTTP_FOO' => 'Foo', 'HTTP_BAR' => 'Bar']);
$res1 = new Response('test 1', 200, ['Vary' => 'Foo Bar']); $res1 = new Response('test 1', 200, ['Vary' => 'Foo Bar']);
$key = $this->store->write($req1, $res1); $this->store->write($req1, $res1);
$this->assertEquals($this->getStorePath('en'.hash('sha256', 'test 1')), $this->store->lookup($req1)->getContent()); $this->assertEquals($this->getStorePath('en'.hash('sha256', 'test 1')), $this->store->lookup($req1)->getContent());
$req2 = Request::create('/test', 'get', [], [], [], ['HTTP_FOO' => 'Bling', 'HTTP_BAR' => 'Bam']); $req2 = Request::create('/test', 'get', [], [], [], ['HTTP_FOO' => 'Bling', 'HTTP_BAR' => 'Bam']);
@ -229,7 +229,7 @@ class StoreTest extends TestCase
$req = Request::create('/test', 'get', [], [], [], ['HTTP_FOO' => 'Foo', 'HTTP_BAR' => 'Bar']); $req = Request::create('/test', 'get', [], [], [], ['HTTP_FOO' => 'Foo', 'HTTP_BAR' => 'Bar']);
$this->assertTrue($this->store->lock($req)); $this->assertTrue($this->store->lock($req));
$path = $this->store->lock($req); $this->store->lock($req);
$this->assertTrue($this->store->isLocked($req)); $this->assertTrue($this->store->isLocked($req));
$this->store->unlock($req); $this->store->unlock($req);

View File

@ -132,9 +132,6 @@ class ExecutableFinderTest extends TestCase
$this->assertSamePath(PHP_BINARY, $result); $this->assertSamePath(PHP_BINARY, $result);
} }
/**
* @requires PHP 5.4
*/
public function testFindBatchExecutableOnWindows() public function testFindBatchExecutableOnWindows()
{ {
if (ini_get('open_basedir')) { if (ini_get('open_basedir')) {

View File

@ -19,7 +19,7 @@ class RouteTest extends TestCase
public function testInvalidRouteParameter() public function testInvalidRouteParameter()
{ {
$this->expectException('BadMethodCallException'); $this->expectException('BadMethodCallException');
$route = new Route(['foo' => 'bar']); new Route(['foo' => 'bar']);
} }
/** /**

View File

@ -6,7 +6,7 @@ trait FooTrait
{ {
public function doBar() public function doBar()
{ {
$baz = self::class; self::class;
if (true) { if (true) {
} }
} }

View File

@ -135,7 +135,7 @@ class PhpGeneratorDumperTest extends TestCase
include $this->testTmpFilepath; include $this->testTmpFilepath;
$projectUrlGenerator = new \NonExistingRoutesUrlGenerator(new RequestContext()); $projectUrlGenerator = new \NonExistingRoutesUrlGenerator(new RequestContext());
$url = $projectUrlGenerator->generate('NonExisting', []); $projectUrlGenerator->generate('NonExisting', []);
} }
public function testDumpForRouteWithDefaults() public function testDumpForRouteWithDefaults()

View File

@ -35,9 +35,6 @@ class AnnotationFileLoaderTest extends AbstractAnnotationLoaderTest
$this->loader->load(__DIR__.'/../Fixtures/AnnotatedClasses/FooClass.php'); $this->loader->load(__DIR__.'/../Fixtures/AnnotatedClasses/FooClass.php');
} }
/**
* @requires PHP 5.4
*/
public function testLoadTraitWithClassConstant() public function testLoadTraitWithClassConstant()
{ {
$this->reader->expects($this->never())->method('getClassAnnotation'); $this->reader->expects($this->never())->method('getClassAnnotation');

View File

@ -248,7 +248,7 @@ class RouteCompilerTest extends TestCase
$this->expectException('LogicException'); $this->expectException('LogicException');
$route = new Route('/{name}/{name}'); $route = new Route('/{name}/{name}');
$compiled = $route->compile(); $route->compile();
} }
public function testRouteCharsetMismatch() public function testRouteCharsetMismatch()
@ -256,7 +256,7 @@ class RouteCompilerTest extends TestCase
$this->expectException('LogicException'); $this->expectException('LogicException');
$route = new Route("/\xE9/{bar}", [], ['bar' => '.'], ['utf8' => true]); $route = new Route("/\xE9/{bar}", [], ['bar' => '.'], ['utf8' => true]);
$compiled = $route->compile(); $route->compile();
} }
public function testRequirementCharsetMismatch() public function testRequirementCharsetMismatch()
@ -264,7 +264,7 @@ class RouteCompilerTest extends TestCase
$this->expectException('LogicException'); $this->expectException('LogicException');
$route = new Route('/foo/{bar}', [], ['bar' => "\xE9"], ['utf8' => true]); $route = new Route('/foo/{bar}', [], ['bar' => "\xE9"], ['utf8' => true]);
$compiled = $route->compile(); $route->compile();
} }
public function testRouteWithFragmentAsPathParameter() public function testRouteWithFragmentAsPathParameter()
@ -272,7 +272,7 @@ class RouteCompilerTest extends TestCase
$this->expectException('InvalidArgumentException'); $this->expectException('InvalidArgumentException');
$route = new Route('/{_fragment}'); $route = new Route('/{_fragment}');
$compiled = $route->compile(); $route->compile();
} }
/** /**

View File

@ -117,7 +117,7 @@ class EncoderFactoryTest extends TestCase
$user = new EncAwareUser('user', 'pass'); $user = new EncAwareUser('user', 'pass');
$user->encoderName = 'invalid_encoder_name'; $user->encoderName = 'invalid_encoder_name';
$encoder = $factory->getEncoder($user); $factory->getEncoder($user);
} }
public function testGetEncoderForEncoderAwareWithClassName() public function testGetEncoderForEncoderAwareWithClassName()

View File

@ -192,7 +192,7 @@ class GuardAuthenticationProviderTest extends TestCase
$token->setAuthenticated(false); $token->setAuthenticated(false);
$provider = new GuardAuthenticationProvider([], $this->userProvider, $providerKey, $this->userChecker); $provider = new GuardAuthenticationProvider([], $this->userProvider, $providerKey, $this->userChecker);
$actualToken = $provider->authenticate($token); $provider->authenticate($token);
} }
public function testSupportsChecksGuardAuthenticatorsTokenOrigin() public function testSupportsChecksGuardAuthenticatorsTokenOrigin()

View File

@ -20,7 +20,7 @@ class LogoutListenerTest extends TestCase
{ {
public function testHandleUnmatchedPath() public function testHandleUnmatchedPath()
{ {
list($listener, $tokenStorage, $httpUtils, $options) = $this->getListener(); list($listener, , $httpUtils, $options) = $this->getListener();
list($event, $request) = $this->getGetResponseEvent(); list($event, $request) = $this->getGetResponseEvent();
@ -130,7 +130,7 @@ class LogoutListenerTest extends TestCase
$this->expectException('RuntimeException'); $this->expectException('RuntimeException');
$successHandler = $this->getSuccessHandler(); $successHandler = $this->getSuccessHandler();
list($listener, $tokenStorage, $httpUtils, $options) = $this->getListener($successHandler); list($listener, , $httpUtils, $options) = $this->getListener($successHandler);
list($event, $request) = $this->getGetResponseEvent(); list($event, $request) = $this->getGetResponseEvent();
@ -152,7 +152,7 @@ class LogoutListenerTest extends TestCase
$this->expectException('Symfony\Component\Security\Core\Exception\LogoutException'); $this->expectException('Symfony\Component\Security\Core\Exception\LogoutException');
$tokenManager = $this->getTokenManager(); $tokenManager = $this->getTokenManager();
list($listener, $tokenStorage, $httpUtils, $options) = $this->getListener(null, $tokenManager); list($listener, , $httpUtils, $options) = $this->getListener(null, $tokenManager);
list($event, $request) = $this->getGetResponseEvent(); list($event, $request) = $this->getGetResponseEvent();

View File

@ -221,7 +221,7 @@ class RememberMeListenerTest extends TestCase
public function testSessionStrategy() public function testSessionStrategy()
{ {
list($listener, $tokenStorage, $service, $manager, , $dispatcher, $sessionStrategy) = $this->getListener(false, true, true); list($listener, $tokenStorage, $service, $manager, , , $sessionStrategy) = $this->getListener(false, true, true);
$tokenStorage $tokenStorage
->expects($this->once()) ->expects($this->once())
@ -286,7 +286,7 @@ class RememberMeListenerTest extends TestCase
public function testSessionIsMigratedByDefault() public function testSessionIsMigratedByDefault()
{ {
list($listener, $tokenStorage, $service, $manager, , $dispatcher, $sessionStrategy) = $this->getListener(false, true, false); list($listener, $tokenStorage, $service, $manager) = $this->getListener(false, true, false);
$tokenStorage $tokenStorage
->expects($this->once()) ->expects($this->once())

View File

@ -60,7 +60,7 @@ class RemoteUserAuthenticationListenerTest extends TestCase
$method = new \ReflectionMethod($listener, 'getPreAuthenticatedData'); $method = new \ReflectionMethod($listener, 'getPreAuthenticatedData');
$method->setAccessible(true); $method->setAccessible(true);
$result = $method->invokeArgs($listener, [$request]); $method->invokeArgs($listener, [$request]);
} }
public function testGetPreAuthenticatedDataWithDifferentKeys() public function testGetPreAuthenticatedDataWithDifferentKeys()

View File

@ -98,7 +98,7 @@ class X509AuthenticationListenerTest extends TestCase
$method = new \ReflectionMethod($listener, 'getPreAuthenticatedData'); $method = new \ReflectionMethod($listener, 'getPreAuthenticatedData');
$method->setAccessible(true); $method->setAccessible(true);
$result = $method->invokeArgs($listener, [$request]); $method->invokeArgs($listener, [$request]);
} }
public function testGetPreAuthenticatedDataWithDifferentKeys() public function testGetPreAuthenticatedDataWithDifferentKeys()

View File

@ -48,8 +48,6 @@ class FirewallTest extends TestCase
public function testOnKernelRequestStopsWhenThereIsAResponse() public function testOnKernelRequestStopsWhenThereIsAResponse()
{ {
$response = new Response();
$first = $this->getMockBuilder('Symfony\Component\Security\Http\Firewall\ListenerInterface')->getMock(); $first = $this->getMockBuilder('Symfony\Component\Security\Http\Firewall\ListenerInterface')->getMock();
$first $first
->expects($this->once()) ->expects($this->once())

View File

@ -65,8 +65,6 @@ class ResponseListenerTest extends TestCase
public function testItSubscribesToTheOnKernelResponseEvent() public function testItSubscribesToTheOnKernelResponseEvent()
{ {
$listener = new ResponseListener();
$this->assertSame([KernelEvents::RESPONSE => 'onKernelResponse'], ResponseListener::getSubscribedEvents()); $this->assertSame([KernelEvents::RESPONSE => 'onKernelResponse'], ResponseListener::getSubscribedEvents());
} }

View File

@ -27,7 +27,6 @@ class FilesystemLoaderTest extends TestCase
public function testConstructor() public function testConstructor()
{ {
$pathPattern = self::$fixturesPath.'/templates/%name%.%engine%'; $pathPattern = self::$fixturesPath.'/templates/%name%.%engine%';
$path = self::$fixturesPath.'/templates';
$loader = new ProjectTemplateLoader2($pathPattern); $loader = new ProjectTemplateLoader2($pathPattern);
$this->assertEquals([$pathPattern], $loader->getTemplatePathPatterns(), '__construct() takes a path as its second argument'); $this->assertEquals([$pathPattern], $loader->getTemplatePathPatterns(), '__construct() takes a path as its second argument');
$loader = new ProjectTemplateLoader2([$pathPattern]); $loader = new ProjectTemplateLoader2([$pathPattern]);

View File

@ -60,7 +60,7 @@ class FileValidator extends ConstraintValidator
$binaryFormat = null === $constraint->binaryFormat ? true : $constraint->binaryFormat; $binaryFormat = null === $constraint->binaryFormat ? true : $constraint->binaryFormat;
} }
list($sizeAsString, $limitAsString, $suffix) = $this->factorizeSizes(0, $limitInBytes, $binaryFormat); list(, $limitAsString, $suffix) = $this->factorizeSizes(0, $limitInBytes, $binaryFormat);
$this->context->buildViolation($constraint->uploadIniSizeErrorMessage) $this->context->buildViolation($constraint->uploadIniSizeErrorMessage)
->setParameter('{{ limit }}', $limitAsString) ->setParameter('{{ limit }}', $limitAsString)
->setParameter('{{ suffix }}', $suffix) ->setParameter('{{ suffix }}', $suffix)

View File

@ -450,7 +450,7 @@ abstract class FileValidatorTest extends ConstraintValidatorTestCase
$reflection = new \ReflectionClass(\get_class(new FileValidator())); $reflection = new \ReflectionClass(\get_class(new FileValidator()));
$method = $reflection->getMethod('factorizeSizes'); $method = $reflection->getMethod('factorizeSizes');
$method->setAccessible(true); $method->setAccessible(true);
list($sizeAsString, $limit, $suffix) = $method->invokeArgs(new FileValidator(), [0, UploadedFile::getMaxFilesize(), false]); list(, $limit, $suffix) = $method->invokeArgs(new FileValidator(), [0, UploadedFile::getMaxFilesize(), false]);
// it correctly parses the maxSize option and not only uses simple string comparison // it correctly parses the maxSize option and not only uses simple string comparison
// 1000M should be bigger than the ini value // 1000M should be bigger than the ini value

View File

@ -11,7 +11,7 @@ class DefinitionBuilderTest extends TestCase
public function testAddPlaceInvalidName() public function testAddPlaceInvalidName()
{ {
$this->expectException('Symfony\Component\Workflow\Exception\InvalidArgumentException'); $this->expectException('Symfony\Component\Workflow\Exception\InvalidArgumentException');
$builder = new DefinitionBuilder(['a"', 'b']); new DefinitionBuilder(['a"', 'b']);
} }
public function testSetInitialPlace() public function testSetInitialPlace()

View File

@ -22,7 +22,7 @@ class DefinitionTest extends TestCase
{ {
$this->expectException('Symfony\Component\Workflow\Exception\InvalidArgumentException'); $this->expectException('Symfony\Component\Workflow\Exception\InvalidArgumentException');
$places = ['a"', 'e"']; $places = ['a"', 'e"'];
$definition = new Definition($places, []); new Definition($places, []);
} }
public function testSetInitialPlace() public function testSetInitialPlace()
@ -37,7 +37,7 @@ class DefinitionTest extends TestCase
{ {
$this->expectException('Symfony\Component\Workflow\Exception\LogicException'); $this->expectException('Symfony\Component\Workflow\Exception\LogicException');
$this->expectExceptionMessage('Place "d" cannot be the initial place as it does not exist.'); $this->expectExceptionMessage('Place "d" cannot be the initial place as it does not exist.');
$definition = new Definition([], [], 'd'); new Definition([], [], 'd');
} }
public function testAddTransition() public function testAddTransition()

View File

@ -11,7 +11,7 @@ class TransitionTest extends TestCase
{ {
$this->expectException('Symfony\Component\Workflow\Exception\InvalidArgumentException'); $this->expectException('Symfony\Component\Workflow\Exception\InvalidArgumentException');
$this->expectExceptionMessage('The transition "foo.bar" contains invalid characters.'); $this->expectExceptionMessage('The transition "foo.bar" contains invalid characters.');
$transition = new Transition('foo.bar', 'a', 'b'); new Transition('foo.bar', 'a', 'b');
} }
public function testConstructor() public function testConstructor()

View File

@ -219,7 +219,7 @@ class WorkflowTest extends TestCase
$this->assertFalse($marking->has('b')); $this->assertFalse($marking->has('b'));
$this->assertFalse($marking->has('c')); $this->assertFalse($marking->has('c'));
$marking = $workflow->apply($subject, 'a_to_bc'); $workflow->apply($subject, 'a_to_bc');
$marking = $workflow->apply($subject, 'b_to_c'); $marking = $workflow->apply($subject, 'b_to_c');
$this->assertFalse($marking->has('a')); $this->assertFalse($marking->has('a'));
@ -291,7 +291,7 @@ class WorkflowTest extends TestCase
'workflow.workflow_name.announce.t2', 'workflow.workflow_name.announce.t2',
]; ];
$marking = $workflow->apply($subject, 't1'); $workflow->apply($subject, 't1');
$this->assertSame($eventNameExpected, $eventDispatcher->dispatchedEvents); $this->assertSame($eventNameExpected, $eventDispatcher->dispatchedEvents);
} }
@ -330,7 +330,7 @@ class WorkflowTest extends TestCase
'workflow.workflow_name.announce', 'workflow.workflow_name.announce',
]; ];
$marking = $workflow->apply($subject, 'a-b'); $workflow->apply($subject, 'a-b');
$this->assertSame($eventNameExpected, $eventDispatcher->dispatchedEvents); $this->assertSame($eventNameExpected, $eventDispatcher->dispatchedEvents);
} }

View File

@ -85,7 +85,7 @@ YAML;
$filename = $this->createFile(''); $filename = $this->createFile('');
unlink($filename); unlink($filename);
$ret = $tester->execute(['filename' => $filename], ['decorated' => false]); $tester->execute(['filename' => $filename], ['decorated' => false]);
} }
/** /**

View File

@ -110,7 +110,7 @@ class ParserTest extends TestCase
foreach ($yamls as $yaml) { foreach ($yamls as $yaml) {
try { try {
$content = $this->parser->parse($yaml); $this->parser->parse($yaml);
$this->fail('YAML files must not contain tabs'); $this->fail('YAML files must not contain tabs');
} catch (\Exception $e) { } catch (\Exception $e) {