Merge branch '4.3' into 4.4
* 4.3: Use willReturn() instead of will(returnValue()).
This commit is contained in:
commit
c62032a730
@ -18,8 +18,6 @@ return PhpCsFixer\Config::create()
|
||||
'native_function_invocation' => ['include' => ['@compiler_optimized'], 'scope' => 'namespaced'],
|
||||
// Part of future @Symfony ruleset in PHP-CS-Fixer To be removed from the config file once upgrading
|
||||
'phpdoc_types_order' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'],
|
||||
// Part of @Symfony:risky in PHP-CS-Fixer 2.15.0. Incompatible with PHPUnit 4 that is required for Symfony 3.4
|
||||
'php_unit_mock_short_will_return' => false,
|
||||
])
|
||||
->setRiskyAllowed(true)
|
||||
->setFinder(
|
||||
|
@ -166,20 +166,20 @@ class DoctrineDataCollectorTest extends TestCase
|
||||
->getMock();
|
||||
$connection->expects($this->any())
|
||||
->method('getDatabasePlatform')
|
||||
->will($this->returnValue(new MySqlPlatform()));
|
||||
->willReturn(new MySqlPlatform());
|
||||
|
||||
$registry = $this->getMockBuilder('Doctrine\Common\Persistence\ManagerRegistry')->getMock();
|
||||
$registry
|
||||
->expects($this->any())
|
||||
->method('getConnectionNames')
|
||||
->will($this->returnValue(['default' => 'doctrine.dbal.default_connection']));
|
||||
->willReturn(['default' => 'doctrine.dbal.default_connection']);
|
||||
$registry
|
||||
->expects($this->any())
|
||||
->method('getManagerNames')
|
||||
->will($this->returnValue(['default' => 'doctrine.orm.default_entity_manager']));
|
||||
->willReturn(['default' => 'doctrine.orm.default_entity_manager']);
|
||||
$registry->expects($this->any())
|
||||
->method('getConnection')
|
||||
->will($this->returnValue($connection));
|
||||
->willReturn($connection);
|
||||
|
||||
$logger = $this->getMockBuilder('Doctrine\DBAL\Logging\DebugStack')->getMock();
|
||||
$logger->queries = $queries;
|
||||
|
@ -44,9 +44,9 @@ class DoctrineExtensionTest extends TestCase
|
||||
|
||||
$this->extension->expects($this->any())
|
||||
->method('getObjectManagerElementName')
|
||||
->will($this->returnCallback(function ($name) {
|
||||
->willReturnCallback(function ($name) {
|
||||
return 'doctrine.orm.'.$name;
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -34,47 +34,47 @@ class DoctrineOrmTypeGuesserTest extends TestCase
|
||||
// Simple field, not nullable
|
||||
$classMetadata = $this->getMockBuilder('Doctrine\ORM\Mapping\ClassMetadata')->disableOriginalConstructor()->getMock();
|
||||
$classMetadata->fieldMappings['field'] = true;
|
||||
$classMetadata->expects($this->once())->method('isNullable')->with('field')->will($this->returnValue(false));
|
||||
$classMetadata->expects($this->once())->method('isNullable')->with('field')->willReturn(false);
|
||||
|
||||
$return[] = [$classMetadata, new ValueGuess(true, Guess::HIGH_CONFIDENCE)];
|
||||
|
||||
// Simple field, nullable
|
||||
$classMetadata = $this->getMockBuilder('Doctrine\ORM\Mapping\ClassMetadata')->disableOriginalConstructor()->getMock();
|
||||
$classMetadata->fieldMappings['field'] = true;
|
||||
$classMetadata->expects($this->once())->method('isNullable')->with('field')->will($this->returnValue(true));
|
||||
$classMetadata->expects($this->once())->method('isNullable')->with('field')->willReturn(true);
|
||||
|
||||
$return[] = [$classMetadata, new ValueGuess(false, Guess::MEDIUM_CONFIDENCE)];
|
||||
|
||||
// One-to-one, nullable (by default)
|
||||
$classMetadata = $this->getMockBuilder('Doctrine\ORM\Mapping\ClassMetadata')->disableOriginalConstructor()->getMock();
|
||||
$classMetadata->expects($this->once())->method('isAssociationWithSingleJoinColumn')->with('field')->will($this->returnValue(true));
|
||||
$classMetadata->expects($this->once())->method('isAssociationWithSingleJoinColumn')->with('field')->willReturn(true);
|
||||
|
||||
$mapping = ['joinColumns' => [[]]];
|
||||
$classMetadata->expects($this->once())->method('getAssociationMapping')->with('field')->will($this->returnValue($mapping));
|
||||
$classMetadata->expects($this->once())->method('getAssociationMapping')->with('field')->willReturn($mapping);
|
||||
|
||||
$return[] = [$classMetadata, new ValueGuess(false, Guess::HIGH_CONFIDENCE)];
|
||||
|
||||
// One-to-one, nullable (explicit)
|
||||
$classMetadata = $this->getMockBuilder('Doctrine\ORM\Mapping\ClassMetadata')->disableOriginalConstructor()->getMock();
|
||||
$classMetadata->expects($this->once())->method('isAssociationWithSingleJoinColumn')->with('field')->will($this->returnValue(true));
|
||||
$classMetadata->expects($this->once())->method('isAssociationWithSingleJoinColumn')->with('field')->willReturn(true);
|
||||
|
||||
$mapping = ['joinColumns' => [['nullable' => true]]];
|
||||
$classMetadata->expects($this->once())->method('getAssociationMapping')->with('field')->will($this->returnValue($mapping));
|
||||
$classMetadata->expects($this->once())->method('getAssociationMapping')->with('field')->willReturn($mapping);
|
||||
|
||||
$return[] = [$classMetadata, new ValueGuess(false, Guess::HIGH_CONFIDENCE)];
|
||||
|
||||
// One-to-one, not nullable
|
||||
$classMetadata = $this->getMockBuilder('Doctrine\ORM\Mapping\ClassMetadata')->disableOriginalConstructor()->getMock();
|
||||
$classMetadata->expects($this->once())->method('isAssociationWithSingleJoinColumn')->with('field')->will($this->returnValue(true));
|
||||
$classMetadata->expects($this->once())->method('isAssociationWithSingleJoinColumn')->with('field')->willReturn(true);
|
||||
|
||||
$mapping = ['joinColumns' => [['nullable' => false]]];
|
||||
$classMetadata->expects($this->once())->method('getAssociationMapping')->with('field')->will($this->returnValue($mapping));
|
||||
$classMetadata->expects($this->once())->method('getAssociationMapping')->with('field')->willReturn($mapping);
|
||||
|
||||
$return[] = [$classMetadata, new ValueGuess(true, Guess::HIGH_CONFIDENCE)];
|
||||
|
||||
// One-to-many, no clue
|
||||
$classMetadata = $this->getMockBuilder('Doctrine\ORM\Mapping\ClassMetadata')->disableOriginalConstructor()->getMock();
|
||||
$classMetadata->expects($this->once())->method('isAssociationWithSingleJoinColumn')->with('field')->will($this->returnValue(false));
|
||||
$classMetadata->expects($this->once())->method('isAssociationWithSingleJoinColumn')->with('field')->willReturn(false);
|
||||
|
||||
$return[] = [$classMetadata, null];
|
||||
|
||||
@ -84,10 +84,10 @@ class DoctrineOrmTypeGuesserTest extends TestCase
|
||||
private function getGuesser(ClassMetadata $classMetadata)
|
||||
{
|
||||
$em = $this->getMockBuilder('Doctrine\Common\Persistence\ObjectManager')->getMock();
|
||||
$em->expects($this->once())->method('getClassMetaData')->with('TestEntity')->will($this->returnValue($classMetadata));
|
||||
$em->expects($this->once())->method('getClassMetaData')->with('TestEntity')->willReturn($classMetadata);
|
||||
|
||||
$registry = $this->getMockBuilder('Doctrine\Common\Persistence\ManagerRegistry')->getMock();
|
||||
$registry->expects($this->once())->method('getManagers')->will($this->returnValue([$em]));
|
||||
$registry->expects($this->once())->method('getManagers')->willReturn([$em]);
|
||||
|
||||
return new DoctrineOrmTypeGuesser($registry);
|
||||
}
|
||||
|
@ -38,11 +38,11 @@ class EntityTypePerformanceTest extends FormPerformanceTestCase
|
||||
|
||||
$manager->expects($this->any())
|
||||
->method('getManager')
|
||||
->will($this->returnValue($this->em));
|
||||
->willReturn($this->em);
|
||||
|
||||
$manager->expects($this->any())
|
||||
->method('getManagerForClass')
|
||||
->will($this->returnValue($this->em));
|
||||
->willReturn($this->em);
|
||||
|
||||
return [
|
||||
new CoreExtension(),
|
||||
|
@ -1087,7 +1087,7 @@ class EntityTypeTest extends BaseTypeTest
|
||||
$this->emRegistry->expects($this->once())
|
||||
->method('getManagerForClass')
|
||||
->with(self::SINGLE_IDENT_CLASS)
|
||||
->will($this->returnValue($this->em));
|
||||
->willReturn($this->em);
|
||||
|
||||
$this->factory->createNamed('name', static::TESTED_TYPE, null, [
|
||||
'class' => self::SINGLE_IDENT_CLASS,
|
||||
@ -1237,7 +1237,7 @@ class EntityTypeTest extends BaseTypeTest
|
||||
$registry->expects($this->any())
|
||||
->method('getManager')
|
||||
->with($this->equalTo($name))
|
||||
->will($this->returnValue($em));
|
||||
->willReturn($em);
|
||||
|
||||
return $registry;
|
||||
}
|
||||
|
@ -188,7 +188,7 @@ class EntityUserProviderTest extends TestCase
|
||||
$manager->expects($this->any())
|
||||
->method('getManager')
|
||||
->with($this->equalTo($name))
|
||||
->will($this->returnValue($em));
|
||||
->willReturn($em);
|
||||
|
||||
return $manager;
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ class UniqueEntityValidatorTest extends ConstraintValidatorTestCase
|
||||
$registry->expects($this->any())
|
||||
->method('getManager')
|
||||
->with($this->equalTo(self::EM_NAME))
|
||||
->will($this->returnValue($em));
|
||||
->willReturn($em);
|
||||
|
||||
return $registry;
|
||||
}
|
||||
@ -104,14 +104,14 @@ class UniqueEntityValidatorTest extends ConstraintValidatorTestCase
|
||||
;
|
||||
$em->expects($this->any())
|
||||
->method('getRepository')
|
||||
->will($this->returnValue($repositoryMock))
|
||||
->willReturn($repositoryMock)
|
||||
;
|
||||
|
||||
$classMetadata = $this->getMockBuilder('Doctrine\Common\Persistence\Mapping\ClassMetadata')->getMock();
|
||||
$classMetadata
|
||||
->expects($this->any())
|
||||
->method('hasField')
|
||||
->will($this->returnValue(true))
|
||||
->willReturn(true)
|
||||
;
|
||||
$reflParser = $this->getMockBuilder('Doctrine\Common\Reflection\StaticReflectionParser')
|
||||
->disableOriginalConstructor()
|
||||
@ -125,12 +125,12 @@ class UniqueEntityValidatorTest extends ConstraintValidatorTestCase
|
||||
$refl
|
||||
->expects($this->any())
|
||||
->method('getValue')
|
||||
->will($this->returnValue(true))
|
||||
->willReturn(true)
|
||||
;
|
||||
$classMetadata->reflFields = ['name' => $refl];
|
||||
$em->expects($this->any())
|
||||
->method('getClassMetadata')
|
||||
->will($this->returnValue($classMetadata))
|
||||
->willReturn($classMetadata)
|
||||
;
|
||||
|
||||
return $em;
|
||||
@ -366,7 +366,7 @@ class UniqueEntityValidatorTest extends ConstraintValidatorTestCase
|
||||
$repository = $this->createRepositoryMock();
|
||||
$repository->expects($this->once())
|
||||
->method('findByCustom')
|
||||
->will($this->returnValue([]))
|
||||
->willReturn([])
|
||||
;
|
||||
$this->em = $this->createEntityManagerMock($repository);
|
||||
$this->registry = $this->createRegistryMock($this->em);
|
||||
@ -394,15 +394,15 @@ class UniqueEntityValidatorTest extends ConstraintValidatorTestCase
|
||||
$repository = $this->createRepositoryMock();
|
||||
$repository->expects($this->once())
|
||||
->method('findByCustom')
|
||||
->will(
|
||||
$this->returnCallback(function () use ($entity) {
|
||||
->willReturnCallback(
|
||||
function () use ($entity) {
|
||||
$returnValue = [
|
||||
$entity,
|
||||
];
|
||||
next($returnValue);
|
||||
|
||||
return $returnValue;
|
||||
})
|
||||
}
|
||||
)
|
||||
;
|
||||
$this->em = $this->createEntityManagerMock($repository);
|
||||
@ -430,7 +430,7 @@ class UniqueEntityValidatorTest extends ConstraintValidatorTestCase
|
||||
$repository = $this->createRepositoryMock();
|
||||
$repository->expects($this->once())
|
||||
->method('findByCustom')
|
||||
->will($this->returnValue($result))
|
||||
->willReturn($result)
|
||||
;
|
||||
$this->em = $this->createEntityManagerMock($repository);
|
||||
$this->registry = $this->createRegistryMock($this->em);
|
||||
@ -564,7 +564,7 @@ class UniqueEntityValidatorTest extends ConstraintValidatorTestCase
|
||||
|
||||
$repository->expects($this->once())
|
||||
->method('findByCustom')
|
||||
->will($this->returnValue([$entity1]))
|
||||
->willReturn([$entity1])
|
||||
;
|
||||
|
||||
$this->em->persist($entity1);
|
||||
@ -635,7 +635,7 @@ class UniqueEntityValidatorTest extends ConstraintValidatorTestCase
|
||||
$repository = $this->createRepositoryMock();
|
||||
$repository
|
||||
->method('find')
|
||||
->will($this->returnValue(null))
|
||||
->willReturn(null)
|
||||
;
|
||||
|
||||
$this->em = $this->createEntityManagerMock($repository);
|
||||
|
@ -50,7 +50,7 @@ class ConsoleHandlerTest extends TestCase
|
||||
$output
|
||||
->expects($this->atLeastOnce())
|
||||
->method('getVerbosity')
|
||||
->will($this->returnValue($verbosity))
|
||||
->willReturn($verbosity)
|
||||
;
|
||||
$handler = new ConsoleHandler($output, true, $map);
|
||||
$this->assertSame($isHandling, $handler->isHandling(['level' => $level]),
|
||||
@ -114,12 +114,12 @@ class ConsoleHandlerTest extends TestCase
|
||||
$output
|
||||
->expects($this->at(0))
|
||||
->method('getVerbosity')
|
||||
->will($this->returnValue(OutputInterface::VERBOSITY_QUIET))
|
||||
->willReturn(OutputInterface::VERBOSITY_QUIET)
|
||||
;
|
||||
$output
|
||||
->expects($this->at(1))
|
||||
->method('getVerbosity')
|
||||
->will($this->returnValue(OutputInterface::VERBOSITY_DEBUG))
|
||||
->willReturn(OutputInterface::VERBOSITY_DEBUG)
|
||||
;
|
||||
$handler = new ConsoleHandler($output);
|
||||
$this->assertFalse($handler->isHandling(['level' => Logger::NOTICE]),
|
||||
@ -144,7 +144,7 @@ class ConsoleHandlerTest extends TestCase
|
||||
$output
|
||||
->expects($this->any())
|
||||
->method('getVerbosity')
|
||||
->will($this->returnValue(OutputInterface::VERBOSITY_DEBUG))
|
||||
->willReturn(OutputInterface::VERBOSITY_DEBUG)
|
||||
;
|
||||
$output
|
||||
->expects($this->once())
|
||||
|
@ -93,10 +93,10 @@ class WebProcessorTest extends TestCase
|
||||
->getMock();
|
||||
$event->expects($this->any())
|
||||
->method('isMasterRequest')
|
||||
->will($this->returnValue(true));
|
||||
->willReturn(true);
|
||||
$event->expects($this->any())
|
||||
->method('getRequest')
|
||||
->will($this->returnValue($request));
|
||||
->willReturn($request);
|
||||
|
||||
return [$event, $server];
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ class HttpKernelExtensionTest extends TestCase
|
||||
protected function getFragmentHandler($return)
|
||||
{
|
||||
$strategy = $this->getMockBuilder('Symfony\\Component\\HttpKernel\\Fragment\\FragmentRendererInterface')->getMock();
|
||||
$strategy->expects($this->once())->method('getName')->will($this->returnValue('inline'));
|
||||
$strategy->expects($this->once())->method('getName')->willReturn('inline');
|
||||
$strategy->expects($this->once())->method('render')->will($return);
|
||||
|
||||
$context = $this->getMockBuilder('Symfony\\Component\\HttpFoundation\\RequestStack')
|
||||
@ -70,7 +70,7 @@ class HttpKernelExtensionTest extends TestCase
|
||||
->getMock()
|
||||
;
|
||||
|
||||
$context->expects($this->any())->method('getCurrentRequest')->will($this->returnValue(Request::create('/')));
|
||||
$context->expects($this->any())->method('getCurrentRequest')->willReturn(Request::create('/'));
|
||||
|
||||
return new FragmentHandler($context, [$strategy], false);
|
||||
}
|
||||
@ -82,9 +82,9 @@ class HttpKernelExtensionTest extends TestCase
|
||||
$twig->addExtension(new HttpKernelExtension());
|
||||
|
||||
$loader = $this->getMockBuilder('Twig\RuntimeLoader\RuntimeLoaderInterface')->getMock();
|
||||
$loader->expects($this->any())->method('load')->will($this->returnValueMap([
|
||||
$loader->expects($this->any())->method('load')->willReturnMap([
|
||||
['Symfony\Bridge\Twig\Extension\HttpKernelRuntime', new HttpKernelRuntime($renderer)],
|
||||
]));
|
||||
]);
|
||||
$twig->addRuntimeLoader($loader);
|
||||
|
||||
return $twig->render('index');
|
||||
|
@ -37,7 +37,7 @@ class TemplateFinderTest extends TestCase
|
||||
$kernel
|
||||
->expects($this->once())
|
||||
->method('getBundles')
|
||||
->will($this->returnValue(['BaseBundle' => new BaseBundle()]))
|
||||
->willReturn(['BaseBundle' => new BaseBundle()])
|
||||
;
|
||||
|
||||
$parser = new TemplateFilenameParser();
|
||||
|
@ -71,13 +71,13 @@ class TemplatePathsCacheWarmerTest extends TestCase
|
||||
$this->templateFinder
|
||||
->expects($this->once())
|
||||
->method('findAllTemplates')
|
||||
->will($this->returnValue([$template]));
|
||||
->willReturn([$template]);
|
||||
|
||||
$this->fileLocator
|
||||
->expects($this->once())
|
||||
->method('locate')
|
||||
->with($template->getPath())
|
||||
->will($this->returnValue(\dirname($this->tmpDir).'/path/to/template.html.twig'));
|
||||
->willReturn(\dirname($this->tmpDir).'/path/to/template.html.twig');
|
||||
|
||||
$warmer = new TemplatePathsCacheWarmer($this->templateFinder, $this->templateLocator);
|
||||
$warmer->warmUp($this->tmpDir);
|
||||
@ -90,7 +90,7 @@ class TemplatePathsCacheWarmerTest extends TestCase
|
||||
$this->templateFinder
|
||||
->expects($this->once())
|
||||
->method('findAllTemplates')
|
||||
->will($this->returnValue([]));
|
||||
->willReturn([]);
|
||||
|
||||
$this->fileLocator
|
||||
->expects($this->never())
|
||||
|
@ -62,11 +62,11 @@ class RouterMatchCommandTest extends TestCase
|
||||
$router
|
||||
->expects($this->any())
|
||||
->method('getRouteCollection')
|
||||
->will($this->returnValue($routeCollection));
|
||||
->willReturn($routeCollection);
|
||||
$router
|
||||
->expects($this->any())
|
||||
->method('getContext')
|
||||
->will($this->returnValue($requestContext));
|
||||
->willReturn($requestContext);
|
||||
|
||||
return $router;
|
||||
}
|
||||
@ -77,9 +77,9 @@ class RouterMatchCommandTest extends TestCase
|
||||
$container
|
||||
->expects($this->atLeastOnce())
|
||||
->method('has')
|
||||
->will($this->returnCallback(function ($id) {
|
||||
->willReturnCallback(function ($id) {
|
||||
return 'console.command_loader' !== $id;
|
||||
}))
|
||||
})
|
||||
;
|
||||
$container
|
||||
->expects($this->any())
|
||||
|
@ -154,26 +154,26 @@ class TranslationDebugCommandTest extends TestCase
|
||||
$translator
|
||||
->expects($this->any())
|
||||
->method('getFallbackLocales')
|
||||
->will($this->returnValue(['en']));
|
||||
->willReturn(['en']);
|
||||
|
||||
$extractor = $this->getMockBuilder('Symfony\Component\Translation\Extractor\ExtractorInterface')->getMock();
|
||||
$extractor
|
||||
->expects($this->any())
|
||||
->method('extract')
|
||||
->will(
|
||||
$this->returnCallback(function ($path, $catalogue) use ($extractedMessages) {
|
||||
->willReturnCallback(
|
||||
function ($path, $catalogue) use ($extractedMessages) {
|
||||
$catalogue->add($extractedMessages);
|
||||
})
|
||||
}
|
||||
);
|
||||
|
||||
$loader = $this->getMockBuilder('Symfony\Component\Translation\Reader\TranslationReader')->getMock();
|
||||
$loader
|
||||
->expects($this->any())
|
||||
->method('read')
|
||||
->will(
|
||||
$this->returnCallback(function ($path, $catalogue) use ($loadedMessages) {
|
||||
->willReturnCallback(
|
||||
function ($path, $catalogue) use ($loadedMessages) {
|
||||
$catalogue->add($loadedMessages);
|
||||
})
|
||||
}
|
||||
);
|
||||
|
||||
if (null === $kernel) {
|
||||
@ -191,13 +191,13 @@ class TranslationDebugCommandTest extends TestCase
|
||||
$kernel
|
||||
->expects($this->any())
|
||||
->method('getBundle')
|
||||
->will($this->returnValueMap($returnValues));
|
||||
->willReturnMap($returnValues);
|
||||
}
|
||||
|
||||
$kernel
|
||||
->expects($this->any())
|
||||
->method('getBundles')
|
||||
->will($this->returnValue([]));
|
||||
->willReturn([]);
|
||||
|
||||
$container = new Container();
|
||||
$container->setParameter('kernel.root_dir', $this->translationDir);
|
||||
@ -205,7 +205,7 @@ class TranslationDebugCommandTest extends TestCase
|
||||
$kernel
|
||||
->expects($this->any())
|
||||
->method('getContainer')
|
||||
->will($this->returnValue($container));
|
||||
->willReturn($container);
|
||||
|
||||
$command = new TranslationDebugCommand($translator, $loader, $extractor, $this->translationDir.'/translations', $this->translationDir.'/templates', $transPaths, $viewsPaths);
|
||||
|
||||
@ -221,7 +221,7 @@ class TranslationDebugCommandTest extends TestCase
|
||||
$bundle
|
||||
->expects($this->any())
|
||||
->method('getPath')
|
||||
->will($this->returnValue($path))
|
||||
->willReturn($path)
|
||||
;
|
||||
|
||||
return $bundle;
|
||||
|
@ -130,36 +130,36 @@ class TranslationUpdateCommandTest extends TestCase
|
||||
$translator
|
||||
->expects($this->any())
|
||||
->method('getFallbackLocales')
|
||||
->will($this->returnValue(['en']));
|
||||
->willReturn(['en']);
|
||||
|
||||
$extractor = $this->getMockBuilder('Symfony\Component\Translation\Extractor\ExtractorInterface')->getMock();
|
||||
$extractor
|
||||
->expects($this->any())
|
||||
->method('extract')
|
||||
->will(
|
||||
$this->returnCallback(function ($path, $catalogue) use ($extractedMessages) {
|
||||
->willReturnCallback(
|
||||
function ($path, $catalogue) use ($extractedMessages) {
|
||||
foreach ($extractedMessages as $domain => $messages) {
|
||||
$catalogue->add($messages, $domain);
|
||||
}
|
||||
})
|
||||
}
|
||||
);
|
||||
|
||||
$loader = $this->getMockBuilder('Symfony\Component\Translation\Reader\TranslationReader')->getMock();
|
||||
$loader
|
||||
->expects($this->any())
|
||||
->method('read')
|
||||
->will(
|
||||
$this->returnCallback(function ($path, $catalogue) use ($loadedMessages) {
|
||||
->willReturnCallback(
|
||||
function ($path, $catalogue) use ($loadedMessages) {
|
||||
$catalogue->add($loadedMessages);
|
||||
})
|
||||
}
|
||||
);
|
||||
|
||||
$writer = $this->getMockBuilder('Symfony\Component\Translation\Writer\TranslationWriter')->getMock();
|
||||
$writer
|
||||
->expects($this->any())
|
||||
->method('getFormats')
|
||||
->will(
|
||||
$this->returnValue(['xlf', 'yml', 'yaml'])
|
||||
->willReturn(
|
||||
['xlf', 'yml', 'yaml']
|
||||
);
|
||||
|
||||
if (null === $kernel) {
|
||||
@ -177,25 +177,25 @@ class TranslationUpdateCommandTest extends TestCase
|
||||
$kernel
|
||||
->expects($this->any())
|
||||
->method('getBundle')
|
||||
->will($this->returnValueMap($returnValues));
|
||||
->willReturnMap($returnValues);
|
||||
}
|
||||
|
||||
$kernel
|
||||
->expects($this->any())
|
||||
->method('getRootDir')
|
||||
->will($this->returnValue($this->translationDir));
|
||||
->willReturn($this->translationDir);
|
||||
|
||||
$kernel
|
||||
->expects($this->any())
|
||||
->method('getBundles')
|
||||
->will($this->returnValue([]));
|
||||
->willReturn([]);
|
||||
|
||||
$container = new Container();
|
||||
$container->setParameter('kernel.root_dir', $this->translationDir);
|
||||
$kernel
|
||||
->expects($this->any())
|
||||
->method('getContainer')
|
||||
->will($this->returnValue($container));
|
||||
->willReturn($container);
|
||||
|
||||
$command = new TranslationUpdateCommand($writer, $loader, $extractor, 'en', $this->translationDir.'/translations', $this->translationDir.'/templates', $transPaths, $viewsPaths);
|
||||
|
||||
@ -211,7 +211,7 @@ class TranslationUpdateCommandTest extends TestCase
|
||||
$bundle
|
||||
->expects($this->any())
|
||||
->method('getPath')
|
||||
->will($this->returnValue($path))
|
||||
->willReturn($path)
|
||||
;
|
||||
|
||||
return $bundle;
|
||||
|
@ -271,7 +271,7 @@ class ApplicationTest extends TestCase
|
||||
->expects($this->atLeastOnce())
|
||||
->method('get')
|
||||
->with($this->equalTo('event_dispatcher'))
|
||||
->will($this->returnValue($dispatcher));
|
||||
->willReturn($dispatcher);
|
||||
}
|
||||
|
||||
$container
|
||||
@ -292,12 +292,12 @@ class ApplicationTest extends TestCase
|
||||
$kernel
|
||||
->expects($this->any())
|
||||
->method('getBundles')
|
||||
->will($this->returnValue($bundles))
|
||||
->willReturn($bundles)
|
||||
;
|
||||
$kernel
|
||||
->expects($this->any())
|
||||
->method('getContainer')
|
||||
->will($this->returnValue($container))
|
||||
->willReturn($container)
|
||||
;
|
||||
|
||||
return $kernel;
|
||||
@ -309,9 +309,9 @@ class ApplicationTest extends TestCase
|
||||
$bundle
|
||||
->expects($this->once())
|
||||
->method('registerCommands')
|
||||
->will($this->returnCallback(function (Application $application) use ($commands) {
|
||||
->willReturnCallback(function (Application $application) use ($commands) {
|
||||
$application->addCommands($commands);
|
||||
}))
|
||||
})
|
||||
;
|
||||
|
||||
return $bundle;
|
||||
|
@ -155,13 +155,13 @@ class ControllerNameParserTest extends TestCase
|
||||
$kernel
|
||||
->expects($this->any())
|
||||
->method('getBundle')
|
||||
->will($this->returnCallback(function ($bundle) use ($bundles) {
|
||||
->willReturnCallback(function ($bundle) use ($bundles) {
|
||||
if (!isset($bundles[$bundle])) {
|
||||
throw new \InvalidArgumentException(sprintf('Invalid bundle name "%s"', $bundle));
|
||||
}
|
||||
|
||||
return $bundles[$bundle];
|
||||
}))
|
||||
})
|
||||
;
|
||||
|
||||
$bundles = [
|
||||
@ -172,7 +172,7 @@ class ControllerNameParserTest extends TestCase
|
||||
$kernel
|
||||
->expects($this->any())
|
||||
->method('getBundles')
|
||||
->will($this->returnValue($bundles))
|
||||
->willReturn($bundles)
|
||||
;
|
||||
|
||||
return new ControllerNameParser($kernel);
|
||||
@ -181,8 +181,8 @@ class ControllerNameParserTest extends TestCase
|
||||
private function getBundle($namespace, $name)
|
||||
{
|
||||
$bundle = $this->getMockBuilder('Symfony\Component\HttpKernel\Bundle\BundleInterface')->getMock();
|
||||
$bundle->expects($this->any())->method('getName')->will($this->returnValue($name));
|
||||
$bundle->expects($this->any())->method('getNamespace')->will($this->returnValue($namespace));
|
||||
$bundle->expects($this->any())->method('getName')->willReturn($name);
|
||||
$bundle->expects($this->any())->method('getNamespace')->willReturn($namespace);
|
||||
|
||||
return $bundle;
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ class ControllerResolverTest extends ContainerControllerResolverTest
|
||||
$parser->expects($this->once())
|
||||
->method('parse')
|
||||
->with($shortName)
|
||||
->will($this->returnValue('Symfony\Bundle\FrameworkBundle\Tests\Controller\ContainerAwareController::testAction'))
|
||||
->willReturn('Symfony\Bundle\FrameworkBundle\Tests\Controller\ContainerAwareController::testAction')
|
||||
;
|
||||
|
||||
$resolver = $this->createControllerResolver(null, null, $parser);
|
||||
|
@ -44,9 +44,9 @@ abstract class ControllerTraitTest extends TestCase
|
||||
$requestStack->push($request);
|
||||
|
||||
$kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock();
|
||||
$kernel->expects($this->once())->method('handle')->will($this->returnCallback(function (Request $request) {
|
||||
$kernel->expects($this->once())->method('handle')->willReturnCallback(function (Request $request) {
|
||||
return new Response($request->getRequestFormat().'--'.$request->getLocale());
|
||||
}));
|
||||
});
|
||||
|
||||
$container = new Container();
|
||||
$container->set('request_stack', $requestStack);
|
||||
@ -111,7 +111,7 @@ abstract class ControllerTraitTest extends TestCase
|
||||
$tokenStorage
|
||||
->expects($this->once())
|
||||
->method('getToken')
|
||||
->will($this->returnValue($token));
|
||||
->willReturn($token);
|
||||
|
||||
$container = new Container();
|
||||
$container->set('security.token_storage', $tokenStorage);
|
||||
@ -138,7 +138,7 @@ abstract class ControllerTraitTest extends TestCase
|
||||
->expects($this->once())
|
||||
->method('serialize')
|
||||
->with([], 'json', ['json_encode_options' => JsonResponse::DEFAULT_ENCODING_OPTIONS])
|
||||
->will($this->returnValue('[]'));
|
||||
->willReturn('[]');
|
||||
|
||||
$container->set('serializer', $serializer);
|
||||
|
||||
@ -159,7 +159,7 @@ abstract class ControllerTraitTest extends TestCase
|
||||
->expects($this->once())
|
||||
->method('serialize')
|
||||
->with([], 'json', ['json_encode_options' => 0, 'other' => 'context'])
|
||||
->will($this->returnValue('[]'));
|
||||
->willReturn('[]');
|
||||
|
||||
$container->set('serializer', $serializer);
|
||||
|
||||
|
@ -74,7 +74,7 @@ class RedirectControllerTest extends TestCase
|
||||
->expects($this->once())
|
||||
->method('generate')
|
||||
->with($this->equalTo($route), $this->equalTo($expectedAttributes))
|
||||
->will($this->returnValue($url));
|
||||
->willReturn($url);
|
||||
|
||||
$controller = new RedirectController($router);
|
||||
|
||||
@ -247,7 +247,7 @@ class RedirectControllerTest extends TestCase
|
||||
$request->query = new ParameterBag(['base' => 'zaza']);
|
||||
$request->attributes = new ParameterBag(['_route_params' => ['base2' => 'zaza']]);
|
||||
$urlGenerator = $this->getMockBuilder(UrlGeneratorInterface::class)->getMock();
|
||||
$urlGenerator->expects($this->once())->method('generate')->will($this->returnValue('/test?base=zaza&base2=zaza'))->with('/test', ['base' => 'zaza', 'base2' => 'zaza'], UrlGeneratorInterface::ABSOLUTE_URL);
|
||||
$urlGenerator->expects($this->once())->method('generate')->willReturn('/test?base=zaza&base2=zaza')->with('/test', ['base' => 'zaza', 'base2' => 'zaza'], UrlGeneratorInterface::ABSOLUTE_URL);
|
||||
|
||||
$controller = new RedirectController($urlGenerator);
|
||||
$this->assertRedirectUrl($controller->redirectAction($request, '/test', false, false, false, true), '/test?base=zaza&base2=zaza');
|
||||
@ -264,7 +264,7 @@ class RedirectControllerTest extends TestCase
|
||||
$request->query = new ParameterBag(['base' => 'zaza']);
|
||||
$request->attributes = new ParameterBag(['_route_params' => ['base' => 'zouzou']]);
|
||||
$urlGenerator = $this->getMockBuilder(UrlGeneratorInterface::class)->getMock();
|
||||
$urlGenerator->expects($this->once())->method('generate')->will($this->returnValue('/test?base=zouzou'))->with('/test', ['base' => 'zouzou'], UrlGeneratorInterface::ABSOLUTE_URL);
|
||||
$urlGenerator->expects($this->once())->method('generate')->willReturn('/test?base=zouzou')->with('/test', ['base' => 'zouzou'], UrlGeneratorInterface::ABSOLUTE_URL);
|
||||
|
||||
$controller = new RedirectController($urlGenerator);
|
||||
$this->assertRedirectUrl($controller->redirectAction($request, '/test', false, false, false, true), '/test?base=zouzou');
|
||||
@ -276,23 +276,23 @@ class RedirectControllerTest extends TestCase
|
||||
$request
|
||||
->expects($this->any())
|
||||
->method('getScheme')
|
||||
->will($this->returnValue($scheme));
|
||||
->willReturn($scheme);
|
||||
$request
|
||||
->expects($this->any())
|
||||
->method('getHost')
|
||||
->will($this->returnValue($host));
|
||||
->willReturn($host);
|
||||
$request
|
||||
->expects($this->any())
|
||||
->method('getPort')
|
||||
->will($this->returnValue($port));
|
||||
->willReturn($port);
|
||||
$request
|
||||
->expects($this->any())
|
||||
->method('getBaseUrl')
|
||||
->will($this->returnValue($baseUrl));
|
||||
->willReturn($baseUrl);
|
||||
$request
|
||||
->expects($this->any())
|
||||
->method('getQueryString')
|
||||
->will($this->returnValue($queryString));
|
||||
->willReturn($queryString);
|
||||
|
||||
return $request;
|
||||
}
|
||||
|
@ -506,7 +506,7 @@ class RouterTest extends TestCase
|
||||
$loader
|
||||
->expects($this->any())
|
||||
->method('load')
|
||||
->will($this->returnValue($routes))
|
||||
->willReturn($routes)
|
||||
;
|
||||
|
||||
$sc = $this->getMockBuilder('Symfony\\Component\\DependencyInjection\\Container')->setMethods(['get'])->getMock();
|
||||
@ -514,7 +514,7 @@ class RouterTest extends TestCase
|
||||
$sc
|
||||
->expects($this->once())
|
||||
->method('get')
|
||||
->will($this->returnValue($loader))
|
||||
->willReturn($loader)
|
||||
;
|
||||
|
||||
return $sc;
|
||||
@ -527,7 +527,7 @@ class RouterTest extends TestCase
|
||||
$loader
|
||||
->expects($this->any())
|
||||
->method('load')
|
||||
->will($this->returnValue($routes))
|
||||
->willReturn($routes)
|
||||
;
|
||||
|
||||
$sc = $this->getMockBuilder(ContainerInterface::class)->getMock();
|
||||
@ -535,7 +535,7 @@ class RouterTest extends TestCase
|
||||
$sc
|
||||
->expects($this->once())
|
||||
->method('get')
|
||||
->will($this->returnValue($loader))
|
||||
->willReturn($loader)
|
||||
;
|
||||
|
||||
return $sc;
|
||||
@ -547,9 +547,9 @@ class RouterTest extends TestCase
|
||||
$bag
|
||||
->expects($this->any())
|
||||
->method('get')
|
||||
->will($this->returnCallback(function ($key) use ($params) {
|
||||
->willReturnCallback(function ($key) use ($params) {
|
||||
return isset($params[$key]) ? $params[$key] : null;
|
||||
}))
|
||||
})
|
||||
;
|
||||
|
||||
return $bag;
|
||||
|
@ -70,7 +70,7 @@ class DelegatingEngineTest extends TestCase
|
||||
$engine->expects($this->once())
|
||||
->method('renderResponse')
|
||||
->with('template.php', ['foo' => 'bar'])
|
||||
->will($this->returnValue($response));
|
||||
->willReturn($response);
|
||||
$container = $this->getContainerMock(['engine' => $engine]);
|
||||
|
||||
$delegatingEngine = new DelegatingEngine($container, ['engine']);
|
||||
@ -94,7 +94,7 @@ class DelegatingEngineTest extends TestCase
|
||||
$engine->expects($this->once())
|
||||
->method('supports')
|
||||
->with($template)
|
||||
->will($this->returnValue($supports));
|
||||
->willReturn($supports);
|
||||
|
||||
return $engine;
|
||||
}
|
||||
@ -106,7 +106,7 @@ class DelegatingEngineTest extends TestCase
|
||||
$engine->expects($this->once())
|
||||
->method('supports')
|
||||
->with($template)
|
||||
->will($this->returnValue($supports));
|
||||
->willReturn($supports);
|
||||
|
||||
return $engine;
|
||||
}
|
||||
@ -120,7 +120,7 @@ class DelegatingEngineTest extends TestCase
|
||||
$container->expects($this->at($i++))
|
||||
->method('get')
|
||||
->with($id)
|
||||
->will($this->returnValue($service));
|
||||
->willReturn($service);
|
||||
}
|
||||
|
||||
return $container;
|
||||
|
@ -50,7 +50,7 @@ class GlobalVariablesTest extends TestCase
|
||||
$tokenStorage
|
||||
->expects($this->once())
|
||||
->method('getToken')
|
||||
->will($this->returnValue('token'));
|
||||
->willReturn('token');
|
||||
|
||||
$this->assertSame('token', $this->globals->getToken());
|
||||
}
|
||||
@ -80,12 +80,12 @@ class GlobalVariablesTest extends TestCase
|
||||
$token
|
||||
->expects($this->once())
|
||||
->method('getUser')
|
||||
->will($this->returnValue($user));
|
||||
->willReturn($user);
|
||||
|
||||
$tokenStorage
|
||||
->expects($this->once())
|
||||
->method('getToken')
|
||||
->will($this->returnValue($token));
|
||||
->willReturn($token);
|
||||
|
||||
$this->assertSame($expectedUser, $this->globals->getUser());
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ class TemplateLocatorTest extends TestCase
|
||||
->expects($this->once())
|
||||
->method('locate')
|
||||
->with($template->getPath())
|
||||
->will($this->returnValue('/path/to/template'))
|
||||
->willReturn('/path/to/template')
|
||||
;
|
||||
|
||||
$locator = new TemplateLocator($fileLocator);
|
||||
|
@ -29,13 +29,13 @@ class TemplateNameParserTest extends TestCase
|
||||
$kernel
|
||||
->expects($this->any())
|
||||
->method('getBundle')
|
||||
->will($this->returnCallback(function ($bundle) {
|
||||
->willReturnCallback(function ($bundle) {
|
||||
if (\in_array($bundle, ['SensioFooBundle', 'SensioCmsFooBundle', 'FooBundle'])) {
|
||||
return true;
|
||||
}
|
||||
|
||||
throw new \InvalidArgumentException();
|
||||
}))
|
||||
})
|
||||
;
|
||||
$this->parser = new TemplateNameParser($kernel);
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ class TimedPhpEngineTest extends TestCase
|
||||
$stopwatch->expects($this->once())
|
||||
->method('start')
|
||||
->with('template.php (index.php)', 'template')
|
||||
->will($this->returnValue($stopwatchEvent));
|
||||
->willReturn($stopwatchEvent);
|
||||
|
||||
$stopwatchEvent->expects($this->once())->method('stop');
|
||||
|
||||
@ -59,7 +59,7 @@ class TimedPhpEngineTest extends TestCase
|
||||
$templateNameParser = $this->getMockBuilder('Symfony\Component\Templating\TemplateNameParserInterface')->getMock();
|
||||
$templateNameParser->expects($this->any())
|
||||
->method('parse')
|
||||
->will($this->returnValue($templateReference));
|
||||
->willReturn($templateReference);
|
||||
|
||||
return $templateNameParser;
|
||||
}
|
||||
@ -94,7 +94,7 @@ class TimedPhpEngineTest extends TestCase
|
||||
$loader = $this->getMockForAbstractClass('Symfony\Component\Templating\Loader\Loader');
|
||||
$loader->expects($this->once())
|
||||
->method('load')
|
||||
->will($this->returnValue($storage));
|
||||
->willReturn($storage);
|
||||
|
||||
return $loader;
|
||||
}
|
||||
|
@ -238,7 +238,7 @@ class WebTestCaseTest extends TestCase
|
||||
private function getResponseTester(Response $response): WebTestCase
|
||||
{
|
||||
$client = $this->createMock(KernelBrowser::class);
|
||||
$client->expects($this->any())->method('getResponse')->will($this->returnValue($response));
|
||||
$client->expects($this->any())->method('getResponse')->willReturn($response);
|
||||
|
||||
return $this->getTester($client);
|
||||
}
|
||||
@ -246,7 +246,7 @@ class WebTestCaseTest extends TestCase
|
||||
private function getCrawlerTester(Crawler $crawler): WebTestCase
|
||||
{
|
||||
$client = $this->createMock(KernelBrowser::class);
|
||||
$client->expects($this->any())->method('getCrawler')->will($this->returnValue($crawler));
|
||||
$client->expects($this->any())->method('getCrawler')->willReturn($crawler);
|
||||
|
||||
return $this->getTester($client);
|
||||
}
|
||||
@ -256,7 +256,7 @@ class WebTestCaseTest extends TestCase
|
||||
$client = $this->createMock(KernelBrowser::class);
|
||||
$jar = new CookieJar();
|
||||
$jar->set(new Cookie('foo', 'bar', null, '/path', 'example.com'));
|
||||
$client->expects($this->any())->method('getCookieJar')->will($this->returnValue($jar));
|
||||
$client->expects($this->any())->method('getCookieJar')->willReturn($jar);
|
||||
|
||||
return $this->getTester($client);
|
||||
}
|
||||
@ -267,7 +267,7 @@ class WebTestCaseTest extends TestCase
|
||||
$request = new Request();
|
||||
$request->attributes->set('foo', 'bar');
|
||||
$request->attributes->set('_route', 'homepage');
|
||||
$client->expects($this->any())->method('getRequest')->will($this->returnValue($request));
|
||||
$client->expects($this->any())->method('getRequest')->willReturn($request);
|
||||
|
||||
return $this->getTester($client);
|
||||
}
|
||||
|
@ -267,53 +267,53 @@ class TranslatorTest extends TestCase
|
||||
$loader
|
||||
->expects($this->at(0))
|
||||
->method('load')
|
||||
->will($this->returnValue($this->getCatalogue('fr', [
|
||||
->willReturn($this->getCatalogue('fr', [
|
||||
'foo' => 'foo (FR)',
|
||||
])))
|
||||
]))
|
||||
;
|
||||
$loader
|
||||
->expects($this->at(1))
|
||||
->method('load')
|
||||
->will($this->returnValue($this->getCatalogue('en', [
|
||||
->willReturn($this->getCatalogue('en', [
|
||||
'foo' => 'foo (EN)',
|
||||
'bar' => 'bar (EN)',
|
||||
'choice' => '{0} choice 0 (EN)|{1} choice 1 (EN)|]1,Inf] choice inf (EN)',
|
||||
])))
|
||||
]))
|
||||
;
|
||||
$loader
|
||||
->expects($this->at(2))
|
||||
->method('load')
|
||||
->will($this->returnValue($this->getCatalogue('es', [
|
||||
->willReturn($this->getCatalogue('es', [
|
||||
'foobar' => 'foobar (ES)',
|
||||
])))
|
||||
]))
|
||||
;
|
||||
$loader
|
||||
->expects($this->at(3))
|
||||
->method('load')
|
||||
->will($this->returnValue($this->getCatalogue('pt-PT', [
|
||||
->willReturn($this->getCatalogue('pt-PT', [
|
||||
'foobarfoo' => 'foobarfoo (PT-PT)',
|
||||
])))
|
||||
]))
|
||||
;
|
||||
$loader
|
||||
->expects($this->at(4))
|
||||
->method('load')
|
||||
->will($this->returnValue($this->getCatalogue('pt_BR', [
|
||||
->willReturn($this->getCatalogue('pt_BR', [
|
||||
'other choice' => '{0} other choice 0 (PT-BR)|{1} other choice 1 (PT-BR)|]1,Inf] other choice inf (PT-BR)',
|
||||
])))
|
||||
]))
|
||||
;
|
||||
$loader
|
||||
->expects($this->at(5))
|
||||
->method('load')
|
||||
->will($this->returnValue($this->getCatalogue('fr.UTF-8', [
|
||||
->willReturn($this->getCatalogue('fr.UTF-8', [
|
||||
'foobarbaz' => 'foobarbaz (fr.UTF-8)',
|
||||
])))
|
||||
]))
|
||||
;
|
||||
$loader
|
||||
->expects($this->at(6))
|
||||
->method('load')
|
||||
->will($this->returnValue($this->getCatalogue('sr@latin', [
|
||||
->willReturn($this->getCatalogue('sr@latin', [
|
||||
'foobarbax' => 'foobarbax (sr@latin)',
|
||||
])))
|
||||
]))
|
||||
;
|
||||
|
||||
return $loader;
|
||||
@ -325,7 +325,7 @@ class TranslatorTest extends TestCase
|
||||
$container
|
||||
->expects($this->any())
|
||||
->method('get')
|
||||
->will($this->returnValue($loader))
|
||||
->willReturn($loader)
|
||||
;
|
||||
|
||||
return $container;
|
||||
|
@ -132,17 +132,17 @@ class AbstractFactoryTest extends TestCase
|
||||
$factory
|
||||
->expects($this->once())
|
||||
->method('createAuthProvider')
|
||||
->will($this->returnValue('auth_provider'))
|
||||
->willReturn('auth_provider')
|
||||
;
|
||||
$factory
|
||||
->expects($this->atLeastOnce())
|
||||
->method('getListenerId')
|
||||
->will($this->returnValue('abstract_listener'))
|
||||
->willReturn('abstract_listener')
|
||||
;
|
||||
$factory
|
||||
->expects($this->any())
|
||||
->method('getKey')
|
||||
->will($this->returnValue('abstract_factory'))
|
||||
->willReturn('abstract_factory')
|
||||
;
|
||||
|
||||
$container = new ContainerBuilder();
|
||||
|
@ -44,7 +44,7 @@ class PreviewErrorControllerTest extends TestCase
|
||||
}),
|
||||
$this->equalTo(HttpKernelInterface::SUB_REQUEST)
|
||||
)
|
||||
->will($this->returnValue($response));
|
||||
->willReturn($response);
|
||||
|
||||
$controller = new PreviewErrorController($kernel, $logicalControllerName);
|
||||
|
||||
|
@ -24,7 +24,7 @@ class FilesystemLoaderTest extends TestCase
|
||||
$locator
|
||||
->expects($this->once())
|
||||
->method('locate')
|
||||
->will($this->returnValue(__DIR__.'/../DependencyInjection/Fixtures/templates/layout.html.twig'))
|
||||
->willReturn(__DIR__.'/../DependencyInjection/Fixtures/templates/layout.html.twig')
|
||||
;
|
||||
$loader = new FilesystemLoader($locator, $parser);
|
||||
$loader->addPath(__DIR__.'/../DependencyInjection/Fixtures/templates', 'namespace');
|
||||
@ -44,7 +44,7 @@ class FilesystemLoaderTest extends TestCase
|
||||
$locator
|
||||
->expects($this->once())
|
||||
->method('locate')
|
||||
->will($this->returnValue($template = __DIR__.'/../DependencyInjection/Fixtures/templates/layout.html.twig'))
|
||||
->willReturn($template = __DIR__.'/../DependencyInjection/Fixtures/templates/layout.html.twig')
|
||||
;
|
||||
$loader = new FilesystemLoader($locator, $parser);
|
||||
|
||||
@ -61,7 +61,7 @@ class FilesystemLoaderTest extends TestCase
|
||||
->expects($this->once())
|
||||
->method('parse')
|
||||
->with('name.format.engine')
|
||||
->will($this->returnValue(new TemplateReference('', '', 'name', 'format', 'engine')))
|
||||
->willReturn(new TemplateReference('', '', 'name', 'format', 'engine'))
|
||||
;
|
||||
|
||||
$locator = $this->getMockBuilder('Symfony\Component\Config\FileLocatorInterface')->getMock();
|
||||
@ -85,14 +85,14 @@ class FilesystemLoaderTest extends TestCase
|
||||
->expects($this->once())
|
||||
->method('parse')
|
||||
->with('name.format.engine')
|
||||
->will($this->returnValue(new TemplateReference('', '', 'name', 'format', 'engine')))
|
||||
->willReturn(new TemplateReference('', '', 'name', 'format', 'engine'))
|
||||
;
|
||||
|
||||
$locator = $this->getMockBuilder('Symfony\Component\Config\FileLocatorInterface')->getMock();
|
||||
$locator
|
||||
->expects($this->once())
|
||||
->method('locate')
|
||||
->will($this->returnValue(false))
|
||||
->willReturn(false)
|
||||
;
|
||||
|
||||
$loader = new FilesystemLoader($locator, $parser);
|
||||
|
@ -18,13 +18,13 @@ class TemplateIteratorTest extends TestCase
|
||||
public function testGetIterator()
|
||||
{
|
||||
$bundle = $this->getMockBuilder('Symfony\Component\HttpKernel\Bundle\BundleInterface')->getMock();
|
||||
$bundle->expects($this->any())->method('getName')->will($this->returnValue('BarBundle'));
|
||||
$bundle->expects($this->any())->method('getPath')->will($this->returnValue(__DIR__.'/Fixtures/templates/BarBundle'));
|
||||
$bundle->expects($this->any())->method('getName')->willReturn('BarBundle');
|
||||
$bundle->expects($this->any())->method('getPath')->willReturn(__DIR__.'/Fixtures/templates/BarBundle');
|
||||
|
||||
$kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\Kernel')->disableOriginalConstructor()->getMock();
|
||||
$kernel->expects($this->any())->method('getBundles')->will($this->returnValue([
|
||||
$kernel->expects($this->any())->method('getBundles')->willReturn([
|
||||
$bundle,
|
||||
]));
|
||||
]);
|
||||
$iterator = new TemplateIterator($kernel, __DIR__.'/Fixtures/templates', [__DIR__.'/Fixtures/templates/Foo' => 'Foo'], __DIR__.'/DependencyInjection/Fixtures/templates');
|
||||
|
||||
$sorted = iterator_to_array($iterator);
|
||||
|
@ -97,11 +97,11 @@ class ProfilerControllerTest extends TestCase
|
||||
$profiler
|
||||
->expects($this->exactly(2))
|
||||
->method('loadProfile')
|
||||
->will($this->returnCallback(function ($token) {
|
||||
->willReturnCallback(function ($token) {
|
||||
if ('found' == $token) {
|
||||
return new Profile($token);
|
||||
}
|
||||
}))
|
||||
})
|
||||
;
|
||||
|
||||
$controller = $this->createController($profiler, $twig, $withCsp);
|
||||
@ -149,7 +149,7 @@ class ProfilerControllerTest extends TestCase
|
||||
$profiler
|
||||
->expects($this->once())
|
||||
->method('find')
|
||||
->will($this->returnValue($tokens));
|
||||
->willReturn($tokens);
|
||||
|
||||
$request = Request::create('/_profiler/empty/search/results', 'GET', [
|
||||
'limit' => 2,
|
||||
|
@ -200,7 +200,7 @@ class ContentSecurityPolicyHandlerTest extends TestCase
|
||||
|
||||
$generator->expects($this->any())
|
||||
->method('generate')
|
||||
->will($this->returnValue($value));
|
||||
->willReturn($value);
|
||||
|
||||
return $generator;
|
||||
}
|
||||
|
@ -244,7 +244,7 @@ class WebDebugToolbarListenerTest extends TestCase
|
||||
->expects($this->once())
|
||||
->method('generate')
|
||||
->with('_profiler', ['token' => 'xxxxxxxx'], UrlGeneratorInterface::ABSOLUTE_URL)
|
||||
->will($this->returnValue('http://mydomain.com/_profiler/xxxxxxxx'))
|
||||
->willReturn('http://mydomain.com/_profiler/xxxxxxxx')
|
||||
;
|
||||
|
||||
$event = new ResponseEvent($this->getKernelMock(), $this->getRequestMock(), HttpKernelInterface::MASTER_REQUEST, $response);
|
||||
@ -302,10 +302,10 @@ class WebDebugToolbarListenerTest extends TestCase
|
||||
$request = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->setMethods(['getSession', 'isXmlHttpRequest', 'getRequestFormat'])->disableOriginalConstructor()->getMock();
|
||||
$request->expects($this->any())
|
||||
->method('isXmlHttpRequest')
|
||||
->will($this->returnValue($isXmlHttpRequest));
|
||||
->willReturn($isXmlHttpRequest);
|
||||
$request->expects($this->any())
|
||||
->method('getRequestFormat')
|
||||
->will($this->returnValue($requestFormat));
|
||||
->willReturn($requestFormat);
|
||||
|
||||
$request->headers = new HeaderBag();
|
||||
|
||||
@ -313,7 +313,7 @@ class WebDebugToolbarListenerTest extends TestCase
|
||||
$session = $this->getMockBuilder('Symfony\Component\HttpFoundation\Session\Session')->disableOriginalConstructor()->getMock();
|
||||
$request->expects($this->any())
|
||||
->method('getSession')
|
||||
->will($this->returnValue($session));
|
||||
->willReturn($session);
|
||||
}
|
||||
|
||||
return $request;
|
||||
@ -324,7 +324,7 @@ class WebDebugToolbarListenerTest extends TestCase
|
||||
$templating = $this->getMockBuilder('Twig\Environment')->disableOriginalConstructor()->getMock();
|
||||
$templating->expects($this->any())
|
||||
->method('render')
|
||||
->will($this->returnValue($render));
|
||||
->willReturn($render);
|
||||
|
||||
return $templating;
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ class TemplateManagerTest extends TestCase
|
||||
$this->profiler->expects($this->any())
|
||||
->method('has')
|
||||
->withAnyParameters()
|
||||
->will($this->returnCallback([$this, 'profilerHasCallback']));
|
||||
->willReturnCallback([$this, 'profilerHasCallback']);
|
||||
|
||||
$this->assertEquals('FooBundle:Collector:foo.html.twig', $this->templateManager->getName(new ProfileDummy(), 'foo'));
|
||||
}
|
||||
@ -107,14 +107,14 @@ class TemplateManagerTest extends TestCase
|
||||
|
||||
$this->twigEnvironment->expects($this->any())
|
||||
->method('loadTemplate')
|
||||
->will($this->returnValue('loadedTemplate'));
|
||||
->willReturn('loadedTemplate');
|
||||
|
||||
if (interface_exists('Twig\Loader\SourceContextLoaderInterface')) {
|
||||
$loader = $this->getMockBuilder('Twig\Loader\SourceContextLoaderInterface')->getMock();
|
||||
} else {
|
||||
$loader = $this->getMockBuilder('Twig\Loader\LoaderInterface')->getMock();
|
||||
}
|
||||
$this->twigEnvironment->expects($this->any())->method('getLoader')->will($this->returnValue($loader));
|
||||
$this->twigEnvironment->expects($this->any())->method('getLoader')->willReturn($loader);
|
||||
|
||||
return $this->twigEnvironment;
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ class PathPackageTest extends TestCase
|
||||
private function getContext($basePath)
|
||||
{
|
||||
$context = $this->getMockBuilder('Symfony\Component\Asset\Context\ContextInterface')->getMock();
|
||||
$context->expects($this->any())->method('getBasePath')->will($this->returnValue($basePath));
|
||||
$context->expects($this->any())->method('getBasePath')->willReturn($basePath);
|
||||
|
||||
return $context;
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ class UrlPackageTest extends TestCase
|
||||
private function getContext($secure)
|
||||
{
|
||||
$context = $this->getMockBuilder('Symfony\Component\Asset\Context\ContextInterface')->getMock();
|
||||
$context->expects($this->any())->method('isSecure')->will($this->returnValue($secure));
|
||||
$context->expects($this->any())->method('isSecure')->willReturn($secure);
|
||||
|
||||
return $context;
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ class BrowserCookieValueSameTest extends TestCase
|
||||
$browser = $this->createMock(AbstractBrowser::class);
|
||||
$jar = new CookieJar();
|
||||
$jar->set(new Cookie('foo', 'bar', null, '/path', 'example.com'));
|
||||
$browser->expects($this->any())->method('getCookieJar')->will($this->returnValue($jar));
|
||||
$browser->expects($this->any())->method('getCookieJar')->willReturn($jar);
|
||||
|
||||
return $browser;
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ class BrowserHasCookieTest extends TestCase
|
||||
$browser = $this->createMock(AbstractBrowser::class);
|
||||
$jar = new CookieJar();
|
||||
$jar->set(new Cookie('foo', 'bar', null, '/path', 'example.com'));
|
||||
$browser->expects($this->any())->method('getCookieJar')->will($this->returnValue($jar));
|
||||
$browser->expects($this->any())->method('getCookieJar')->willReturn($jar);
|
||||
|
||||
return $browser;
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ class ChainAdapterTest extends AdapterTestCase
|
||||
$pruneable
|
||||
->expects($this->atLeastOnce())
|
||||
->method('prune')
|
||||
->will($this->returnValue(true));
|
||||
->willReturn(true);
|
||||
|
||||
return $pruneable;
|
||||
}
|
||||
@ -101,7 +101,7 @@ class ChainAdapterTest extends AdapterTestCase
|
||||
$pruneable
|
||||
->expects($this->atLeastOnce())
|
||||
->method('prune')
|
||||
->will($this->returnValue(false));
|
||||
->willReturn(false);
|
||||
|
||||
return $pruneable;
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ class TagAwareAdapterTest extends AdapterTestCase
|
||||
$pruneable
|
||||
->expects($this->atLeastOnce())
|
||||
->method('prune')
|
||||
->will($this->returnValue(true));
|
||||
->willReturn(true);
|
||||
|
||||
return $pruneable;
|
||||
}
|
||||
@ -93,7 +93,7 @@ class TagAwareAdapterTest extends AdapterTestCase
|
||||
$pruneable
|
||||
->expects($this->atLeastOnce())
|
||||
->method('prune')
|
||||
->will($this->returnValue(false));
|
||||
->willReturn(false);
|
||||
|
||||
return $pruneable;
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ class ChainCacheTest extends CacheTestCase
|
||||
$pruneable
|
||||
->expects($this->atLeastOnce())
|
||||
->method('prune')
|
||||
->will($this->returnValue(true));
|
||||
->willReturn(true);
|
||||
|
||||
return $pruneable;
|
||||
}
|
||||
@ -96,7 +96,7 @@ class ChainCacheTest extends CacheTestCase
|
||||
$pruneable
|
||||
->expects($this->atLeastOnce())
|
||||
->method('prune')
|
||||
->will($this->returnValue(false));
|
||||
->willReturn(false);
|
||||
|
||||
return $pruneable;
|
||||
}
|
||||
|
@ -35,12 +35,12 @@ class DelegatingLoaderTest extends TestCase
|
||||
public function testSupports()
|
||||
{
|
||||
$loader1 = $this->getMockBuilder('Symfony\Component\Config\Loader\LoaderInterface')->getMock();
|
||||
$loader1->expects($this->once())->method('supports')->will($this->returnValue(true));
|
||||
$loader1->expects($this->once())->method('supports')->willReturn(true);
|
||||
$loader = new DelegatingLoader(new LoaderResolver([$loader1]));
|
||||
$this->assertTrue($loader->supports('foo.xml'), '->supports() returns true if the resource is loadable');
|
||||
|
||||
$loader1 = $this->getMockBuilder('Symfony\Component\Config\Loader\LoaderInterface')->getMock();
|
||||
$loader1->expects($this->once())->method('supports')->will($this->returnValue(false));
|
||||
$loader1->expects($this->once())->method('supports')->willReturn(false);
|
||||
$loader = new DelegatingLoader(new LoaderResolver([$loader1]));
|
||||
$this->assertFalse($loader->supports('foo.foo'), '->supports() returns false if the resource is not loadable');
|
||||
}
|
||||
@ -48,7 +48,7 @@ class DelegatingLoaderTest extends TestCase
|
||||
public function testLoad()
|
||||
{
|
||||
$loader = $this->getMockBuilder('Symfony\Component\Config\Loader\LoaderInterface')->getMock();
|
||||
$loader->expects($this->once())->method('supports')->will($this->returnValue(true));
|
||||
$loader->expects($this->once())->method('supports')->willReturn(true);
|
||||
$loader->expects($this->once())->method('load');
|
||||
$resolver = new LoaderResolver([$loader]);
|
||||
$loader = new DelegatingLoader($resolver);
|
||||
@ -62,7 +62,7 @@ class DelegatingLoaderTest extends TestCase
|
||||
public function testLoadThrowsAnExceptionIfTheResourceCannotBeLoaded()
|
||||
{
|
||||
$loader = $this->getMockBuilder('Symfony\Component\Config\Loader\LoaderInterface')->getMock();
|
||||
$loader->expects($this->once())->method('supports')->will($this->returnValue(false));
|
||||
$loader->expects($this->once())->method('supports')->willReturn(false);
|
||||
$resolver = new LoaderResolver([$loader]);
|
||||
$loader = new DelegatingLoader($resolver);
|
||||
|
||||
|
@ -32,7 +32,7 @@ class LoaderResolverTest extends TestCase
|
||||
$this->assertFalse($resolver->resolve('foo.foo'), '->resolve() returns false if no loader is able to load the resource');
|
||||
|
||||
$loader = $this->getMockBuilder('Symfony\Component\Config\Loader\LoaderInterface')->getMock();
|
||||
$loader->expects($this->once())->method('supports')->will($this->returnValue(true));
|
||||
$loader->expects($this->once())->method('supports')->willReturn(true);
|
||||
$resolver = new LoaderResolver([$loader]);
|
||||
$this->assertEquals($loader, $resolver->resolve(function () {}), '->resolve() returns the loader for the given resource');
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ class LoaderTest extends TestCase
|
||||
$resolver->expects($this->once())
|
||||
->method('resolve')
|
||||
->with('foo.xml')
|
||||
->will($this->returnValue($resolvedLoader));
|
||||
->willReturn($resolvedLoader);
|
||||
|
||||
$loader = new ProjectLoader1();
|
||||
$loader->setResolver($resolver);
|
||||
@ -52,7 +52,7 @@ class LoaderTest extends TestCase
|
||||
$resolver->expects($this->once())
|
||||
->method('resolve')
|
||||
->with('FOOBAR')
|
||||
->will($this->returnValue(false));
|
||||
->willReturn(false);
|
||||
|
||||
$loader = new ProjectLoader1();
|
||||
$loader->setResolver($resolver);
|
||||
@ -66,13 +66,13 @@ class LoaderTest extends TestCase
|
||||
$resolvedLoader->expects($this->once())
|
||||
->method('load')
|
||||
->with('foo')
|
||||
->will($this->returnValue('yes'));
|
||||
->willReturn('yes');
|
||||
|
||||
$resolver = $this->getMockBuilder('Symfony\Component\Config\Loader\LoaderResolverInterface')->getMock();
|
||||
$resolver->expects($this->once())
|
||||
->method('resolve')
|
||||
->with('foo')
|
||||
->will($this->returnValue($resolvedLoader));
|
||||
->willReturn($resolvedLoader);
|
||||
|
||||
$loader = new ProjectLoader1();
|
||||
$loader->setResolver($resolver);
|
||||
@ -86,13 +86,13 @@ class LoaderTest extends TestCase
|
||||
$resolvedLoader->expects($this->once())
|
||||
->method('load')
|
||||
->with('foo', 'bar')
|
||||
->will($this->returnValue('yes'));
|
||||
->willReturn('yes');
|
||||
|
||||
$resolver = $this->getMockBuilder('Symfony\Component\Config\Loader\LoaderResolverInterface')->getMock();
|
||||
$resolver->expects($this->once())
|
||||
->method('resolve')
|
||||
->with('foo', 'bar')
|
||||
->will($this->returnValue($resolvedLoader));
|
||||
->willReturn($resolvedLoader);
|
||||
|
||||
$loader = new ProjectLoader1();
|
||||
$loader->setResolver($resolver);
|
||||
|
@ -709,7 +709,7 @@ class ApplicationTest extends TestCase
|
||||
$application = $this->getMockBuilder('Symfony\Component\Console\Application')->setMethods(['getNamespaces'])->getMock();
|
||||
$application->expects($this->once())
|
||||
->method('getNamespaces')
|
||||
->will($this->returnValue(['foo:sublong', 'bar:sub']));
|
||||
->willReturn(['foo:sublong', 'bar:sub']);
|
||||
|
||||
$this->assertEquals('foo:sublong', $application->findNamespace('f:sub'));
|
||||
}
|
||||
@ -853,7 +853,7 @@ class ApplicationTest extends TestCase
|
||||
$application->setAutoExit(false);
|
||||
$application->expects($this->any())
|
||||
->method('getTerminalWidth')
|
||||
->will($this->returnValue(120));
|
||||
->willReturn(120);
|
||||
$application->register('foo')->setCode(function () {
|
||||
throw new \InvalidArgumentException("\n\nline 1 with extra spaces \nline 2\n\nline 4\n");
|
||||
});
|
||||
|
@ -321,7 +321,7 @@ class CommandTest extends TestCase
|
||||
$command = $this->getMockBuilder('TestCommand')->setMethods(['execute'])->getMock();
|
||||
$command->expects($this->once())
|
||||
->method('execute')
|
||||
->will($this->returnValue('2.3'));
|
||||
->willReturn('2.3');
|
||||
$exitCode = $command->run(new StringInput(''), new NullOutput());
|
||||
$this->assertSame(2, $exitCode, '->run() returns integer exit code (casts numeric to int)');
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ abstract class AbstractQuestionHelperTest extends TestCase
|
||||
$mock = $this->getMockBuilder(StreamableInputInterface::class)->getMock();
|
||||
$mock->expects($this->any())
|
||||
->method('isInteractive')
|
||||
->will($this->returnValue($interactive));
|
||||
->willReturn($interactive);
|
||||
|
||||
if ($stream) {
|
||||
$mock->expects($this->any())
|
||||
|
@ -114,7 +114,7 @@ class HelperSetTest extends TestCase
|
||||
$mock_helper = $this->getMockBuilder('\Symfony\Component\Console\Helper\HelperInterface')->getMock();
|
||||
$mock_helper->expects($this->any())
|
||||
->method('getName')
|
||||
->will($this->returnValue($name));
|
||||
->willReturn($name);
|
||||
|
||||
if ($helperset) {
|
||||
$mock_helper->expects($this->any())
|
||||
|
@ -760,7 +760,7 @@ class QuestionHelperTest extends AbstractQuestionHelperTest
|
||||
$mock = $this->getMockBuilder('Symfony\Component\Console\Input\InputInterface')->getMock();
|
||||
$mock->expects($this->any())
|
||||
->method('isInteractive')
|
||||
->will($this->returnValue($interactive));
|
||||
->willReturn($interactive);
|
||||
|
||||
return $mock;
|
||||
}
|
||||
|
@ -154,7 +154,7 @@ class SymfonyQuestionHelperTest extends AbstractQuestionHelperTest
|
||||
$mock = $this->getMockBuilder('Symfony\Component\Console\Input\InputInterface')->getMock();
|
||||
$mock->expects($this->any())
|
||||
->method('isInteractive')
|
||||
->will($this->returnValue($interactive));
|
||||
->willReturn($interactive);
|
||||
|
||||
return $mock;
|
||||
}
|
||||
|
@ -166,7 +166,7 @@ class ConsoleLoggerTest extends TestCase
|
||||
} else {
|
||||
$dummy = $this->getMock('Symfony\Component\Console\Tests\Logger\DummyTest', ['__toString']);
|
||||
}
|
||||
$dummy->method('__toString')->will($this->returnValue('DUMMY'));
|
||||
$dummy->method('__toString')->willReturn('DUMMY');
|
||||
|
||||
$this->getLogger()->warning($dummy);
|
||||
|
||||
|
@ -234,7 +234,7 @@ class ErrorHandlerTest extends TestCase
|
||||
$logger
|
||||
->expects($this->once())
|
||||
->method('log')
|
||||
->will($this->returnCallback($warnArgCheck))
|
||||
->willReturnCallback($warnArgCheck)
|
||||
;
|
||||
|
||||
$handler = ErrorHandler::register();
|
||||
@ -262,7 +262,7 @@ class ErrorHandlerTest extends TestCase
|
||||
$logger
|
||||
->expects($this->once())
|
||||
->method('log')
|
||||
->will($this->returnCallback($logArgCheck))
|
||||
->willReturnCallback($logArgCheck)
|
||||
;
|
||||
|
||||
$handler = ErrorHandler::register();
|
||||
@ -318,7 +318,7 @@ class ErrorHandlerTest extends TestCase
|
||||
$logger
|
||||
->expects($this->once())
|
||||
->method('log')
|
||||
->will($this->returnCallback($logArgCheck))
|
||||
->willReturnCallback($logArgCheck)
|
||||
;
|
||||
|
||||
$handler = new ErrorHandler();
|
||||
@ -346,7 +346,7 @@ class ErrorHandlerTest extends TestCase
|
||||
$logger
|
||||
->expects($this->exactly(2))
|
||||
->method('log')
|
||||
->will($this->returnCallback($logArgCheck))
|
||||
->willReturnCallback($logArgCheck)
|
||||
;
|
||||
|
||||
$handler->setDefaultLogger($logger, E_ERROR);
|
||||
@ -462,7 +462,7 @@ class ErrorHandlerTest extends TestCase
|
||||
$logger
|
||||
->expects($this->once())
|
||||
->method('log')
|
||||
->will($this->returnCallback($logArgCheck))
|
||||
->willReturnCallback($logArgCheck)
|
||||
;
|
||||
|
||||
$handler->setDefaultLogger($logger, E_PARSE);
|
||||
|
@ -30,18 +30,18 @@ class MergeExtensionConfigurationPassTest extends TestCase
|
||||
$extension = $this->getMockBuilder('Symfony\\Component\\DependencyInjection\\Extension\\ExtensionInterface')->getMock();
|
||||
$extension->expects($this->any())
|
||||
->method('getXsdValidationBasePath')
|
||||
->will($this->returnValue(false));
|
||||
->willReturn(false);
|
||||
$extension->expects($this->any())
|
||||
->method('getNamespace')
|
||||
->will($this->returnValue('http://example.org/schema/dic/foo'));
|
||||
->willReturn('http://example.org/schema/dic/foo');
|
||||
$extension->expects($this->any())
|
||||
->method('getAlias')
|
||||
->will($this->returnValue('foo'));
|
||||
->willReturn('foo');
|
||||
$extension->expects($this->once())
|
||||
->method('load')
|
||||
->will($this->returnCallback(function (array $config, ContainerBuilder $container) use (&$tmpProviders) {
|
||||
->willReturnCallback(function (array $config, ContainerBuilder $container) use (&$tmpProviders) {
|
||||
$tmpProviders = $container->getExpressionLanguageProviders();
|
||||
}));
|
||||
});
|
||||
|
||||
$provider = $this->getMockBuilder('Symfony\\Component\\ExpressionLanguage\\ExpressionFunctionProviderInterface')->getMock();
|
||||
$container = new ContainerBuilder(new ParameterBag());
|
||||
@ -76,7 +76,7 @@ class MergeExtensionConfigurationPassTest extends TestCase
|
||||
$extension = $this->getMockBuilder(FooExtension::class)->setMethods(['getConfiguration'])->getMock();
|
||||
$extension->expects($this->exactly(2))
|
||||
->method('getConfiguration')
|
||||
->will($this->returnValue(new FooConfiguration()));
|
||||
->willReturn(new FooConfiguration());
|
||||
|
||||
$container = new ContainerBuilder(new ParameterBag());
|
||||
$container->registerExtension($extension);
|
||||
|
@ -67,10 +67,10 @@ class ContainerParametersResourceCheckerTest extends TestCase
|
||||
[$this->equalTo('locales')],
|
||||
[$this->equalTo('default_locale')]
|
||||
)
|
||||
->will($this->returnValueMap([
|
||||
->willReturnMap([
|
||||
['locales', ['fr', 'en']],
|
||||
['default_locale', 'fr'],
|
||||
]))
|
||||
])
|
||||
;
|
||||
}, true];
|
||||
}
|
||||
|
@ -1066,7 +1066,7 @@ class ContainerBuilderTest extends TestCase
|
||||
public function testRegisteredButNotLoadedExtension()
|
||||
{
|
||||
$extension = $this->getMockBuilder('Symfony\\Component\\DependencyInjection\\Extension\\ExtensionInterface')->getMock();
|
||||
$extension->expects($this->once())->method('getAlias')->will($this->returnValue('project'));
|
||||
$extension->expects($this->once())->method('getAlias')->willReturn('project');
|
||||
$extension->expects($this->never())->method('load');
|
||||
|
||||
$container = new ContainerBuilder();
|
||||
@ -1078,7 +1078,7 @@ class ContainerBuilderTest extends TestCase
|
||||
public function testRegisteredAndLoadedExtension()
|
||||
{
|
||||
$extension = $this->getMockBuilder('Symfony\\Component\\DependencyInjection\\Extension\\ExtensionInterface')->getMock();
|
||||
$extension->expects($this->exactly(2))->method('getAlias')->will($this->returnValue('project'));
|
||||
$extension->expects($this->exactly(2))->method('getAlias')->willReturn('project');
|
||||
$extension->expects($this->once())->method('load')->with([['foo' => 'bar']]);
|
||||
|
||||
$container = new ContainerBuilder();
|
||||
|
@ -862,13 +862,13 @@ class FormTest extends TestCase
|
||||
$field
|
||||
->expects($this->any())
|
||||
->method('getName')
|
||||
->will($this->returnValue($name))
|
||||
->willReturn($name)
|
||||
;
|
||||
|
||||
$field
|
||||
->expects($this->any())
|
||||
->method('getValue')
|
||||
->will($this->returnValue($value))
|
||||
->willReturn($value)
|
||||
;
|
||||
|
||||
return $field;
|
||||
|
@ -43,7 +43,7 @@ class ImmutableEventDispatcherTest extends TestCase
|
||||
$this->innerDispatcher->expects($this->once())
|
||||
->method('dispatch')
|
||||
->with($event, 'event')
|
||||
->will($this->returnValue('result'));
|
||||
->willReturn('result');
|
||||
|
||||
$this->assertSame('result', $this->dispatcher->dispatch($event, 'event'));
|
||||
}
|
||||
@ -53,7 +53,7 @@ class ImmutableEventDispatcherTest extends TestCase
|
||||
$this->innerDispatcher->expects($this->once())
|
||||
->method('getListeners')
|
||||
->with('event')
|
||||
->will($this->returnValue('result'));
|
||||
->willReturn('result');
|
||||
|
||||
$this->assertSame('result', $this->dispatcher->getListeners('event'));
|
||||
}
|
||||
@ -63,7 +63,7 @@ class ImmutableEventDispatcherTest extends TestCase
|
||||
$this->innerDispatcher->expects($this->once())
|
||||
->method('hasListeners')
|
||||
->with('event')
|
||||
->will($this->returnValue('result'));
|
||||
->willReturn('result');
|
||||
|
||||
$this->assertSame('result', $this->dispatcher->hasListeners('event'));
|
||||
}
|
||||
|
@ -36,18 +36,18 @@ class ExpressionLanguageTest extends TestCase
|
||||
$cacheItemMock
|
||||
->expects($this->exactly(2))
|
||||
->method('get')
|
||||
->will($this->returnCallback(function () use (&$savedParsedExpression) {
|
||||
->willReturnCallback(function () use (&$savedParsedExpression) {
|
||||
return $savedParsedExpression;
|
||||
}))
|
||||
})
|
||||
;
|
||||
|
||||
$cacheItemMock
|
||||
->expects($this->exactly(1))
|
||||
->method('set')
|
||||
->with($this->isInstanceOf(ParsedExpression::class))
|
||||
->will($this->returnCallback(function ($parsedExpression) use (&$savedParsedExpression) {
|
||||
->willReturnCallback(function ($parsedExpression) use (&$savedParsedExpression) {
|
||||
$savedParsedExpression = $parsedExpression;
|
||||
}))
|
||||
})
|
||||
;
|
||||
|
||||
$cacheMock
|
||||
@ -172,18 +172,18 @@ class ExpressionLanguageTest extends TestCase
|
||||
$cacheItemMock
|
||||
->expects($this->exactly(2))
|
||||
->method('get')
|
||||
->will($this->returnCallback(function () use (&$savedParsedExpression) {
|
||||
->willReturnCallback(function () use (&$savedParsedExpression) {
|
||||
return $savedParsedExpression;
|
||||
}))
|
||||
})
|
||||
;
|
||||
|
||||
$cacheItemMock
|
||||
->expects($this->exactly(1))
|
||||
->method('set')
|
||||
->with($this->isInstanceOf(ParsedExpression::class))
|
||||
->will($this->returnCallback(function ($parsedExpression) use (&$savedParsedExpression) {
|
||||
->willReturnCallback(function ($parsedExpression) use (&$savedParsedExpression) {
|
||||
$savedParsedExpression = $parsedExpression;
|
||||
}))
|
||||
})
|
||||
;
|
||||
|
||||
$cacheMock
|
||||
|
@ -473,7 +473,7 @@ abstract class AbstractDivLayoutTest extends AbstractLayoutTest
|
||||
{
|
||||
$this->csrfTokenManager->expects($this->any())
|
||||
->method('getToken')
|
||||
->will($this->returnValue(new CsrfToken('token_id', 'foo&bar')));
|
||||
->willReturn(new CsrfToken('token_id', 'foo&bar'));
|
||||
|
||||
$form = $this->factory->createNamedBuilder('name', 'Symfony\Component\Form\Extension\Core\Type\FormType')
|
||||
->add($this->factory
|
||||
|
@ -312,10 +312,10 @@ abstract class AbstractRequestHandlerTest extends TestCase
|
||||
{
|
||||
$this->serverParams->expects($this->once())
|
||||
->method('getContentLength')
|
||||
->will($this->returnValue($contentLength));
|
||||
->willReturn($contentLength);
|
||||
$this->serverParams->expects($this->any())
|
||||
->method('getNormalizedIniPostMaxSize')
|
||||
->will($this->returnValue($iniMax));
|
||||
->willReturn($iniMax);
|
||||
|
||||
$options = ['post_max_size_message' => 'Max {{ max }}!'];
|
||||
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType', null, $options);
|
||||
|
@ -339,7 +339,7 @@ abstract class AbstractTableLayoutTest extends AbstractLayoutTest
|
||||
{
|
||||
$this->csrfTokenManager->expects($this->any())
|
||||
->method('getToken')
|
||||
->will($this->returnValue(new CsrfToken('token_id', 'foo&bar')));
|
||||
->willReturn(new CsrfToken('token_id', 'foo&bar'));
|
||||
|
||||
$form = $this->factory->createNamedBuilder('name', 'Symfony\Component\Form\Extension\Core\Type\FormType')
|
||||
->add($this->factory
|
||||
|
@ -42,7 +42,7 @@ class CachingFactoryDecoratorTest extends TestCase
|
||||
$this->decoratedFactory->expects($this->once())
|
||||
->method('createListFromChoices')
|
||||
->with([])
|
||||
->will($this->returnValue($list));
|
||||
->willReturn($list);
|
||||
|
||||
$this->assertSame($list, $this->factory->createListFromChoices([]));
|
||||
$this->assertSame($list, $this->factory->createListFromChoices([]));
|
||||
@ -58,7 +58,7 @@ class CachingFactoryDecoratorTest extends TestCase
|
||||
$this->decoratedFactory->expects($this->once())
|
||||
->method('createListFromChoices')
|
||||
->with($choices2)
|
||||
->will($this->returnValue($list));
|
||||
->willReturn($list);
|
||||
|
||||
$this->assertSame($list, $this->factory->createListFromChoices($choices1));
|
||||
$this->assertSame($list, $this->factory->createListFromChoices($choices2));
|
||||
@ -74,11 +74,11 @@ class CachingFactoryDecoratorTest extends TestCase
|
||||
$this->decoratedFactory->expects($this->at(0))
|
||||
->method('createListFromChoices')
|
||||
->with($choices1)
|
||||
->will($this->returnValue($list1));
|
||||
->willReturn($list1);
|
||||
$this->decoratedFactory->expects($this->at(1))
|
||||
->method('createListFromChoices')
|
||||
->with($choices2)
|
||||
->will($this->returnValue($list2));
|
||||
->willReturn($list2);
|
||||
|
||||
$this->assertSame($list1, $this->factory->createListFromChoices($choices1));
|
||||
$this->assertSame($list2, $this->factory->createListFromChoices($choices2));
|
||||
@ -96,7 +96,7 @@ class CachingFactoryDecoratorTest extends TestCase
|
||||
$this->decoratedFactory->expects($this->once())
|
||||
->method('createListFromChoices')
|
||||
->with($choices1)
|
||||
->will($this->returnValue($list));
|
||||
->willReturn($list);
|
||||
|
||||
$this->assertSame($list, $this->factory->createListFromChoices($choices1));
|
||||
$this->assertSame($list, $this->factory->createListFromChoices($choices2));
|
||||
@ -115,11 +115,11 @@ class CachingFactoryDecoratorTest extends TestCase
|
||||
$this->decoratedFactory->expects($this->at(0))
|
||||
->method('createListFromChoices')
|
||||
->with($choices1)
|
||||
->will($this->returnValue($list1));
|
||||
->willReturn($list1);
|
||||
$this->decoratedFactory->expects($this->at(1))
|
||||
->method('createListFromChoices')
|
||||
->with($choices2)
|
||||
->will($this->returnValue($list2));
|
||||
->willReturn($list2);
|
||||
|
||||
$this->assertSame($list1, $this->factory->createListFromChoices($choices1));
|
||||
$this->assertSame($list2, $this->factory->createListFromChoices($choices2));
|
||||
@ -134,7 +134,7 @@ class CachingFactoryDecoratorTest extends TestCase
|
||||
$this->decoratedFactory->expects($this->once())
|
||||
->method('createListFromChoices')
|
||||
->with($choices, $closure)
|
||||
->will($this->returnValue($list));
|
||||
->willReturn($list);
|
||||
|
||||
$this->assertSame($list, $this->factory->createListFromChoices($choices, $closure));
|
||||
$this->assertSame($list, $this->factory->createListFromChoices($choices, $closure));
|
||||
@ -151,11 +151,11 @@ class CachingFactoryDecoratorTest extends TestCase
|
||||
$this->decoratedFactory->expects($this->at(0))
|
||||
->method('createListFromChoices')
|
||||
->with($choices, $closure1)
|
||||
->will($this->returnValue($list1));
|
||||
->willReturn($list1);
|
||||
$this->decoratedFactory->expects($this->at(1))
|
||||
->method('createListFromChoices')
|
||||
->with($choices, $closure2)
|
||||
->will($this->returnValue($list2));
|
||||
->willReturn($list2);
|
||||
|
||||
$this->assertSame($list1, $this->factory->createListFromChoices($choices, $closure1));
|
||||
$this->assertSame($list2, $this->factory->createListFromChoices($choices, $closure2));
|
||||
@ -169,7 +169,7 @@ class CachingFactoryDecoratorTest extends TestCase
|
||||
$this->decoratedFactory->expects($this->once())
|
||||
->method('createListFromLoader')
|
||||
->with($loader)
|
||||
->will($this->returnValue($list));
|
||||
->willReturn($list);
|
||||
|
||||
$this->assertSame($list, $this->factory->createListFromLoader($loader));
|
||||
$this->assertSame($list, $this->factory->createListFromLoader($loader));
|
||||
@ -185,11 +185,11 @@ class CachingFactoryDecoratorTest extends TestCase
|
||||
$this->decoratedFactory->expects($this->at(0))
|
||||
->method('createListFromLoader')
|
||||
->with($loader1)
|
||||
->will($this->returnValue($list1));
|
||||
->willReturn($list1);
|
||||
$this->decoratedFactory->expects($this->at(1))
|
||||
->method('createListFromLoader')
|
||||
->with($loader2)
|
||||
->will($this->returnValue($list2));
|
||||
->willReturn($list2);
|
||||
|
||||
$this->assertSame($list1, $this->factory->createListFromLoader($loader1));
|
||||
$this->assertSame($list2, $this->factory->createListFromLoader($loader2));
|
||||
@ -204,7 +204,7 @@ class CachingFactoryDecoratorTest extends TestCase
|
||||
$this->decoratedFactory->expects($this->once())
|
||||
->method('createListFromLoader')
|
||||
->with($loader, $closure)
|
||||
->will($this->returnValue($list));
|
||||
->willReturn($list);
|
||||
|
||||
$this->assertSame($list, $this->factory->createListFromLoader($loader, $closure));
|
||||
$this->assertSame($list, $this->factory->createListFromLoader($loader, $closure));
|
||||
@ -221,11 +221,11 @@ class CachingFactoryDecoratorTest extends TestCase
|
||||
$this->decoratedFactory->expects($this->at(0))
|
||||
->method('createListFromLoader')
|
||||
->with($loader, $closure1)
|
||||
->will($this->returnValue($list1));
|
||||
->willReturn($list1);
|
||||
$this->decoratedFactory->expects($this->at(1))
|
||||
->method('createListFromLoader')
|
||||
->with($loader, $closure2)
|
||||
->will($this->returnValue($list2));
|
||||
->willReturn($list2);
|
||||
|
||||
$this->assertSame($list1, $this->factory->createListFromLoader($loader, $closure1));
|
||||
$this->assertSame($list2, $this->factory->createListFromLoader($loader, $closure2));
|
||||
@ -240,7 +240,7 @@ class CachingFactoryDecoratorTest extends TestCase
|
||||
$this->decoratedFactory->expects($this->once())
|
||||
->method('createView')
|
||||
->with($list, $preferred)
|
||||
->will($this->returnValue($view));
|
||||
->willReturn($view);
|
||||
|
||||
$this->assertSame($view, $this->factory->createView($list, $preferred));
|
||||
$this->assertSame($view, $this->factory->createView($list, $preferred));
|
||||
@ -257,11 +257,11 @@ class CachingFactoryDecoratorTest extends TestCase
|
||||
$this->decoratedFactory->expects($this->at(0))
|
||||
->method('createView')
|
||||
->with($list, $preferred1)
|
||||
->will($this->returnValue($view1));
|
||||
->willReturn($view1);
|
||||
$this->decoratedFactory->expects($this->at(1))
|
||||
->method('createView')
|
||||
->with($list, $preferred2)
|
||||
->will($this->returnValue($view2));
|
||||
->willReturn($view2);
|
||||
|
||||
$this->assertSame($view1, $this->factory->createView($list, $preferred1));
|
||||
$this->assertSame($view2, $this->factory->createView($list, $preferred2));
|
||||
@ -276,7 +276,7 @@ class CachingFactoryDecoratorTest extends TestCase
|
||||
$this->decoratedFactory->expects($this->once())
|
||||
->method('createView')
|
||||
->with($list, $preferred)
|
||||
->will($this->returnValue($view));
|
||||
->willReturn($view);
|
||||
|
||||
$this->assertSame($view, $this->factory->createView($list, $preferred));
|
||||
$this->assertSame($view, $this->factory->createView($list, $preferred));
|
||||
@ -293,11 +293,11 @@ class CachingFactoryDecoratorTest extends TestCase
|
||||
$this->decoratedFactory->expects($this->at(0))
|
||||
->method('createView')
|
||||
->with($list, $preferred1)
|
||||
->will($this->returnValue($view1));
|
||||
->willReturn($view1);
|
||||
$this->decoratedFactory->expects($this->at(1))
|
||||
->method('createView')
|
||||
->with($list, $preferred2)
|
||||
->will($this->returnValue($view2));
|
||||
->willReturn($view2);
|
||||
|
||||
$this->assertSame($view1, $this->factory->createView($list, $preferred1));
|
||||
$this->assertSame($view2, $this->factory->createView($list, $preferred2));
|
||||
@ -312,7 +312,7 @@ class CachingFactoryDecoratorTest extends TestCase
|
||||
$this->decoratedFactory->expects($this->once())
|
||||
->method('createView')
|
||||
->with($list, null, $labels)
|
||||
->will($this->returnValue($view));
|
||||
->willReturn($view);
|
||||
|
||||
$this->assertSame($view, $this->factory->createView($list, null, $labels));
|
||||
$this->assertSame($view, $this->factory->createView($list, null, $labels));
|
||||
@ -329,11 +329,11 @@ class CachingFactoryDecoratorTest extends TestCase
|
||||
$this->decoratedFactory->expects($this->at(0))
|
||||
->method('createView')
|
||||
->with($list, null, $labels1)
|
||||
->will($this->returnValue($view1));
|
||||
->willReturn($view1);
|
||||
$this->decoratedFactory->expects($this->at(1))
|
||||
->method('createView')
|
||||
->with($list, null, $labels2)
|
||||
->will($this->returnValue($view2));
|
||||
->willReturn($view2);
|
||||
|
||||
$this->assertSame($view1, $this->factory->createView($list, null, $labels1));
|
||||
$this->assertSame($view2, $this->factory->createView($list, null, $labels2));
|
||||
@ -348,7 +348,7 @@ class CachingFactoryDecoratorTest extends TestCase
|
||||
$this->decoratedFactory->expects($this->once())
|
||||
->method('createView')
|
||||
->with($list, null, null, $index)
|
||||
->will($this->returnValue($view));
|
||||
->willReturn($view);
|
||||
|
||||
$this->assertSame($view, $this->factory->createView($list, null, null, $index));
|
||||
$this->assertSame($view, $this->factory->createView($list, null, null, $index));
|
||||
@ -365,11 +365,11 @@ class CachingFactoryDecoratorTest extends TestCase
|
||||
$this->decoratedFactory->expects($this->at(0))
|
||||
->method('createView')
|
||||
->with($list, null, null, $index1)
|
||||
->will($this->returnValue($view1));
|
||||
->willReturn($view1);
|
||||
$this->decoratedFactory->expects($this->at(1))
|
||||
->method('createView')
|
||||
->with($list, null, null, $index2)
|
||||
->will($this->returnValue($view2));
|
||||
->willReturn($view2);
|
||||
|
||||
$this->assertSame($view1, $this->factory->createView($list, null, null, $index1));
|
||||
$this->assertSame($view2, $this->factory->createView($list, null, null, $index2));
|
||||
@ -384,7 +384,7 @@ class CachingFactoryDecoratorTest extends TestCase
|
||||
$this->decoratedFactory->expects($this->once())
|
||||
->method('createView')
|
||||
->with($list, null, null, null, $groupBy)
|
||||
->will($this->returnValue($view));
|
||||
->willReturn($view);
|
||||
|
||||
$this->assertSame($view, $this->factory->createView($list, null, null, null, $groupBy));
|
||||
$this->assertSame($view, $this->factory->createView($list, null, null, null, $groupBy));
|
||||
@ -401,11 +401,11 @@ class CachingFactoryDecoratorTest extends TestCase
|
||||
$this->decoratedFactory->expects($this->at(0))
|
||||
->method('createView')
|
||||
->with($list, null, null, null, $groupBy1)
|
||||
->will($this->returnValue($view1));
|
||||
->willReturn($view1);
|
||||
$this->decoratedFactory->expects($this->at(1))
|
||||
->method('createView')
|
||||
->with($list, null, null, null, $groupBy2)
|
||||
->will($this->returnValue($view2));
|
||||
->willReturn($view2);
|
||||
|
||||
$this->assertSame($view1, $this->factory->createView($list, null, null, null, $groupBy1));
|
||||
$this->assertSame($view2, $this->factory->createView($list, null, null, null, $groupBy2));
|
||||
@ -420,7 +420,7 @@ class CachingFactoryDecoratorTest extends TestCase
|
||||
$this->decoratedFactory->expects($this->once())
|
||||
->method('createView')
|
||||
->with($list, null, null, null, null, $attr)
|
||||
->will($this->returnValue($view));
|
||||
->willReturn($view);
|
||||
|
||||
$this->assertSame($view, $this->factory->createView($list, null, null, null, null, $attr));
|
||||
$this->assertSame($view, $this->factory->createView($list, null, null, null, null, $attr));
|
||||
@ -437,11 +437,11 @@ class CachingFactoryDecoratorTest extends TestCase
|
||||
$this->decoratedFactory->expects($this->at(0))
|
||||
->method('createView')
|
||||
->with($list, null, null, null, null, $attr1)
|
||||
->will($this->returnValue($view1));
|
||||
->willReturn($view1);
|
||||
$this->decoratedFactory->expects($this->at(1))
|
||||
->method('createView')
|
||||
->with($list, null, null, null, null, $attr2)
|
||||
->will($this->returnValue($view2));
|
||||
->willReturn($view2);
|
||||
|
||||
$this->assertSame($view1, $this->factory->createView($list, null, null, null, null, $attr1));
|
||||
$this->assertSame($view2, $this->factory->createView($list, null, null, null, null, $attr2));
|
||||
@ -456,7 +456,7 @@ class CachingFactoryDecoratorTest extends TestCase
|
||||
$this->decoratedFactory->expects($this->once())
|
||||
->method('createView')
|
||||
->with($list, null, null, null, null, $attr)
|
||||
->will($this->returnValue($view));
|
||||
->willReturn($view);
|
||||
|
||||
$this->assertSame($view, $this->factory->createView($list, null, null, null, null, $attr));
|
||||
$this->assertSame($view, $this->factory->createView($list, null, null, null, null, $attr));
|
||||
@ -473,11 +473,11 @@ class CachingFactoryDecoratorTest extends TestCase
|
||||
$this->decoratedFactory->expects($this->at(0))
|
||||
->method('createView')
|
||||
->with($list, null, null, null, null, $attr1)
|
||||
->will($this->returnValue($view1));
|
||||
->willReturn($view1);
|
||||
$this->decoratedFactory->expects($this->at(1))
|
||||
->method('createView')
|
||||
->with($list, null, null, null, null, $attr2)
|
||||
->will($this->returnValue($view2));
|
||||
->willReturn($view2);
|
||||
|
||||
$this->assertSame($view1, $this->factory->createView($list, null, null, null, null, $attr1));
|
||||
$this->assertSame($view2, $this->factory->createView($list, null, null, null, null, $attr2));
|
||||
|
@ -43,9 +43,9 @@ class PropertyAccessDecoratorTest extends TestCase
|
||||
$this->decoratedFactory->expects($this->once())
|
||||
->method('createListFromChoices')
|
||||
->with($choices, $this->isInstanceOf('\Closure'))
|
||||
->will($this->returnCallback(function ($choices, $callback) {
|
||||
->willReturnCallback(function ($choices, $callback) {
|
||||
return array_map($callback, $choices);
|
||||
}));
|
||||
});
|
||||
|
||||
$this->assertSame(['value'], $this->factory->createListFromChoices($choices, 'property'));
|
||||
}
|
||||
@ -57,9 +57,9 @@ class PropertyAccessDecoratorTest extends TestCase
|
||||
$this->decoratedFactory->expects($this->once())
|
||||
->method('createListFromChoices')
|
||||
->with($choices, $this->isInstanceOf('\Closure'))
|
||||
->will($this->returnCallback(function ($choices, $callback) {
|
||||
->willReturnCallback(function ($choices, $callback) {
|
||||
return array_map($callback, $choices);
|
||||
}));
|
||||
});
|
||||
|
||||
$this->assertSame(['value'], $this->factory->createListFromChoices($choices, new PropertyPath('property')));
|
||||
}
|
||||
@ -71,9 +71,9 @@ class PropertyAccessDecoratorTest extends TestCase
|
||||
$this->decoratedFactory->expects($this->once())
|
||||
->method('createListFromLoader')
|
||||
->with($loader, $this->isInstanceOf('\Closure'))
|
||||
->will($this->returnCallback(function ($loader, $callback) {
|
||||
->willReturnCallback(function ($loader, $callback) {
|
||||
return $callback((object) ['property' => 'value']);
|
||||
}));
|
||||
});
|
||||
|
||||
$this->assertSame('value', $this->factory->createListFromLoader($loader, 'property'));
|
||||
}
|
||||
@ -86,9 +86,9 @@ class PropertyAccessDecoratorTest extends TestCase
|
||||
$this->decoratedFactory->expects($this->once())
|
||||
->method('createListFromChoices')
|
||||
->with($choices, $this->isInstanceOf('\Closure'))
|
||||
->will($this->returnCallback(function ($choices, $callback) {
|
||||
->willReturnCallback(function ($choices, $callback) {
|
||||
return array_map($callback, $choices);
|
||||
}));
|
||||
});
|
||||
|
||||
$this->assertSame([null], $this->factory->createListFromChoices($choices, 'property'));
|
||||
}
|
||||
@ -101,9 +101,9 @@ class PropertyAccessDecoratorTest extends TestCase
|
||||
$this->decoratedFactory->expects($this->once())
|
||||
->method('createListFromLoader')
|
||||
->with($loader, $this->isInstanceOf('\Closure'))
|
||||
->will($this->returnCallback(function ($loader, $callback) {
|
||||
->willReturnCallback(function ($loader, $callback) {
|
||||
return $callback(null);
|
||||
}));
|
||||
});
|
||||
|
||||
$this->assertNull($this->factory->createListFromLoader($loader, 'property'));
|
||||
}
|
||||
@ -115,9 +115,9 @@ class PropertyAccessDecoratorTest extends TestCase
|
||||
$this->decoratedFactory->expects($this->once())
|
||||
->method('createListFromLoader')
|
||||
->with($loader, $this->isInstanceOf('\Closure'))
|
||||
->will($this->returnCallback(function ($loader, $callback) {
|
||||
->willReturnCallback(function ($loader, $callback) {
|
||||
return $callback((object) ['property' => 'value']);
|
||||
}));
|
||||
});
|
||||
|
||||
$this->assertSame('value', $this->factory->createListFromLoader($loader, new PropertyPath('property')));
|
||||
}
|
||||
@ -129,9 +129,9 @@ class PropertyAccessDecoratorTest extends TestCase
|
||||
$this->decoratedFactory->expects($this->once())
|
||||
->method('createView')
|
||||
->with($list, $this->isInstanceOf('\Closure'))
|
||||
->will($this->returnCallback(function ($list, $preferred) {
|
||||
->willReturnCallback(function ($list, $preferred) {
|
||||
return $preferred((object) ['property' => true]);
|
||||
}));
|
||||
});
|
||||
|
||||
$this->assertTrue($this->factory->createView(
|
||||
$list,
|
||||
@ -146,9 +146,9 @@ class PropertyAccessDecoratorTest extends TestCase
|
||||
$this->decoratedFactory->expects($this->once())
|
||||
->method('createView')
|
||||
->with($list, $this->isInstanceOf('\Closure'))
|
||||
->will($this->returnCallback(function ($list, $preferred) {
|
||||
->willReturnCallback(function ($list, $preferred) {
|
||||
return $preferred((object) ['property' => true]);
|
||||
}));
|
||||
});
|
||||
|
||||
$this->assertTrue($this->factory->createView(
|
||||
$list,
|
||||
@ -164,9 +164,9 @@ class PropertyAccessDecoratorTest extends TestCase
|
||||
$this->decoratedFactory->expects($this->once())
|
||||
->method('createView')
|
||||
->with($list, $this->isInstanceOf('\Closure'))
|
||||
->will($this->returnCallback(function ($list, $preferred) {
|
||||
->willReturnCallback(function ($list, $preferred) {
|
||||
return $preferred((object) ['category' => null]);
|
||||
}));
|
||||
});
|
||||
|
||||
$this->assertFalse($this->factory->createView(
|
||||
$list,
|
||||
@ -181,9 +181,9 @@ class PropertyAccessDecoratorTest extends TestCase
|
||||
$this->decoratedFactory->expects($this->once())
|
||||
->method('createView')
|
||||
->with($list, null, $this->isInstanceOf('\Closure'))
|
||||
->will($this->returnCallback(function ($list, $preferred, $label) {
|
||||
->willReturnCallback(function ($list, $preferred, $label) {
|
||||
return $label((object) ['property' => 'label']);
|
||||
}));
|
||||
});
|
||||
|
||||
$this->assertSame('label', $this->factory->createView(
|
||||
$list,
|
||||
@ -199,9 +199,9 @@ class PropertyAccessDecoratorTest extends TestCase
|
||||
$this->decoratedFactory->expects($this->once())
|
||||
->method('createView')
|
||||
->with($list, null, $this->isInstanceOf('\Closure'))
|
||||
->will($this->returnCallback(function ($list, $preferred, $label) {
|
||||
->willReturnCallback(function ($list, $preferred, $label) {
|
||||
return $label((object) ['property' => 'label']);
|
||||
}));
|
||||
});
|
||||
|
||||
$this->assertSame('label', $this->factory->createView(
|
||||
$list,
|
||||
@ -217,9 +217,9 @@ class PropertyAccessDecoratorTest extends TestCase
|
||||
$this->decoratedFactory->expects($this->once())
|
||||
->method('createView')
|
||||
->with($list, null, null, $this->isInstanceOf('\Closure'))
|
||||
->will($this->returnCallback(function ($list, $preferred, $label, $index) {
|
||||
->willReturnCallback(function ($list, $preferred, $label, $index) {
|
||||
return $index((object) ['property' => 'index']);
|
||||
}));
|
||||
});
|
||||
|
||||
$this->assertSame('index', $this->factory->createView(
|
||||
$list,
|
||||
@ -236,9 +236,9 @@ class PropertyAccessDecoratorTest extends TestCase
|
||||
$this->decoratedFactory->expects($this->once())
|
||||
->method('createView')
|
||||
->with($list, null, null, $this->isInstanceOf('\Closure'))
|
||||
->will($this->returnCallback(function ($list, $preferred, $label, $index) {
|
||||
->willReturnCallback(function ($list, $preferred, $label, $index) {
|
||||
return $index((object) ['property' => 'index']);
|
||||
}));
|
||||
});
|
||||
|
||||
$this->assertSame('index', $this->factory->createView(
|
||||
$list,
|
||||
@ -255,9 +255,9 @@ class PropertyAccessDecoratorTest extends TestCase
|
||||
$this->decoratedFactory->expects($this->once())
|
||||
->method('createView')
|
||||
->with($list, null, null, null, $this->isInstanceOf('\Closure'))
|
||||
->will($this->returnCallback(function ($list, $preferred, $label, $index, $groupBy) {
|
||||
->willReturnCallback(function ($list, $preferred, $label, $index, $groupBy) {
|
||||
return $groupBy((object) ['property' => 'group']);
|
||||
}));
|
||||
});
|
||||
|
||||
$this->assertSame('group', $this->factory->createView(
|
||||
$list,
|
||||
@ -275,9 +275,9 @@ class PropertyAccessDecoratorTest extends TestCase
|
||||
$this->decoratedFactory->expects($this->once())
|
||||
->method('createView')
|
||||
->with($list, null, null, null, $this->isInstanceOf('\Closure'))
|
||||
->will($this->returnCallback(function ($list, $preferred, $label, $index, $groupBy) {
|
||||
->willReturnCallback(function ($list, $preferred, $label, $index, $groupBy) {
|
||||
return $groupBy((object) ['property' => 'group']);
|
||||
}));
|
||||
});
|
||||
|
||||
$this->assertSame('group', $this->factory->createView(
|
||||
$list,
|
||||
@ -296,9 +296,9 @@ class PropertyAccessDecoratorTest extends TestCase
|
||||
$this->decoratedFactory->expects($this->once())
|
||||
->method('createView')
|
||||
->with($list, null, null, null, $this->isInstanceOf('\Closure'))
|
||||
->will($this->returnCallback(function ($list, $preferred, $label, $index, $groupBy) {
|
||||
->willReturnCallback(function ($list, $preferred, $label, $index, $groupBy) {
|
||||
return $groupBy((object) ['group' => null]);
|
||||
}));
|
||||
});
|
||||
|
||||
$this->assertNull($this->factory->createView(
|
||||
$list,
|
||||
@ -316,9 +316,9 @@ class PropertyAccessDecoratorTest extends TestCase
|
||||
$this->decoratedFactory->expects($this->once())
|
||||
->method('createView')
|
||||
->with($list, null, null, null, null, $this->isInstanceOf('\Closure'))
|
||||
->will($this->returnCallback(function ($list, $preferred, $label, $index, $groupBy, $attr) {
|
||||
->willReturnCallback(function ($list, $preferred, $label, $index, $groupBy, $attr) {
|
||||
return $attr((object) ['property' => 'attr']);
|
||||
}));
|
||||
});
|
||||
|
||||
$this->assertSame('attr', $this->factory->createView(
|
||||
$list,
|
||||
@ -337,9 +337,9 @@ class PropertyAccessDecoratorTest extends TestCase
|
||||
$this->decoratedFactory->expects($this->once())
|
||||
->method('createView')
|
||||
->with($list, null, null, null, null, $this->isInstanceOf('\Closure'))
|
||||
->will($this->returnCallback(function ($list, $preferred, $label, $index, $groupBy, $attr) {
|
||||
->willReturnCallback(function ($list, $preferred, $label, $index, $groupBy, $attr) {
|
||||
return $attr((object) ['property' => 'attr']);
|
||||
}));
|
||||
});
|
||||
|
||||
$this->assertSame('attr', $this->factory->createView(
|
||||
$list,
|
||||
|
@ -49,12 +49,12 @@ class LazyChoiceListTest extends TestCase
|
||||
$this->loader->expects($this->exactly(2))
|
||||
->method('loadChoiceList')
|
||||
->with($this->value)
|
||||
->will($this->returnValue($this->loadedList));
|
||||
->willReturn($this->loadedList);
|
||||
|
||||
// The same list is returned by the loader
|
||||
$this->loadedList->expects($this->exactly(2))
|
||||
->method('getChoices')
|
||||
->will($this->returnValue('RESULT'));
|
||||
->willReturn('RESULT');
|
||||
|
||||
$this->assertSame('RESULT', $this->list->getChoices());
|
||||
$this->assertSame('RESULT', $this->list->getChoices());
|
||||
@ -65,12 +65,12 @@ class LazyChoiceListTest extends TestCase
|
||||
$this->loader->expects($this->exactly(2))
|
||||
->method('loadChoiceList')
|
||||
->with($this->value)
|
||||
->will($this->returnValue($this->loadedList));
|
||||
->willReturn($this->loadedList);
|
||||
|
||||
// The same list is returned by the loader
|
||||
$this->loadedList->expects($this->exactly(2))
|
||||
->method('getValues')
|
||||
->will($this->returnValue('RESULT'));
|
||||
->willReturn('RESULT');
|
||||
|
||||
$this->assertSame('RESULT', $this->list->getValues());
|
||||
$this->assertSame('RESULT', $this->list->getValues());
|
||||
@ -81,12 +81,12 @@ class LazyChoiceListTest extends TestCase
|
||||
$this->loader->expects($this->exactly(2))
|
||||
->method('loadChoiceList')
|
||||
->with($this->value)
|
||||
->will($this->returnValue($this->loadedList));
|
||||
->willReturn($this->loadedList);
|
||||
|
||||
// The same list is returned by the loader
|
||||
$this->loadedList->expects($this->exactly(2))
|
||||
->method('getStructuredValues')
|
||||
->will($this->returnValue('RESULT'));
|
||||
->willReturn('RESULT');
|
||||
|
||||
$this->assertSame('RESULT', $this->list->getStructuredValues());
|
||||
$this->assertSame('RESULT', $this->list->getStructuredValues());
|
||||
@ -97,12 +97,12 @@ class LazyChoiceListTest extends TestCase
|
||||
$this->loader->expects($this->exactly(2))
|
||||
->method('loadChoiceList')
|
||||
->with($this->value)
|
||||
->will($this->returnValue($this->loadedList));
|
||||
->willReturn($this->loadedList);
|
||||
|
||||
// The same list is returned by the loader
|
||||
$this->loadedList->expects($this->exactly(2))
|
||||
->method('getOriginalKeys')
|
||||
->will($this->returnValue('RESULT'));
|
||||
->willReturn('RESULT');
|
||||
|
||||
$this->assertSame('RESULT', $this->list->getOriginalKeys());
|
||||
$this->assertSame('RESULT', $this->list->getOriginalKeys());
|
||||
@ -113,7 +113,7 @@ class LazyChoiceListTest extends TestCase
|
||||
$this->loader->expects($this->exactly(2))
|
||||
->method('loadChoicesForValues')
|
||||
->with(['a', 'b'])
|
||||
->will($this->returnValue('RESULT'));
|
||||
->willReturn('RESULT');
|
||||
|
||||
$this->assertSame('RESULT', $this->list->getChoicesForValues(['a', 'b']));
|
||||
$this->assertSame('RESULT', $this->list->getChoicesForValues(['a', 'b']));
|
||||
@ -124,12 +124,12 @@ class LazyChoiceListTest extends TestCase
|
||||
$this->loader->expects($this->exactly(1))
|
||||
->method('loadChoiceList')
|
||||
->with($this->value)
|
||||
->will($this->returnValue($this->loadedList));
|
||||
->willReturn($this->loadedList);
|
||||
|
||||
$this->loader->expects($this->exactly(2))
|
||||
->method('loadChoicesForValues')
|
||||
->with(['a', 'b'])
|
||||
->will($this->returnValue('RESULT'));
|
||||
->willReturn('RESULT');
|
||||
|
||||
// load choice list
|
||||
$this->list->getChoices();
|
||||
@ -143,12 +143,12 @@ class LazyChoiceListTest extends TestCase
|
||||
$this->loader->expects($this->exactly(1))
|
||||
->method('loadChoiceList')
|
||||
->with($this->value)
|
||||
->will($this->returnValue($this->loadedList));
|
||||
->willReturn($this->loadedList);
|
||||
|
||||
$this->loader->expects($this->exactly(2))
|
||||
->method('loadValuesForChoices')
|
||||
->with(['a', 'b'])
|
||||
->will($this->returnValue('RESULT'));
|
||||
->willReturn('RESULT');
|
||||
|
||||
// load choice list
|
||||
$this->list->getChoices();
|
||||
|
@ -179,7 +179,7 @@ class CompoundFormTest extends AbstractFormTest
|
||||
'bar' => 'baz',
|
||||
'auto_initialize' => false,
|
||||
])
|
||||
->will($this->returnValue($child));
|
||||
->willReturn($child);
|
||||
|
||||
$this->form->add('foo', 'Symfony\Component\Form\Extension\Core\Type\TextType', ['bar' => 'baz']);
|
||||
|
||||
@ -198,7 +198,7 @@ class CompoundFormTest extends AbstractFormTest
|
||||
'bar' => 'baz',
|
||||
'auto_initialize' => false,
|
||||
])
|
||||
->will($this->returnValue($child));
|
||||
->willReturn($child);
|
||||
|
||||
// in order to make casting unnecessary
|
||||
$this->form->add(0, 'Symfony\Component\Form\Extension\Core\Type\TextType', ['bar' => 'baz']);
|
||||
@ -215,7 +215,7 @@ class CompoundFormTest extends AbstractFormTest
|
||||
$this->factory->expects($this->once())
|
||||
->method('createNamed')
|
||||
->with('foo', 'Symfony\Component\Form\Extension\Core\Type\TextType')
|
||||
->will($this->returnValue($child));
|
||||
->willReturn($child);
|
||||
|
||||
$this->form->add('foo');
|
||||
|
||||
@ -236,7 +236,7 @@ class CompoundFormTest extends AbstractFormTest
|
||||
$this->factory->expects($this->once())
|
||||
->method('createForProperty')
|
||||
->with('\stdClass', 'foo')
|
||||
->will($this->returnValue($child));
|
||||
->willReturn($child);
|
||||
|
||||
$this->form->add('foo');
|
||||
|
||||
@ -260,7 +260,7 @@ class CompoundFormTest extends AbstractFormTest
|
||||
'bar' => 'baz',
|
||||
'auto_initialize' => false,
|
||||
])
|
||||
->will($this->returnValue($child));
|
||||
->willReturn($child);
|
||||
|
||||
$this->form->add('foo', null, ['bar' => 'baz']);
|
||||
|
||||
@ -352,10 +352,10 @@ class CompoundFormTest extends AbstractFormTest
|
||||
$mapper->expects($this->once())
|
||||
->method('mapDataToForms')
|
||||
->with('bar', $this->isInstanceOf('\RecursiveIteratorIterator'))
|
||||
->will($this->returnCallback(function ($data, \RecursiveIteratorIterator $iterator) use ($child) {
|
||||
->willReturnCallback(function ($data, \RecursiveIteratorIterator $iterator) use ($child) {
|
||||
$this->assertInstanceOf('Symfony\Component\Form\Util\InheritDataAwareIterator', $iterator->getInnerIterator());
|
||||
$this->assertSame([$child->getName() => $child], iterator_to_array($iterator));
|
||||
}));
|
||||
});
|
||||
|
||||
$form->initialize();
|
||||
$form->add($child);
|
||||
@ -442,10 +442,10 @@ class CompoundFormTest extends AbstractFormTest
|
||||
$mapper->expects($this->once())
|
||||
->method('mapDataToForms')
|
||||
->with('bar', $this->isInstanceOf('\RecursiveIteratorIterator'))
|
||||
->will($this->returnCallback(function ($data, \RecursiveIteratorIterator $iterator) use ($child1, $child2) {
|
||||
->willReturnCallback(function ($data, \RecursiveIteratorIterator $iterator) use ($child1, $child2) {
|
||||
$this->assertInstanceOf('Symfony\Component\Form\Util\InheritDataAwareIterator', $iterator->getInnerIterator());
|
||||
$this->assertSame(['firstName' => $child1, 'lastName' => $child2], iterator_to_array($iterator));
|
||||
}));
|
||||
});
|
||||
|
||||
$form->setData('foo');
|
||||
}
|
||||
@ -517,12 +517,12 @@ class CompoundFormTest extends AbstractFormTest
|
||||
$mapper->expects($this->once())
|
||||
->method('mapFormsToData')
|
||||
->with($this->isInstanceOf('\RecursiveIteratorIterator'), 'bar')
|
||||
->will($this->returnCallback(function (\RecursiveIteratorIterator $iterator) use ($child1, $child2) {
|
||||
->willReturnCallback(function (\RecursiveIteratorIterator $iterator) use ($child1, $child2) {
|
||||
$this->assertInstanceOf('Symfony\Component\Form\Util\InheritDataAwareIterator', $iterator->getInnerIterator());
|
||||
$this->assertSame(['firstName' => $child1, 'lastName' => $child2], iterator_to_array($iterator));
|
||||
$this->assertEquals('Bernhard', $child1->getData());
|
||||
$this->assertEquals('Schussek', $child2->getData());
|
||||
}));
|
||||
});
|
||||
|
||||
$form->submit([
|
||||
'firstName' => 'Bernhard',
|
||||
@ -589,10 +589,10 @@ class CompoundFormTest extends AbstractFormTest
|
||||
$mapper->expects($this->once())
|
||||
->method('mapFormsToData')
|
||||
->with($this->isInstanceOf('\RecursiveIteratorIterator'), $object)
|
||||
->will($this->returnCallback(function (\RecursiveIteratorIterator $iterator) use ($child) {
|
||||
->willReturnCallback(function (\RecursiveIteratorIterator $iterator) use ($child) {
|
||||
$this->assertInstanceOf('Symfony\Component\Form\Util\InheritDataAwareIterator', $iterator->getInnerIterator());
|
||||
$this->assertSame(['name' => $child], iterator_to_array($iterator));
|
||||
}));
|
||||
});
|
||||
|
||||
$form->submit([
|
||||
'name' => 'Bernhard',
|
||||
@ -957,11 +957,11 @@ class CompoundFormTest extends AbstractFormTest
|
||||
$field1View = new FormView();
|
||||
$type1
|
||||
->method('createView')
|
||||
->will($this->returnValue($field1View));
|
||||
->willReturn($field1View);
|
||||
$field2View = new FormView();
|
||||
$type2
|
||||
->method('createView')
|
||||
->will($this->returnValue($field2View));
|
||||
->willReturn($field2View);
|
||||
|
||||
$this->form = $this->getBuilder('form', null, null, $options)
|
||||
->setCompound(true)
|
||||
@ -980,13 +980,13 @@ class CompoundFormTest extends AbstractFormTest
|
||||
// First create the view
|
||||
$type->expects($this->once())
|
||||
->method('createView')
|
||||
->will($this->returnValue($view));
|
||||
->willReturn($view);
|
||||
|
||||
// Then build it for the form itself
|
||||
$type->expects($this->once())
|
||||
->method('buildView')
|
||||
->with($view, $this->form, $options)
|
||||
->will($this->returnCallback($assertChildViewsEqual([])));
|
||||
->willReturnCallback($assertChildViewsEqual([]));
|
||||
|
||||
$this->assertSame($view, $this->form->createView());
|
||||
$this->assertSame(['foo' => $field1View, 'bar' => $field2View], $view->children);
|
||||
@ -1006,7 +1006,7 @@ class CompoundFormTest extends AbstractFormTest
|
||||
|
||||
$button->expects($this->any())
|
||||
->method('isClicked')
|
||||
->will($this->returnValue(false));
|
||||
->willReturn(false);
|
||||
|
||||
$parentForm = $this->getBuilder('parent')->getForm();
|
||||
$nestedForm = $this->getBuilder('nested')->getForm();
|
||||
@ -1028,7 +1028,7 @@ class CompoundFormTest extends AbstractFormTest
|
||||
|
||||
$button->expects($this->any())
|
||||
->method('isClicked')
|
||||
->will($this->returnValue(true));
|
||||
->willReturn(true);
|
||||
|
||||
$this->form->add($button);
|
||||
$this->form->submit([]);
|
||||
@ -1047,7 +1047,7 @@ class CompoundFormTest extends AbstractFormTest
|
||||
|
||||
$nestedForm->expects($this->any())
|
||||
->method('getClickedButton')
|
||||
->will($this->returnValue($button));
|
||||
->willReturn($button);
|
||||
|
||||
$this->form->add($nestedForm);
|
||||
$this->form->submit([]);
|
||||
@ -1066,7 +1066,7 @@ class CompoundFormTest extends AbstractFormTest
|
||||
|
||||
$parentForm->expects($this->any())
|
||||
->method('getClickedButton')
|
||||
->will($this->returnValue($button));
|
||||
->willReturn($button);
|
||||
|
||||
$this->form->setParent($parentForm);
|
||||
$this->form->submit([]);
|
||||
|
@ -22,12 +22,12 @@ class DataTransformerChainTest extends TestCase
|
||||
$transformer1->expects($this->once())
|
||||
->method('transform')
|
||||
->with($this->identicalTo('foo'))
|
||||
->will($this->returnValue('bar'));
|
||||
->willReturn('bar');
|
||||
$transformer2 = $this->getMockBuilder('Symfony\Component\Form\DataTransformerInterface')->getMock();
|
||||
$transformer2->expects($this->once())
|
||||
->method('transform')
|
||||
->with($this->identicalTo('bar'))
|
||||
->will($this->returnValue('baz'));
|
||||
->willReturn('baz');
|
||||
|
||||
$chain = new DataTransformerChain([$transformer1, $transformer2]);
|
||||
|
||||
@ -40,12 +40,12 @@ class DataTransformerChainTest extends TestCase
|
||||
$transformer2->expects($this->once())
|
||||
->method('reverseTransform')
|
||||
->with($this->identicalTo('foo'))
|
||||
->will($this->returnValue('bar'));
|
||||
->willReturn('bar');
|
||||
$transformer1 = $this->getMockBuilder('Symfony\Component\Form\DataTransformerInterface')->getMock();
|
||||
$transformer1->expects($this->once())
|
||||
->method('reverseTransform')
|
||||
->with($this->identicalTo('bar'))
|
||||
->will($this->returnValue('baz'));
|
||||
->willReturn('baz');
|
||||
|
||||
$chain = new DataTransformerChain([$transformer1, $transformer2]);
|
||||
|
||||
|
@ -124,7 +124,7 @@ class FormTypeCsrfExtensionTest extends TypeTestCase
|
||||
$this->tokenManager->expects($this->once())
|
||||
->method('getToken')
|
||||
->with('TOKEN_ID')
|
||||
->will($this->returnValue(new CsrfToken('TOKEN_ID', 'token')));
|
||||
->willReturn(new CsrfToken('TOKEN_ID', 'token'));
|
||||
|
||||
$view = $this->factory
|
||||
->create('Symfony\Component\Form\Extension\Core\Type\FormType', null, [
|
||||
@ -143,7 +143,7 @@ class FormTypeCsrfExtensionTest extends TypeTestCase
|
||||
$this->tokenManager->expects($this->once())
|
||||
->method('getToken')
|
||||
->with('FORM_NAME')
|
||||
->will($this->returnValue('token'));
|
||||
->willReturn('token');
|
||||
|
||||
$view = $this->factory
|
||||
->createNamed('FORM_NAME', 'Symfony\Component\Form\Extension\Core\Type\FormType', null, [
|
||||
@ -161,7 +161,7 @@ class FormTypeCsrfExtensionTest extends TypeTestCase
|
||||
$this->tokenManager->expects($this->once())
|
||||
->method('getToken')
|
||||
->with('Symfony\Component\Form\Extension\Core\Type\FormType')
|
||||
->will($this->returnValue('token'));
|
||||
->willReturn('token');
|
||||
|
||||
$view = $this->factory
|
||||
->createNamed('', 'Symfony\Component\Form\Extension\Core\Type\FormType', null, [
|
||||
@ -190,7 +190,7 @@ class FormTypeCsrfExtensionTest extends TypeTestCase
|
||||
$this->tokenManager->expects($this->once())
|
||||
->method('isTokenValid')
|
||||
->with(new CsrfToken('TOKEN_ID', 'token'))
|
||||
->will($this->returnValue($valid));
|
||||
->willReturn($valid);
|
||||
|
||||
$form = $this->factory
|
||||
->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType', null, [
|
||||
@ -222,7 +222,7 @@ class FormTypeCsrfExtensionTest extends TypeTestCase
|
||||
$this->tokenManager->expects($this->once())
|
||||
->method('isTokenValid')
|
||||
->with(new CsrfToken('FORM_NAME', 'token'))
|
||||
->will($this->returnValue($valid));
|
||||
->willReturn($valid);
|
||||
|
||||
$form = $this->factory
|
||||
->createNamedBuilder('FORM_NAME', 'Symfony\Component\Form\Extension\Core\Type\FormType', null, [
|
||||
@ -253,7 +253,7 @@ class FormTypeCsrfExtensionTest extends TypeTestCase
|
||||
$this->tokenManager->expects($this->once())
|
||||
->method('isTokenValid')
|
||||
->with(new CsrfToken('Symfony\Component\Form\Extension\Core\Type\FormType', 'token'))
|
||||
->will($this->returnValue($valid));
|
||||
->willReturn($valid);
|
||||
|
||||
$form = $this->factory
|
||||
->createNamedBuilder('', 'Symfony\Component\Form\Extension\Core\Type\FormType', null, [
|
||||
@ -369,12 +369,12 @@ class FormTypeCsrfExtensionTest extends TypeTestCase
|
||||
$this->tokenManager->expects($this->once())
|
||||
->method('isTokenValid')
|
||||
->with($csrfToken)
|
||||
->will($this->returnValue(false));
|
||||
->willReturn(false);
|
||||
|
||||
$this->translator->expects($this->once())
|
||||
->method('trans')
|
||||
->with('Foobar')
|
||||
->will($this->returnValue('[trans]Foobar[/trans]'));
|
||||
->willReturn('[trans]Foobar[/trans]');
|
||||
|
||||
$form = $this->factory
|
||||
->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType', null, [
|
||||
|
@ -84,29 +84,29 @@ class FormDataCollectorTest extends TestCase
|
||||
$this->dataExtractor->expects($this->at(0))
|
||||
->method('extractConfiguration')
|
||||
->with($this->form)
|
||||
->will($this->returnValue(['config' => 'foo']));
|
||||
->willReturn(['config' => 'foo']);
|
||||
$this->dataExtractor->expects($this->at(1))
|
||||
->method('extractConfiguration')
|
||||
->with($this->childForm)
|
||||
->will($this->returnValue(['config' => 'bar']));
|
||||
->willReturn(['config' => 'bar']);
|
||||
|
||||
$this->dataExtractor->expects($this->at(2))
|
||||
->method('extractDefaultData')
|
||||
->with($this->form)
|
||||
->will($this->returnValue(['default_data' => 'foo']));
|
||||
->willReturn(['default_data' => 'foo']);
|
||||
$this->dataExtractor->expects($this->at(3))
|
||||
->method('extractDefaultData')
|
||||
->with($this->childForm)
|
||||
->will($this->returnValue(['default_data' => 'bar']));
|
||||
->willReturn(['default_data' => 'bar']);
|
||||
|
||||
$this->dataExtractor->expects($this->at(4))
|
||||
->method('extractSubmittedData')
|
||||
->with($this->form)
|
||||
->will($this->returnValue(['submitted_data' => 'foo']));
|
||||
->willReturn(['submitted_data' => 'foo']);
|
||||
$this->dataExtractor->expects($this->at(5))
|
||||
->method('extractSubmittedData')
|
||||
->with($this->childForm)
|
||||
->will($this->returnValue(['submitted_data' => 'bar']));
|
||||
->willReturn(['submitted_data' => 'bar']);
|
||||
|
||||
$this->dataCollector->collectConfiguration($this->form);
|
||||
$this->dataCollector->collectDefaultData($this->form);
|
||||
@ -150,11 +150,11 @@ class FormDataCollectorTest extends TestCase
|
||||
$this->dataExtractor->expects($this->at(0))
|
||||
->method('extractConfiguration')
|
||||
->with($form1)
|
||||
->will($this->returnValue(['config' => 'foo']));
|
||||
->willReturn(['config' => 'foo']);
|
||||
$this->dataExtractor->expects($this->at(1))
|
||||
->method('extractConfiguration')
|
||||
->with($form2)
|
||||
->will($this->returnValue(['config' => 'bar']));
|
||||
->willReturn(['config' => 'bar']);
|
||||
|
||||
$this->dataCollector->collectConfiguration($form1);
|
||||
$this->dataCollector->collectConfiguration($form2);
|
||||
@ -200,12 +200,12 @@ class FormDataCollectorTest extends TestCase
|
||||
$this->dataExtractor->expects($this->at(0))
|
||||
->method('extractConfiguration')
|
||||
->with($this->form)
|
||||
->will($this->returnValue(['config' => 'foo']));
|
||||
->willReturn(['config' => 'foo']);
|
||||
|
||||
$this->dataExtractor->expects($this->at(1))
|
||||
->method('extractDefaultData')
|
||||
->with($this->form)
|
||||
->will($this->returnValue(['default_data' => 'foo']));
|
||||
->willReturn(['default_data' => 'foo']);
|
||||
|
||||
$this->dataCollector->collectConfiguration($this->form);
|
||||
$this->dataCollector->buildPreliminaryFormTree($this->form);
|
||||
@ -272,39 +272,39 @@ class FormDataCollectorTest extends TestCase
|
||||
$this->dataExtractor->expects($this->at(0))
|
||||
->method('extractConfiguration')
|
||||
->with($this->form)
|
||||
->will($this->returnValue(['config' => 'foo']));
|
||||
->willReturn(['config' => 'foo']);
|
||||
$this->dataExtractor->expects($this->at(1))
|
||||
->method('extractConfiguration')
|
||||
->with($this->childForm)
|
||||
->will($this->returnValue(['config' => 'bar']));
|
||||
->willReturn(['config' => 'bar']);
|
||||
|
||||
$this->dataExtractor->expects($this->at(2))
|
||||
->method('extractDefaultData')
|
||||
->with($this->form)
|
||||
->will($this->returnValue(['default_data' => 'foo']));
|
||||
->willReturn(['default_data' => 'foo']);
|
||||
$this->dataExtractor->expects($this->at(3))
|
||||
->method('extractDefaultData')
|
||||
->with($this->childForm)
|
||||
->will($this->returnValue(['default_data' => 'bar']));
|
||||
->willReturn(['default_data' => 'bar']);
|
||||
|
||||
$this->dataExtractor->expects($this->at(4))
|
||||
->method('extractSubmittedData')
|
||||
->with($this->form)
|
||||
->will($this->returnValue(['submitted_data' => 'foo']));
|
||||
->willReturn(['submitted_data' => 'foo']);
|
||||
$this->dataExtractor->expects($this->at(5))
|
||||
->method('extractSubmittedData')
|
||||
->with($this->childForm)
|
||||
->will($this->returnValue(['submitted_data' => 'bar']));
|
||||
->willReturn(['submitted_data' => 'bar']);
|
||||
|
||||
$this->dataExtractor->expects($this->at(6))
|
||||
->method('extractViewVariables')
|
||||
->with($this->view)
|
||||
->will($this->returnValue(['view_vars' => 'foo']));
|
||||
->willReturn(['view_vars' => 'foo']);
|
||||
|
||||
$this->dataExtractor->expects($this->at(7))
|
||||
->method('extractViewVariables')
|
||||
->with($this->childView)
|
||||
->will($this->returnValue(['view_vars' => 'bar']));
|
||||
->willReturn(['view_vars' => 'bar']);
|
||||
|
||||
$this->dataCollector->collectConfiguration($this->form);
|
||||
$this->dataCollector->collectDefaultData($this->form);
|
||||
@ -365,76 +365,76 @@ class FormDataCollectorTest extends TestCase
|
||||
$this->dataExtractor->expects($this->at(0))
|
||||
->method('extractConfiguration')
|
||||
->with($form1)
|
||||
->will($this->returnValue(['config' => 'foo']));
|
||||
->willReturn(['config' => 'foo']);
|
||||
$this->dataExtractor->expects($this->at(1))
|
||||
->method('extractConfiguration')
|
||||
->with($child1)
|
||||
->will($this->returnValue(['config' => 'bar']));
|
||||
->willReturn(['config' => 'bar']);
|
||||
|
||||
$this->dataExtractor->expects($this->at(2))
|
||||
->method('extractDefaultData')
|
||||
->with($form1)
|
||||
->will($this->returnValue(['default_data' => 'foo']));
|
||||
->willReturn(['default_data' => 'foo']);
|
||||
$this->dataExtractor->expects($this->at(3))
|
||||
->method('extractDefaultData')
|
||||
->with($child1)
|
||||
->will($this->returnValue(['default_data' => 'bar']));
|
||||
->willReturn(['default_data' => 'bar']);
|
||||
|
||||
$this->dataExtractor->expects($this->at(4))
|
||||
->method('extractSubmittedData')
|
||||
->with($form1)
|
||||
->will($this->returnValue(['submitted_data' => 'foo']));
|
||||
->willReturn(['submitted_data' => 'foo']);
|
||||
$this->dataExtractor->expects($this->at(5))
|
||||
->method('extractSubmittedData')
|
||||
->with($child1)
|
||||
->will($this->returnValue(['submitted_data' => 'bar']));
|
||||
->willReturn(['submitted_data' => 'bar']);
|
||||
|
||||
$this->dataExtractor->expects($this->at(6))
|
||||
->method('extractViewVariables')
|
||||
->with($form1View)
|
||||
->will($this->returnValue(['view_vars' => 'foo']));
|
||||
->willReturn(['view_vars' => 'foo']);
|
||||
|
||||
$this->dataExtractor->expects($this->at(7))
|
||||
->method('extractViewVariables')
|
||||
->with($child1View)
|
||||
->will($this->returnValue(['view_vars' => $child1View->vars]));
|
||||
->willReturn(['view_vars' => $child1View->vars]);
|
||||
|
||||
$this->dataExtractor->expects($this->at(8))
|
||||
->method('extractConfiguration')
|
||||
->with($form2)
|
||||
->will($this->returnValue(['config' => 'foo']));
|
||||
->willReturn(['config' => 'foo']);
|
||||
$this->dataExtractor->expects($this->at(9))
|
||||
->method('extractConfiguration')
|
||||
->with($child1)
|
||||
->will($this->returnValue(['config' => 'bar']));
|
||||
->willReturn(['config' => 'bar']);
|
||||
|
||||
$this->dataExtractor->expects($this->at(10))
|
||||
->method('extractDefaultData')
|
||||
->with($form2)
|
||||
->will($this->returnValue(['default_data' => 'foo']));
|
||||
->willReturn(['default_data' => 'foo']);
|
||||
$this->dataExtractor->expects($this->at(11))
|
||||
->method('extractDefaultData')
|
||||
->with($child1)
|
||||
->will($this->returnValue(['default_data' => 'bar']));
|
||||
->willReturn(['default_data' => 'bar']);
|
||||
|
||||
$this->dataExtractor->expects($this->at(12))
|
||||
->method('extractSubmittedData')
|
||||
->with($form2)
|
||||
->will($this->returnValue(['submitted_data' => 'foo']));
|
||||
->willReturn(['submitted_data' => 'foo']);
|
||||
$this->dataExtractor->expects($this->at(13))
|
||||
->method('extractSubmittedData')
|
||||
->with($child1)
|
||||
->will($this->returnValue(['submitted_data' => 'bar']));
|
||||
->willReturn(['submitted_data' => 'bar']);
|
||||
|
||||
$this->dataExtractor->expects($this->at(14))
|
||||
->method('extractViewVariables')
|
||||
->with($form2View)
|
||||
->will($this->returnValue(['view_vars' => 'foo']));
|
||||
->willReturn(['view_vars' => 'foo']);
|
||||
|
||||
$this->dataExtractor->expects($this->at(15))
|
||||
->method('extractViewVariables')
|
||||
->with($child1View)
|
||||
->will($this->returnValue(['view_vars' => $child1View->vars]));
|
||||
->willReturn(['view_vars' => $child1View->vars]);
|
||||
|
||||
$this->dataCollector->collectConfiguration($form1);
|
||||
$this->dataCollector->collectDefaultData($form1);
|
||||
@ -518,11 +518,11 @@ class FormDataCollectorTest extends TestCase
|
||||
$this->dataExtractor->expects($this->at(0))
|
||||
->method('extractConfiguration')
|
||||
->with($this->form)
|
||||
->will($this->returnValue(['config' => 'foo']));
|
||||
->willReturn(['config' => 'foo']);
|
||||
$this->dataExtractor->expects($this->at(1))
|
||||
->method('extractConfiguration')
|
||||
->with($this->childForm)
|
||||
->will($this->returnValue(['config' => 'bar']));
|
||||
->willReturn(['config' => 'bar']);
|
||||
|
||||
// explicitly call collectConfiguration(), since $this->childForm is not
|
||||
// contained in the form tree
|
||||
@ -566,11 +566,11 @@ class FormDataCollectorTest extends TestCase
|
||||
$this->dataExtractor->expects($this->at(0))
|
||||
->method('extractConfiguration')
|
||||
->with($this->form)
|
||||
->will($this->returnValue(['config' => 'foo']));
|
||||
->willReturn(['config' => 'foo']);
|
||||
$this->dataExtractor->expects($this->at(1))
|
||||
->method('extractConfiguration')
|
||||
->with($this->childForm)
|
||||
->will($this->returnValue(['config' => 'bar']));
|
||||
->willReturn(['config' => 'bar']);
|
||||
|
||||
// explicitly call collectConfiguration(), since $this->childForm is not
|
||||
// contained in the form tree
|
||||
@ -611,22 +611,22 @@ class FormDataCollectorTest extends TestCase
|
||||
$form1->add($childForm1);
|
||||
$this->dataExtractor
|
||||
->method('extractConfiguration')
|
||||
->will($this->returnValue([]));
|
||||
->willReturn([]);
|
||||
$this->dataExtractor
|
||||
->method('extractDefaultData')
|
||||
->will($this->returnValue([]));
|
||||
->willReturn([]);
|
||||
$this->dataExtractor->expects($this->at(4))
|
||||
->method('extractSubmittedData')
|
||||
->with($form1)
|
||||
->will($this->returnValue(['errors' => ['foo']]));
|
||||
->willReturn(['errors' => ['foo']]);
|
||||
$this->dataExtractor->expects($this->at(5))
|
||||
->method('extractSubmittedData')
|
||||
->with($childForm1)
|
||||
->will($this->returnValue(['errors' => ['bar', 'bam']]));
|
||||
->willReturn(['errors' => ['bar', 'bam']]);
|
||||
$this->dataExtractor->expects($this->at(8))
|
||||
->method('extractSubmittedData')
|
||||
->with($form2)
|
||||
->will($this->returnValue(['errors' => ['baz']]));
|
||||
->willReturn(['errors' => ['baz']]);
|
||||
|
||||
$this->dataCollector->collectSubmittedData($form1);
|
||||
|
||||
@ -653,30 +653,30 @@ class FormDataCollectorTest extends TestCase
|
||||
|
||||
$this->dataExtractor
|
||||
->method('extractConfiguration')
|
||||
->will($this->returnValue([]));
|
||||
->willReturn([]);
|
||||
$this->dataExtractor
|
||||
->method('extractDefaultData')
|
||||
->will($this->returnValue([]));
|
||||
->willReturn([]);
|
||||
$this->dataExtractor->expects($this->at(10))
|
||||
->method('extractSubmittedData')
|
||||
->with($this->form)
|
||||
->will($this->returnValue(['errors' => []]));
|
||||
->willReturn(['errors' => []]);
|
||||
$this->dataExtractor->expects($this->at(11))
|
||||
->method('extractSubmittedData')
|
||||
->with($child1Form)
|
||||
->will($this->returnValue(['errors' => []]));
|
||||
->willReturn(['errors' => []]);
|
||||
$this->dataExtractor->expects($this->at(12))
|
||||
->method('extractSubmittedData')
|
||||
->with($child11Form)
|
||||
->will($this->returnValue(['errors' => ['foo']]));
|
||||
->willReturn(['errors' => ['foo']]);
|
||||
$this->dataExtractor->expects($this->at(13))
|
||||
->method('extractSubmittedData')
|
||||
->with($child2Form)
|
||||
->will($this->returnValue(['errors' => []]));
|
||||
->willReturn(['errors' => []]);
|
||||
$this->dataExtractor->expects($this->at(14))
|
||||
->method('extractSubmittedData')
|
||||
->with($child21Form)
|
||||
->will($this->returnValue(['errors' => []]));
|
||||
->willReturn(['errors' => []]);
|
||||
|
||||
$this->dataCollector->collectSubmittedData($this->form);
|
||||
$this->dataCollector->buildPreliminaryFormTree($this->form);
|
||||
@ -701,14 +701,14 @@ class FormDataCollectorTest extends TestCase
|
||||
|
||||
$this->dataExtractor->expects($this->any())
|
||||
->method('extractConfiguration')
|
||||
->will($this->returnValue([]));
|
||||
->willReturn([]);
|
||||
$this->dataExtractor->expects($this->any())
|
||||
->method('extractDefaultData')
|
||||
->will($this->returnValue([]));
|
||||
->willReturn([]);
|
||||
$this->dataExtractor->expects($this->any())
|
||||
->method('extractSubmittedData')
|
||||
->with($form)
|
||||
->will($this->returnValue(['errors' => ['baz']]));
|
||||
->willReturn(['errors' => ['baz']]);
|
||||
|
||||
$this->dataCollector->buildPreliminaryFormTree($form);
|
||||
$this->dataCollector->collectSubmittedData($form);
|
||||
|
@ -56,7 +56,7 @@ class FormDataExtractorTest extends TestCase
|
||||
$type = $this->getMockBuilder('Symfony\Component\Form\ResolvedFormTypeInterface')->getMock();
|
||||
$type->expects($this->any())
|
||||
->method('getInnerType')
|
||||
->will($this->returnValue(new \stdClass()));
|
||||
->willReturn(new \stdClass());
|
||||
|
||||
$form = $this->createBuilder('name')
|
||||
->setType($type)
|
||||
@ -77,7 +77,7 @@ class FormDataExtractorTest extends TestCase
|
||||
$type = $this->getMockBuilder('Symfony\Component\Form\ResolvedFormTypeInterface')->getMock();
|
||||
$type->expects($this->any())
|
||||
->method('getInnerType')
|
||||
->will($this->returnValue(new \stdClass()));
|
||||
->willReturn(new \stdClass());
|
||||
|
||||
$options = [
|
||||
'b' => 'foo',
|
||||
@ -111,7 +111,7 @@ class FormDataExtractorTest extends TestCase
|
||||
$type = $this->getMockBuilder('Symfony\Component\Form\ResolvedFormTypeInterface')->getMock();
|
||||
$type->expects($this->any())
|
||||
->method('getInnerType')
|
||||
->will($this->returnValue(new \stdClass()));
|
||||
->willReturn(new \stdClass());
|
||||
|
||||
$options = [
|
||||
'b' => 'foo',
|
||||
@ -142,7 +142,7 @@ class FormDataExtractorTest extends TestCase
|
||||
$type = $this->getMockBuilder('Symfony\Component\Form\ResolvedFormTypeInterface')->getMock();
|
||||
$type->expects($this->any())
|
||||
->method('getInnerType')
|
||||
->will($this->returnValue(new \stdClass()));
|
||||
->willReturn(new \stdClass());
|
||||
|
||||
$grandParent = $this->createBuilder('grandParent')
|
||||
->setCompound(true)
|
||||
|
@ -42,7 +42,7 @@ class FormTypeValidatorExtensionTest extends BaseValidatorExtensionTest
|
||||
$this->validator->expects($this->once())
|
||||
->method('validate')
|
||||
->with($this->equalTo($form))
|
||||
->will($this->returnValue(new ConstraintViolationList()));
|
||||
->willReturn(new ConstraintViolationList());
|
||||
|
||||
// specific data is irrelevant
|
||||
$form->submit([]);
|
||||
|
@ -93,7 +93,7 @@ class FormBuilderTest extends TestCase
|
||||
$this->factory->expects($this->once())
|
||||
->method('createNamedBuilder')
|
||||
->with('foo', 'Symfony\Component\Form\Extension\Core\Type\TextType')
|
||||
->will($this->returnValue(new FormBuilder('foo', null, $this->dispatcher, $this->factory)));
|
||||
->willReturn(new FormBuilder('foo', null, $this->dispatcher, $this->factory));
|
||||
|
||||
$this->assertCount(0, $this->builder->all());
|
||||
$this->assertFalse($this->builder->has('foo'));
|
||||
@ -188,7 +188,7 @@ class FormBuilderTest extends TestCase
|
||||
$this->factory->expects($this->once())
|
||||
->method('createNamedBuilder')
|
||||
->with($expectedName, $expectedType, null, $expectedOptions)
|
||||
->will($this->returnValue($this->getFormBuilder()));
|
||||
->willReturn($this->getFormBuilder());
|
||||
|
||||
$this->builder->add($expectedName, $expectedType, $expectedOptions);
|
||||
$builder = $this->builder->get($expectedName);
|
||||
@ -204,7 +204,7 @@ class FormBuilderTest extends TestCase
|
||||
$this->factory->expects($this->once())
|
||||
->method('createBuilderForProperty')
|
||||
->with('stdClass', $expectedName, null, $expectedOptions)
|
||||
->will($this->returnValue($this->getFormBuilder()));
|
||||
->willReturn($this->getFormBuilder());
|
||||
|
||||
$this->builder = new FormBuilder('name', 'stdClass', $this->dispatcher, $this->factory);
|
||||
$this->builder->add($expectedName, null, $expectedOptions);
|
||||
@ -246,7 +246,7 @@ class FormBuilderTest extends TestCase
|
||||
|
||||
$mock->expects($this->any())
|
||||
->method('getName')
|
||||
->will($this->returnValue($name));
|
||||
->willReturn($name);
|
||||
|
||||
return $mock;
|
||||
}
|
||||
|
@ -58,10 +58,10 @@ class FormFactoryTest extends TestCase
|
||||
|
||||
$this->registry->expects($this->any())
|
||||
->method('getTypeGuesser')
|
||||
->will($this->returnValue(new FormTypeGuesserChain([
|
||||
->willReturn(new FormTypeGuesserChain([
|
||||
$this->guesser1,
|
||||
$this->guesser2,
|
||||
])));
|
||||
]));
|
||||
}
|
||||
|
||||
public function testCreateNamedBuilderWithTypeName()
|
||||
@ -73,16 +73,16 @@ class FormFactoryTest extends TestCase
|
||||
$this->registry->expects($this->once())
|
||||
->method('getType')
|
||||
->with('type')
|
||||
->will($this->returnValue($resolvedType));
|
||||
->willReturn($resolvedType);
|
||||
|
||||
$resolvedType->expects($this->once())
|
||||
->method('createBuilder')
|
||||
->with($this->factory, 'name', $options)
|
||||
->will($this->returnValue($this->builder));
|
||||
->willReturn($this->builder);
|
||||
|
||||
$this->builder->expects($this->any())
|
||||
->method('getOptions')
|
||||
->will($this->returnValue($resolvedOptions));
|
||||
->willReturn($resolvedOptions);
|
||||
|
||||
$resolvedType->expects($this->once())
|
||||
->method('buildForm')
|
||||
@ -101,16 +101,16 @@ class FormFactoryTest extends TestCase
|
||||
$this->registry->expects($this->once())
|
||||
->method('getType')
|
||||
->with('type')
|
||||
->will($this->returnValue($resolvedType));
|
||||
->willReturn($resolvedType);
|
||||
|
||||
$resolvedType->expects($this->once())
|
||||
->method('createBuilder')
|
||||
->with($this->factory, 'name', $expectedOptions)
|
||||
->will($this->returnValue($this->builder));
|
||||
->willReturn($this->builder);
|
||||
|
||||
$this->builder->expects($this->any())
|
||||
->method('getOptions')
|
||||
->will($this->returnValue($resolvedOptions));
|
||||
->willReturn($resolvedOptions);
|
||||
|
||||
$resolvedType->expects($this->once())
|
||||
->method('buildForm')
|
||||
@ -128,16 +128,16 @@ class FormFactoryTest extends TestCase
|
||||
$this->registry->expects($this->once())
|
||||
->method('getType')
|
||||
->with('type')
|
||||
->will($this->returnValue($resolvedType));
|
||||
->willReturn($resolvedType);
|
||||
|
||||
$resolvedType->expects($this->once())
|
||||
->method('createBuilder')
|
||||
->with($this->factory, 'name', $options)
|
||||
->will($this->returnValue($this->builder));
|
||||
->willReturn($this->builder);
|
||||
|
||||
$this->builder->expects($this->any())
|
||||
->method('getOptions')
|
||||
->will($this->returnValue($resolvedOptions));
|
||||
->willReturn($resolvedOptions);
|
||||
|
||||
$resolvedType->expects($this->once())
|
||||
->method('buildForm')
|
||||
@ -181,16 +181,16 @@ class FormFactoryTest extends TestCase
|
||||
$this->registry->expects($this->any())
|
||||
->method('getType')
|
||||
->with('TYPE')
|
||||
->will($this->returnValue($resolvedType));
|
||||
->willReturn($resolvedType);
|
||||
|
||||
$resolvedType->expects($this->once())
|
||||
->method('createBuilder')
|
||||
->with($this->factory, 'TYPE_PREFIX', $options)
|
||||
->will($this->returnValue($this->builder));
|
||||
->willReturn($this->builder);
|
||||
|
||||
$this->builder->expects($this->any())
|
||||
->method('getOptions')
|
||||
->will($this->returnValue($resolvedOptions));
|
||||
->willReturn($resolvedOptions);
|
||||
|
||||
$resolvedType->expects($this->once())
|
||||
->method('buildForm')
|
||||
@ -198,7 +198,7 @@ class FormFactoryTest extends TestCase
|
||||
|
||||
$this->builder->expects($this->once())
|
||||
->method('getForm')
|
||||
->will($this->returnValue('FORM'));
|
||||
->willReturn('FORM');
|
||||
|
||||
$this->assertSame('FORM', $this->factory->create('TYPE', null, $options));
|
||||
}
|
||||
@ -212,16 +212,16 @@ class FormFactoryTest extends TestCase
|
||||
$this->registry->expects($this->once())
|
||||
->method('getType')
|
||||
->with('type')
|
||||
->will($this->returnValue($resolvedType));
|
||||
->willReturn($resolvedType);
|
||||
|
||||
$resolvedType->expects($this->once())
|
||||
->method('createBuilder')
|
||||
->with($this->factory, 'name', $options)
|
||||
->will($this->returnValue($this->builder));
|
||||
->willReturn($this->builder);
|
||||
|
||||
$this->builder->expects($this->any())
|
||||
->method('getOptions')
|
||||
->will($this->returnValue($resolvedOptions));
|
||||
->willReturn($resolvedOptions);
|
||||
|
||||
$resolvedType->expects($this->once())
|
||||
->method('buildForm')
|
||||
@ -229,7 +229,7 @@ class FormFactoryTest extends TestCase
|
||||
|
||||
$this->builder->expects($this->once())
|
||||
->method('getForm')
|
||||
->will($this->returnValue('FORM'));
|
||||
->willReturn('FORM');
|
||||
|
||||
$this->assertSame('FORM', $this->factory->createNamed('name', 'type', null, $options));
|
||||
}
|
||||
@ -245,7 +245,7 @@ class FormFactoryTest extends TestCase
|
||||
$factory->expects($this->once())
|
||||
->method('createNamedBuilder')
|
||||
->with('firstName', 'Symfony\Component\Form\Extension\Core\Type\TextType', null, [])
|
||||
->will($this->returnValue('builderInstance'));
|
||||
->willReturn('builderInstance');
|
||||
|
||||
$this->builder = $factory->createBuilderForProperty('Application\Author', 'firstName');
|
||||
|
||||
@ -257,27 +257,27 @@ class FormFactoryTest extends TestCase
|
||||
$this->guesser1->expects($this->once())
|
||||
->method('guessType')
|
||||
->with('Application\Author', 'firstName')
|
||||
->will($this->returnValue(new TypeGuess(
|
||||
->willReturn(new TypeGuess(
|
||||
'Symfony\Component\Form\Extension\Core\Type\TextType',
|
||||
['attr' => ['maxlength' => 10]],
|
||||
Guess::MEDIUM_CONFIDENCE
|
||||
)));
|
||||
));
|
||||
|
||||
$this->guesser2->expects($this->once())
|
||||
->method('guessType')
|
||||
->with('Application\Author', 'firstName')
|
||||
->will($this->returnValue(new TypeGuess(
|
||||
->willReturn(new TypeGuess(
|
||||
'Symfony\Component\Form\Extension\Core\Type\PasswordType',
|
||||
['attr' => ['maxlength' => 7]],
|
||||
Guess::HIGH_CONFIDENCE
|
||||
)));
|
||||
));
|
||||
|
||||
$factory = $this->getMockFactory(['createNamedBuilder']);
|
||||
|
||||
$factory->expects($this->once())
|
||||
->method('createNamedBuilder')
|
||||
->with('firstName', 'Symfony\Component\Form\Extension\Core\Type\PasswordType', null, ['attr' => ['maxlength' => 7]])
|
||||
->will($this->returnValue('builderInstance'));
|
||||
->willReturn('builderInstance');
|
||||
|
||||
$this->builder = $factory->createBuilderForProperty('Application\Author', 'firstName');
|
||||
|
||||
@ -289,14 +289,14 @@ class FormFactoryTest extends TestCase
|
||||
$this->guesser1->expects($this->once())
|
||||
->method('guessType')
|
||||
->with('Application\Author', 'firstName')
|
||||
->will($this->returnValue(null));
|
||||
->willReturn(null);
|
||||
|
||||
$factory = $this->getMockFactory(['createNamedBuilder']);
|
||||
|
||||
$factory->expects($this->once())
|
||||
->method('createNamedBuilder')
|
||||
->with('firstName', 'Symfony\Component\Form\Extension\Core\Type\TextType')
|
||||
->will($this->returnValue('builderInstance'));
|
||||
->willReturn('builderInstance');
|
||||
|
||||
$this->builder = $factory->createBuilderForProperty('Application\Author', 'firstName');
|
||||
|
||||
@ -308,18 +308,18 @@ class FormFactoryTest extends TestCase
|
||||
$this->guesser1->expects($this->once())
|
||||
->method('guessType')
|
||||
->with('Application\Author', 'firstName')
|
||||
->will($this->returnValue(new TypeGuess(
|
||||
->willReturn(new TypeGuess(
|
||||
'Symfony\Component\Form\Extension\Core\Type\TextType',
|
||||
['attr' => ['class' => 'foo', 'maxlength' => 10]],
|
||||
Guess::MEDIUM_CONFIDENCE
|
||||
)));
|
||||
));
|
||||
|
||||
$factory = $this->getMockFactory(['createNamedBuilder']);
|
||||
|
||||
$factory->expects($this->once())
|
||||
->method('createNamedBuilder')
|
||||
->with('firstName', 'Symfony\Component\Form\Extension\Core\Type\TextType', null, ['attr' => ['class' => 'foo', 'maxlength' => 11]])
|
||||
->will($this->returnValue('builderInstance'));
|
||||
->willReturn('builderInstance');
|
||||
|
||||
$this->builder = $factory->createBuilderForProperty(
|
||||
'Application\Author',
|
||||
@ -336,25 +336,25 @@ class FormFactoryTest extends TestCase
|
||||
$this->guesser1->expects($this->once())
|
||||
->method('guessMaxLength')
|
||||
->with('Application\Author', 'firstName')
|
||||
->will($this->returnValue(new ValueGuess(
|
||||
->willReturn(new ValueGuess(
|
||||
15,
|
||||
Guess::MEDIUM_CONFIDENCE
|
||||
)));
|
||||
));
|
||||
|
||||
$this->guesser2->expects($this->once())
|
||||
->method('guessMaxLength')
|
||||
->with('Application\Author', 'firstName')
|
||||
->will($this->returnValue(new ValueGuess(
|
||||
->willReturn(new ValueGuess(
|
||||
20,
|
||||
Guess::HIGH_CONFIDENCE
|
||||
)));
|
||||
));
|
||||
|
||||
$factory = $this->getMockFactory(['createNamedBuilder']);
|
||||
|
||||
$factory->expects($this->once())
|
||||
->method('createNamedBuilder')
|
||||
->with('firstName', 'Symfony\Component\Form\Extension\Core\Type\TextType', null, ['attr' => ['maxlength' => 20]])
|
||||
->will($this->returnValue('builderInstance'));
|
||||
->willReturn('builderInstance');
|
||||
|
||||
$this->builder = $factory->createBuilderForProperty(
|
||||
'Application\Author',
|
||||
@ -369,25 +369,25 @@ class FormFactoryTest extends TestCase
|
||||
$this->guesser1->expects($this->once())
|
||||
->method('guessMaxLength')
|
||||
->with('Application\Author', 'firstName')
|
||||
->will($this->returnValue(new ValueGuess(
|
||||
->willReturn(new ValueGuess(
|
||||
20,
|
||||
Guess::HIGH_CONFIDENCE
|
||||
)));
|
||||
));
|
||||
|
||||
$this->guesser2->expects($this->once())
|
||||
->method('guessPattern')
|
||||
->with('Application\Author', 'firstName')
|
||||
->will($this->returnValue(new ValueGuess(
|
||||
->willReturn(new ValueGuess(
|
||||
'.{5,}',
|
||||
Guess::HIGH_CONFIDENCE
|
||||
)));
|
||||
));
|
||||
|
||||
$factory = $this->getMockFactory(['createNamedBuilder']);
|
||||
|
||||
$factory->expects($this->once())
|
||||
->method('createNamedBuilder')
|
||||
->with('firstName', 'Symfony\Component\Form\Extension\Core\Type\TextType', null, ['attr' => ['maxlength' => 20, 'pattern' => '.{5,}', 'class' => 'tinymce']])
|
||||
->will($this->returnValue('builderInstance'));
|
||||
->willReturn('builderInstance');
|
||||
|
||||
$this->builder = $factory->createBuilderForProperty(
|
||||
'Application\Author',
|
||||
@ -404,25 +404,25 @@ class FormFactoryTest extends TestCase
|
||||
$this->guesser1->expects($this->once())
|
||||
->method('guessRequired')
|
||||
->with('Application\Author', 'firstName')
|
||||
->will($this->returnValue(new ValueGuess(
|
||||
->willReturn(new ValueGuess(
|
||||
true,
|
||||
Guess::MEDIUM_CONFIDENCE
|
||||
)));
|
||||
));
|
||||
|
||||
$this->guesser2->expects($this->once())
|
||||
->method('guessRequired')
|
||||
->with('Application\Author', 'firstName')
|
||||
->will($this->returnValue(new ValueGuess(
|
||||
->willReturn(new ValueGuess(
|
||||
false,
|
||||
Guess::HIGH_CONFIDENCE
|
||||
)));
|
||||
));
|
||||
|
||||
$factory = $this->getMockFactory(['createNamedBuilder']);
|
||||
|
||||
$factory->expects($this->once())
|
||||
->method('createNamedBuilder')
|
||||
->with('firstName', 'Symfony\Component\Form\Extension\Core\Type\TextType', null, ['required' => false])
|
||||
->will($this->returnValue('builderInstance'));
|
||||
->willReturn('builderInstance');
|
||||
|
||||
$this->builder = $factory->createBuilderForProperty(
|
||||
'Application\Author',
|
||||
@ -437,25 +437,25 @@ class FormFactoryTest extends TestCase
|
||||
$this->guesser1->expects($this->once())
|
||||
->method('guessPattern')
|
||||
->with('Application\Author', 'firstName')
|
||||
->will($this->returnValue(new ValueGuess(
|
||||
->willReturn(new ValueGuess(
|
||||
'[a-z]',
|
||||
Guess::MEDIUM_CONFIDENCE
|
||||
)));
|
||||
));
|
||||
|
||||
$this->guesser2->expects($this->once())
|
||||
->method('guessPattern')
|
||||
->with('Application\Author', 'firstName')
|
||||
->will($this->returnValue(new ValueGuess(
|
||||
->willReturn(new ValueGuess(
|
||||
'[a-zA-Z]',
|
||||
Guess::HIGH_CONFIDENCE
|
||||
)));
|
||||
));
|
||||
|
||||
$factory = $this->getMockFactory(['createNamedBuilder']);
|
||||
|
||||
$factory->expects($this->once())
|
||||
->method('createNamedBuilder')
|
||||
->with('firstName', 'Symfony\Component\Form\Extension\Core\Type\TextType', null, ['attr' => ['pattern' => '[a-zA-Z]']])
|
||||
->will($this->returnValue('builderInstance'));
|
||||
->willReturn('builderInstance');
|
||||
|
||||
$this->builder = $factory->createBuilderForProperty(
|
||||
'Application\Author',
|
||||
|
@ -99,21 +99,21 @@ class ResolvedFormTypeTest extends TestCase
|
||||
// First the default options are generated for the super type
|
||||
$this->parentType->expects($this->once())
|
||||
->method('configureOptions')
|
||||
->will($this->returnCallback($assertIndexAndAddOption(0, 'a', 'a_default')));
|
||||
->willReturnCallback($assertIndexAndAddOption(0, 'a', 'a_default'));
|
||||
|
||||
// The form type itself
|
||||
$this->type->expects($this->once())
|
||||
->method('configureOptions')
|
||||
->will($this->returnCallback($assertIndexAndAddOption(1, 'b', 'b_default')));
|
||||
->willReturnCallback($assertIndexAndAddOption(1, 'b', 'b_default'));
|
||||
|
||||
// And its extensions
|
||||
$this->extension1->expects($this->once())
|
||||
->method('configureOptions')
|
||||
->will($this->returnCallback($assertIndexAndAddOption(2, 'c', 'c_default')));
|
||||
->willReturnCallback($assertIndexAndAddOption(2, 'c', 'c_default'));
|
||||
|
||||
$this->extension2->expects($this->once())
|
||||
->method('configureOptions')
|
||||
->will($this->returnCallback($assertIndexAndAddOption(3, 'd', 'd_default')));
|
||||
->willReturnCallback($assertIndexAndAddOption(3, 'd', 'd_default'));
|
||||
|
||||
$givenOptions = ['a' => 'a_custom', 'c' => 'c_custom'];
|
||||
$resolvedOptions = ['a' => 'a_custom', 'b' => 'b_default', 'c' => 'c_custom', 'd' => 'd_default'];
|
||||
@ -136,12 +136,12 @@ class ResolvedFormTypeTest extends TestCase
|
||||
|
||||
$this->resolvedType->expects($this->once())
|
||||
->method('getOptionsResolver')
|
||||
->will($this->returnValue($optionsResolver));
|
||||
->willReturn($optionsResolver);
|
||||
|
||||
$optionsResolver->expects($this->once())
|
||||
->method('resolve')
|
||||
->with($givenOptions)
|
||||
->will($this->returnValue($resolvedOptions));
|
||||
->willReturn($resolvedOptions);
|
||||
|
||||
$factory = $this->getMockFormFactory();
|
||||
$builder = $this->resolvedType->createBuilder($factory, 'name', $givenOptions);
|
||||
@ -164,12 +164,12 @@ class ResolvedFormTypeTest extends TestCase
|
||||
|
||||
$this->resolvedType->expects($this->once())
|
||||
->method('getOptionsResolver')
|
||||
->will($this->returnValue($optionsResolver));
|
||||
->willReturn($optionsResolver);
|
||||
|
||||
$optionsResolver->expects($this->once())
|
||||
->method('resolve')
|
||||
->with($givenOptions)
|
||||
->will($this->returnValue($resolvedOptions));
|
||||
->willReturn($resolvedOptions);
|
||||
|
||||
$factory = $this->getMockFormFactory();
|
||||
$builder = $this->resolvedType->createBuilder($factory, 'name', $givenOptions);
|
||||
@ -198,24 +198,24 @@ class ResolvedFormTypeTest extends TestCase
|
||||
$this->parentType->expects($this->once())
|
||||
->method('buildForm')
|
||||
->with($builder, $options)
|
||||
->will($this->returnCallback($assertIndex(0)));
|
||||
->willReturnCallback($assertIndex(0));
|
||||
|
||||
// Then the type itself
|
||||
$this->type->expects($this->once())
|
||||
->method('buildForm')
|
||||
->with($builder, $options)
|
||||
->will($this->returnCallback($assertIndex(1)));
|
||||
->willReturnCallback($assertIndex(1));
|
||||
|
||||
// Then its extensions
|
||||
$this->extension1->expects($this->once())
|
||||
->method('buildForm')
|
||||
->with($builder, $options)
|
||||
->will($this->returnCallback($assertIndex(2)));
|
||||
->willReturnCallback($assertIndex(2));
|
||||
|
||||
$this->extension2->expects($this->once())
|
||||
->method('buildForm')
|
||||
->with($builder, $options)
|
||||
->will($this->returnCallback($assertIndex(3)));
|
||||
->willReturnCallback($assertIndex(3));
|
||||
|
||||
$this->resolvedType->buildForm($builder, $options);
|
||||
}
|
||||
@ -261,24 +261,24 @@ class ResolvedFormTypeTest extends TestCase
|
||||
$this->parentType->expects($this->once())
|
||||
->method('buildView')
|
||||
->with($view, $form, $options)
|
||||
->will($this->returnCallback($assertIndex(0)));
|
||||
->willReturnCallback($assertIndex(0));
|
||||
|
||||
// Then the type itself
|
||||
$this->type->expects($this->once())
|
||||
->method('buildView')
|
||||
->with($view, $form, $options)
|
||||
->will($this->returnCallback($assertIndex(1)));
|
||||
->willReturnCallback($assertIndex(1));
|
||||
|
||||
// Then its extensions
|
||||
$this->extension1->expects($this->once())
|
||||
->method('buildView')
|
||||
->with($view, $form, $options)
|
||||
->will($this->returnCallback($assertIndex(2)));
|
||||
->willReturnCallback($assertIndex(2));
|
||||
|
||||
$this->extension2->expects($this->once())
|
||||
->method('buildView')
|
||||
->with($view, $form, $options)
|
||||
->will($this->returnCallback($assertIndex(3)));
|
||||
->willReturnCallback($assertIndex(3));
|
||||
|
||||
$this->resolvedType->buildView($view, $form, $options);
|
||||
}
|
||||
@ -303,24 +303,24 @@ class ResolvedFormTypeTest extends TestCase
|
||||
$this->parentType->expects($this->once())
|
||||
->method('finishView')
|
||||
->with($view, $form, $options)
|
||||
->will($this->returnCallback($assertIndex(0)));
|
||||
->willReturnCallback($assertIndex(0));
|
||||
|
||||
// Then the type itself
|
||||
$this->type->expects($this->once())
|
||||
->method('finishView')
|
||||
->with($view, $form, $options)
|
||||
->will($this->returnCallback($assertIndex(1)));
|
||||
->willReturnCallback($assertIndex(1));
|
||||
|
||||
// Then its extensions
|
||||
$this->extension1->expects($this->once())
|
||||
->method('finishView')
|
||||
->with($view, $form, $options)
|
||||
->will($this->returnCallback($assertIndex(2)));
|
||||
->willReturnCallback($assertIndex(2));
|
||||
|
||||
$this->extension2->expects($this->once())
|
||||
->method('finishView')
|
||||
->with($view, $form, $options)
|
||||
->will($this->returnCallback($assertIndex(3)));
|
||||
->willReturnCallback($assertIndex(3));
|
||||
|
||||
$this->resolvedType->finishView($view, $form, $options);
|
||||
}
|
||||
|
@ -722,7 +722,7 @@ class SimpleFormTest extends AbstractFormTest
|
||||
$type->expects($this->once())
|
||||
->method('createView')
|
||||
->with($form)
|
||||
->will($this->returnValue($view));
|
||||
->willReturn($view);
|
||||
|
||||
$this->assertSame($view, $form->createView());
|
||||
}
|
||||
@ -739,12 +739,12 @@ class SimpleFormTest extends AbstractFormTest
|
||||
|
||||
$parentType->expects($this->once())
|
||||
->method('createView')
|
||||
->will($this->returnValue($parentView));
|
||||
->willReturn($parentView);
|
||||
|
||||
$type->expects($this->once())
|
||||
->method('createView')
|
||||
->with($form, $parentView)
|
||||
->will($this->returnValue($view));
|
||||
->willReturn($view);
|
||||
|
||||
$this->assertSame($view, $form->createView());
|
||||
}
|
||||
@ -759,7 +759,7 @@ class SimpleFormTest extends AbstractFormTest
|
||||
$type->expects($this->once())
|
||||
->method('createView')
|
||||
->with($form, $parentView)
|
||||
->will($this->returnValue($view));
|
||||
->willReturn($view);
|
||||
|
||||
$this->assertSame($view, $form->createView($parentView));
|
||||
}
|
||||
|
@ -35,14 +35,14 @@ class HttpExceptionTraitTest extends TestCase
|
||||
$response = $this->createMock(ResponseInterface::class);
|
||||
$response
|
||||
->method('getInfo')
|
||||
->will($this->returnValueMap([
|
||||
->willReturnMap([
|
||||
['http_code', 400],
|
||||
['url', 'http://example.com'],
|
||||
['response_headers', [
|
||||
'HTTP/1.1 400 Bad Request',
|
||||
'Content-Type: '.$mimeType,
|
||||
]],
|
||||
]));
|
||||
]);
|
||||
$response->method('getContent')->willReturn($json);
|
||||
|
||||
$e = new TestException($response);
|
||||
|
@ -62,7 +62,7 @@ class MemcachedSessionHandlerTest extends TestCase
|
||||
$this->memcached
|
||||
->expects($this->once())
|
||||
->method('quit')
|
||||
->will($this->returnValue(true))
|
||||
->willReturn(true)
|
||||
;
|
||||
|
||||
$this->assertTrue($this->storage->close());
|
||||
@ -85,7 +85,7 @@ class MemcachedSessionHandlerTest extends TestCase
|
||||
->expects($this->once())
|
||||
->method('set')
|
||||
->with(self::PREFIX.'id', 'data', $this->equalTo(time() + self::TTL, 2))
|
||||
->will($this->returnValue(true))
|
||||
->willReturn(true)
|
||||
;
|
||||
|
||||
$this->assertTrue($this->storage->write('id', 'data'));
|
||||
@ -97,7 +97,7 @@ class MemcachedSessionHandlerTest extends TestCase
|
||||
->expects($this->once())
|
||||
->method('delete')
|
||||
->with(self::PREFIX.'id')
|
||||
->will($this->returnValue(true))
|
||||
->willReturn(true)
|
||||
;
|
||||
|
||||
$this->assertTrue($this->storage->destroy('id'));
|
||||
|
@ -38,11 +38,11 @@ class MigratingSessionHandlerTest extends TestCase
|
||||
{
|
||||
$this->currentHandler->expects($this->once())
|
||||
->method('close')
|
||||
->will($this->returnValue(true));
|
||||
->willReturn(true);
|
||||
|
||||
$this->writeOnlyHandler->expects($this->once())
|
||||
->method('close')
|
||||
->will($this->returnValue(false));
|
||||
->willReturn(false);
|
||||
|
||||
$result = $this->dualHandler->close();
|
||||
|
||||
@ -56,12 +56,12 @@ class MigratingSessionHandlerTest extends TestCase
|
||||
$this->currentHandler->expects($this->once())
|
||||
->method('destroy')
|
||||
->with($sessionId)
|
||||
->will($this->returnValue(true));
|
||||
->willReturn(true);
|
||||
|
||||
$this->writeOnlyHandler->expects($this->once())
|
||||
->method('destroy')
|
||||
->with($sessionId)
|
||||
->will($this->returnValue(false));
|
||||
->willReturn(false);
|
||||
|
||||
$result = $this->dualHandler->destroy($sessionId);
|
||||
|
||||
@ -75,12 +75,12 @@ class MigratingSessionHandlerTest extends TestCase
|
||||
$this->currentHandler->expects($this->once())
|
||||
->method('gc')
|
||||
->with($maxlifetime)
|
||||
->will($this->returnValue(true));
|
||||
->willReturn(true);
|
||||
|
||||
$this->writeOnlyHandler->expects($this->once())
|
||||
->method('gc')
|
||||
->with($maxlifetime)
|
||||
->will($this->returnValue(false));
|
||||
->willReturn(false);
|
||||
|
||||
$result = $this->dualHandler->gc($maxlifetime);
|
||||
$this->assertTrue($result);
|
||||
@ -94,12 +94,12 @@ class MigratingSessionHandlerTest extends TestCase
|
||||
$this->currentHandler->expects($this->once())
|
||||
->method('open')
|
||||
->with($savePath, $sessionName)
|
||||
->will($this->returnValue(true));
|
||||
->willReturn(true);
|
||||
|
||||
$this->writeOnlyHandler->expects($this->once())
|
||||
->method('open')
|
||||
->with($savePath, $sessionName)
|
||||
->will($this->returnValue(false));
|
||||
->willReturn(false);
|
||||
|
||||
$result = $this->dualHandler->open($savePath, $sessionName);
|
||||
|
||||
@ -114,7 +114,7 @@ class MigratingSessionHandlerTest extends TestCase
|
||||
$this->currentHandler->expects($this->once())
|
||||
->method('read')
|
||||
->with($sessionId)
|
||||
->will($this->returnValue($readValue));
|
||||
->willReturn($readValue);
|
||||
|
||||
$this->writeOnlyHandler->expects($this->never())
|
||||
->method('read')
|
||||
@ -133,12 +133,12 @@ class MigratingSessionHandlerTest extends TestCase
|
||||
$this->currentHandler->expects($this->once())
|
||||
->method('write')
|
||||
->with($sessionId, $data)
|
||||
->will($this->returnValue(true));
|
||||
->willReturn(true);
|
||||
|
||||
$this->writeOnlyHandler->expects($this->once())
|
||||
->method('write')
|
||||
->with($sessionId, $data)
|
||||
->will($this->returnValue(false));
|
||||
->willReturn(false);
|
||||
|
||||
$result = $this->dualHandler->write($sessionId, $data);
|
||||
|
||||
@ -153,7 +153,7 @@ class MigratingSessionHandlerTest extends TestCase
|
||||
$this->currentHandler->expects($this->once())
|
||||
->method('read')
|
||||
->with($sessionId)
|
||||
->will($this->returnValue($readValue));
|
||||
->willReturn($readValue);
|
||||
|
||||
$this->writeOnlyHandler->expects($this->never())
|
||||
->method('read')
|
||||
@ -172,12 +172,12 @@ class MigratingSessionHandlerTest extends TestCase
|
||||
$this->currentHandler->expects($this->once())
|
||||
->method('write')
|
||||
->with($sessionId, $data)
|
||||
->will($this->returnValue(true));
|
||||
->willReturn(true);
|
||||
|
||||
$this->writeOnlyHandler->expects($this->once())
|
||||
->method('write')
|
||||
->with($sessionId, $data)
|
||||
->will($this->returnValue(false));
|
||||
->willReturn(false);
|
||||
|
||||
$result = $this->dualHandler->updateTimestamp($sessionId, $data);
|
||||
|
||||
|
@ -77,7 +77,7 @@ class MongoDbSessionHandlerTest extends TestCase
|
||||
$this->mongo->expects($this->once())
|
||||
->method('selectCollection')
|
||||
->with($this->options['database'], $this->options['collection'])
|
||||
->will($this->returnValue($collection));
|
||||
->willReturn($collection);
|
||||
|
||||
// defining the timeout before the actual method call
|
||||
// allows to test for "greater than" values in the $criteria
|
||||
@ -85,7 +85,7 @@ class MongoDbSessionHandlerTest extends TestCase
|
||||
|
||||
$collection->expects($this->once())
|
||||
->method('findOne')
|
||||
->will($this->returnCallback(function ($criteria) use ($testTimeout) {
|
||||
->willReturnCallback(function ($criteria) use ($testTimeout) {
|
||||
$this->assertArrayHasKey($this->options['id_field'], $criteria);
|
||||
$this->assertEquals($criteria[$this->options['id_field']], 'foo');
|
||||
|
||||
@ -100,7 +100,7 @@ class MongoDbSessionHandlerTest extends TestCase
|
||||
$this->options['expiry_field'] => new \MongoDB\BSON\UTCDateTime(),
|
||||
$this->options['data_field'] => new \MongoDB\BSON\Binary('bar', \MongoDB\BSON\Binary::TYPE_OLD_BINARY),
|
||||
];
|
||||
}));
|
||||
});
|
||||
|
||||
$this->assertEquals('bar', $this->storage->read('foo'));
|
||||
}
|
||||
@ -112,11 +112,11 @@ class MongoDbSessionHandlerTest extends TestCase
|
||||
$this->mongo->expects($this->once())
|
||||
->method('selectCollection')
|
||||
->with($this->options['database'], $this->options['collection'])
|
||||
->will($this->returnValue($collection));
|
||||
->willReturn($collection);
|
||||
|
||||
$collection->expects($this->once())
|
||||
->method('updateOne')
|
||||
->will($this->returnCallback(function ($criteria, $updateData, $options) {
|
||||
->willReturnCallback(function ($criteria, $updateData, $options) {
|
||||
$this->assertEquals([$this->options['id_field'] => 'foo'], $criteria);
|
||||
$this->assertEquals(['upsert' => true], $options);
|
||||
|
||||
@ -127,7 +127,7 @@ class MongoDbSessionHandlerTest extends TestCase
|
||||
$this->assertInstanceOf(\MongoDB\BSON\UTCDateTime::class, $data[$this->options['time_field']]);
|
||||
$this->assertInstanceOf(\MongoDB\BSON\UTCDateTime::class, $data[$this->options['expiry_field']]);
|
||||
$this->assertGreaterThanOrEqual($expectedExpiry, round((string) $data[$this->options['expiry_field']] / 1000));
|
||||
}));
|
||||
});
|
||||
|
||||
$this->assertTrue($this->storage->write('foo', 'bar'));
|
||||
}
|
||||
@ -139,15 +139,15 @@ class MongoDbSessionHandlerTest extends TestCase
|
||||
$this->mongo->expects($this->once())
|
||||
->method('selectCollection')
|
||||
->with($this->options['database'], $this->options['collection'])
|
||||
->will($this->returnValue($collection));
|
||||
->willReturn($collection);
|
||||
|
||||
$data = [];
|
||||
|
||||
$collection->expects($this->exactly(2))
|
||||
->method('updateOne')
|
||||
->will($this->returnCallback(function ($criteria, $updateData, $options) use (&$data) {
|
||||
->willReturnCallback(function ($criteria, $updateData, $options) use (&$data) {
|
||||
$data = $updateData;
|
||||
}));
|
||||
});
|
||||
|
||||
$this->storage->write('foo', 'bar');
|
||||
$this->storage->write('foo', 'foobar');
|
||||
@ -162,7 +162,7 @@ class MongoDbSessionHandlerTest extends TestCase
|
||||
$this->mongo->expects($this->once())
|
||||
->method('selectCollection')
|
||||
->with($this->options['database'], $this->options['collection'])
|
||||
->will($this->returnValue($collection));
|
||||
->willReturn($collection);
|
||||
|
||||
$collection->expects($this->once())
|
||||
->method('deleteOne')
|
||||
@ -178,14 +178,14 @@ class MongoDbSessionHandlerTest extends TestCase
|
||||
$this->mongo->expects($this->once())
|
||||
->method('selectCollection')
|
||||
->with($this->options['database'], $this->options['collection'])
|
||||
->will($this->returnValue($collection));
|
||||
->willReturn($collection);
|
||||
|
||||
$collection->expects($this->once())
|
||||
->method('deleteMany')
|
||||
->will($this->returnCallback(function ($criteria) {
|
||||
->willReturnCallback(function ($criteria) {
|
||||
$this->assertInstanceOf(\MongoDB\BSON\UTCDateTime::class, $criteria[$this->options['expiry_field']]['$lt']);
|
||||
$this->assertGreaterThanOrEqual(time() - 1, round((string) $criteria[$this->options['expiry_field']]['$lt'] / 1000));
|
||||
}));
|
||||
});
|
||||
|
||||
$this->assertTrue($this->storage->gc(1));
|
||||
}
|
||||
|
@ -143,7 +143,7 @@ class PdoSessionHandlerTest extends TestCase
|
||||
$stream = $this->createStream($content);
|
||||
|
||||
$pdo->prepareResult->expects($this->once())->method('fetchAll')
|
||||
->will($this->returnValue([[$stream, 42, time()]]));
|
||||
->willReturn([[$stream, 42, time()]]);
|
||||
|
||||
$storage = new PdoSessionHandler($pdo);
|
||||
$result = $storage->read('foo');
|
||||
@ -170,14 +170,14 @@ class PdoSessionHandlerTest extends TestCase
|
||||
$exception = null;
|
||||
|
||||
$selectStmt->expects($this->atLeast(2))->method('fetchAll')
|
||||
->will($this->returnCallback(function () use (&$exception, $stream) {
|
||||
->willReturnCallback(function () use (&$exception, $stream) {
|
||||
return $exception ? [[$stream, 42, time()]] : [];
|
||||
}));
|
||||
});
|
||||
|
||||
$insertStmt->expects($this->once())->method('execute')
|
||||
->will($this->returnCallback(function () use (&$exception) {
|
||||
->willReturnCallback(function () use (&$exception) {
|
||||
throw $exception = new \PDOException('', '23');
|
||||
}));
|
||||
});
|
||||
|
||||
$storage = new PdoSessionHandler($pdo);
|
||||
$result = $storage->read('foo');
|
||||
|
@ -50,7 +50,7 @@ class SessionHandlerProxyTest extends TestCase
|
||||
{
|
||||
$this->mock->expects($this->once())
|
||||
->method('open')
|
||||
->will($this->returnValue(true));
|
||||
->willReturn(true);
|
||||
|
||||
$this->assertFalse($this->proxy->isActive());
|
||||
$this->proxy->open('name', 'id');
|
||||
@ -61,7 +61,7 @@ class SessionHandlerProxyTest extends TestCase
|
||||
{
|
||||
$this->mock->expects($this->once())
|
||||
->method('open')
|
||||
->will($this->returnValue(false));
|
||||
->willReturn(false);
|
||||
|
||||
$this->assertFalse($this->proxy->isActive());
|
||||
$this->proxy->open('name', 'id');
|
||||
@ -72,7 +72,7 @@ class SessionHandlerProxyTest extends TestCase
|
||||
{
|
||||
$this->mock->expects($this->once())
|
||||
->method('close')
|
||||
->will($this->returnValue(true));
|
||||
->willReturn(true);
|
||||
|
||||
$this->assertFalse($this->proxy->isActive());
|
||||
$this->proxy->close();
|
||||
@ -83,7 +83,7 @@ class SessionHandlerProxyTest extends TestCase
|
||||
{
|
||||
$this->mock->expects($this->once())
|
||||
->method('close')
|
||||
->will($this->returnValue(false));
|
||||
->willReturn(false);
|
||||
|
||||
$this->assertFalse($this->proxy->isActive());
|
||||
$this->proxy->close();
|
||||
|
@ -59,7 +59,7 @@ class CacheWarmerAggregateTest extends TestCase
|
||||
$warmer
|
||||
->expects($this->once())
|
||||
->method('isOptional')
|
||||
->will($this->returnValue(true));
|
||||
->willReturn(true);
|
||||
$warmer
|
||||
->expects($this->never())
|
||||
->method('warmUp');
|
||||
|
@ -23,7 +23,7 @@ class FileLocatorTest extends TestCase
|
||||
->expects($this->atLeastOnce())
|
||||
->method('locateResource')
|
||||
->with('@BundleName/some/path', null, true)
|
||||
->will($this->returnValue('/bundle-name/some/path'));
|
||||
->willReturn('/bundle-name/some/path');
|
||||
$locator = new FileLocator($kernel);
|
||||
$this->assertEquals('/bundle-name/some/path', $locator->locate('@BundleName/some/path'));
|
||||
|
||||
|
@ -27,11 +27,11 @@ class ContainerControllerResolverTest extends ControllerResolverTest
|
||||
$container->expects($this->once())
|
||||
->method('has')
|
||||
->with('foo')
|
||||
->will($this->returnValue(true));
|
||||
->willReturn(true);
|
||||
$container->expects($this->once())
|
||||
->method('get')
|
||||
->with('foo')
|
||||
->will($this->returnValue($service))
|
||||
->willReturn($service)
|
||||
;
|
||||
|
||||
$resolver = $this->createControllerResolver(null, $container);
|
||||
@ -52,11 +52,11 @@ class ContainerControllerResolverTest extends ControllerResolverTest
|
||||
$container->expects($this->once())
|
||||
->method('has')
|
||||
->with('foo')
|
||||
->will($this->returnValue(true));
|
||||
->willReturn(true);
|
||||
$container->expects($this->once())
|
||||
->method('get')
|
||||
->with('foo')
|
||||
->will($this->returnValue($service))
|
||||
->willReturn($service)
|
||||
;
|
||||
|
||||
$resolver = $this->createControllerResolver(null, $container);
|
||||
@ -77,12 +77,12 @@ class ContainerControllerResolverTest extends ControllerResolverTest
|
||||
$container->expects($this->once())
|
||||
->method('has')
|
||||
->with('foo')
|
||||
->will($this->returnValue(true))
|
||||
->willReturn(true)
|
||||
;
|
||||
$container->expects($this->once())
|
||||
->method('get')
|
||||
->with('foo')
|
||||
->will($this->returnValue($service))
|
||||
->willReturn($service)
|
||||
;
|
||||
|
||||
$resolver = $this->createControllerResolver(null, $container);
|
||||
@ -102,12 +102,12 @@ class ContainerControllerResolverTest extends ControllerResolverTest
|
||||
$container->expects($this->once())
|
||||
->method('has')
|
||||
->with(InvokableControllerService::class)
|
||||
->will($this->returnValue(true))
|
||||
->willReturn(true)
|
||||
;
|
||||
$container->expects($this->once())
|
||||
->method('get')
|
||||
->with(InvokableControllerService::class)
|
||||
->will($this->returnValue($service))
|
||||
->willReturn($service)
|
||||
;
|
||||
|
||||
$resolver = $this->createControllerResolver(null, $container);
|
||||
@ -131,13 +131,13 @@ class ContainerControllerResolverTest extends ControllerResolverTest
|
||||
$container->expects($this->once())
|
||||
->method('has')
|
||||
->with(ControllerTestService::class)
|
||||
->will($this->returnValue(false))
|
||||
->willReturn(false)
|
||||
;
|
||||
|
||||
$container->expects($this->atLeastOnce())
|
||||
->method('getRemovedIds')
|
||||
->with()
|
||||
->will($this->returnValue([ControllerTestService::class => true]))
|
||||
->willReturn([ControllerTestService::class => true])
|
||||
;
|
||||
|
||||
$resolver = $this->createControllerResolver(null, $container);
|
||||
@ -159,13 +159,13 @@ class ContainerControllerResolverTest extends ControllerResolverTest
|
||||
$container->expects($this->once())
|
||||
->method('has')
|
||||
->with('app.my_controller')
|
||||
->will($this->returnValue(false))
|
||||
->willReturn(false)
|
||||
;
|
||||
|
||||
$container->expects($this->atLeastOnce())
|
||||
->method('getRemovedIds')
|
||||
->with()
|
||||
->will($this->returnValue(['app.my_controller' => true]))
|
||||
->willReturn(['app.my_controller' => true])
|
||||
;
|
||||
|
||||
$resolver = $this->createControllerResolver(null, $container);
|
||||
|
@ -27,8 +27,8 @@ class LoggerDataCollectorTest extends TestCase
|
||||
->getMockBuilder('Symfony\Component\HttpKernel\Log\DebugLoggerInterface')
|
||||
->setMethods(['countErrors', 'getLogs', 'clear'])
|
||||
->getMock();
|
||||
$logger->expects($this->once())->method('countErrors')->will($this->returnValue('foo'));
|
||||
$logger->expects($this->exactly(2))->method('getLogs')->will($this->returnValue([]));
|
||||
$logger->expects($this->once())->method('countErrors')->willReturn('foo');
|
||||
$logger->expects($this->exactly(2))->method('getLogs')->willReturn([]);
|
||||
|
||||
$c = new LoggerDataCollector($logger, __DIR__.'/');
|
||||
$c->lateCollect();
|
||||
@ -56,7 +56,7 @@ class LoggerDataCollectorTest extends TestCase
|
||||
->setMethods(['countErrors', 'getLogs', 'clear'])
|
||||
->getMock();
|
||||
$logger->expects($this->once())->method('countErrors')->with(null);
|
||||
$logger->expects($this->exactly(2))->method('getLogs')->with(null)->will($this->returnValue([]));
|
||||
$logger->expects($this->exactly(2))->method('getLogs')->with(null)->willReturn([]);
|
||||
|
||||
$c = new LoggerDataCollector($logger, __DIR__.'/', $stack);
|
||||
|
||||
@ -77,7 +77,7 @@ class LoggerDataCollectorTest extends TestCase
|
||||
->setMethods(['countErrors', 'getLogs', 'clear'])
|
||||
->getMock();
|
||||
$logger->expects($this->once())->method('countErrors')->with($subRequest);
|
||||
$logger->expects($this->exactly(2))->method('getLogs')->with($subRequest)->will($this->returnValue([]));
|
||||
$logger->expects($this->exactly(2))->method('getLogs')->with($subRequest)->willReturn([]);
|
||||
|
||||
$c = new LoggerDataCollector($logger, __DIR__.'/', $stack);
|
||||
|
||||
@ -94,8 +94,8 @@ class LoggerDataCollectorTest extends TestCase
|
||||
->getMockBuilder('Symfony\Component\HttpKernel\Log\DebugLoggerInterface')
|
||||
->setMethods(['countErrors', 'getLogs', 'clear'])
|
||||
->getMock();
|
||||
$logger->expects($this->once())->method('countErrors')->will($this->returnValue($nb));
|
||||
$logger->expects($this->exactly(2))->method('getLogs')->will($this->returnValue($logs));
|
||||
$logger->expects($this->once())->method('countErrors')->willReturn($nb);
|
||||
$logger->expects($this->exactly(2))->method('getLogs')->willReturn($logs);
|
||||
|
||||
$c = new LoggerDataCollector($logger);
|
||||
$c->lateCollect();
|
||||
|
@ -44,7 +44,7 @@ class TimeDataCollectorTest extends TestCase
|
||||
$this->assertEquals(0, $c->getStartTime());
|
||||
|
||||
$kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\KernelInterface')->getMock();
|
||||
$kernel->expects($this->once())->method('getStartTime')->will($this->returnValue(123456));
|
||||
$kernel->expects($this->once())->method('getStartTime')->willReturn(123456);
|
||||
|
||||
$c = new TimeDataCollector($kernel);
|
||||
$request = new Request();
|
||||
|
@ -50,7 +50,7 @@ class TraceableEventDispatcherTest extends TestCase
|
||||
->getMock();
|
||||
$stopwatch->expects($this->once())
|
||||
->method('isStarted')
|
||||
->will($this->returnValue(false));
|
||||
->willReturn(false);
|
||||
|
||||
$dispatcher = new TraceableEventDispatcher(new EventDispatcher(), $stopwatch);
|
||||
|
||||
@ -66,7 +66,7 @@ class TraceableEventDispatcherTest extends TestCase
|
||||
->getMock();
|
||||
$stopwatch->expects($this->once())
|
||||
->method('isStarted')
|
||||
->will($this->returnValue(true));
|
||||
->willReturn(true);
|
||||
$stopwatch->expects($this->once())
|
||||
->method('stop');
|
||||
$stopwatch->expects($this->once())
|
||||
@ -113,9 +113,9 @@ class TraceableEventDispatcherTest extends TestCase
|
||||
protected function getHttpKernel($dispatcher, $controller)
|
||||
{
|
||||
$controllerResolver = $this->getMockBuilder('Symfony\Component\HttpKernel\Controller\ControllerResolverInterface')->getMock();
|
||||
$controllerResolver->expects($this->once())->method('getController')->will($this->returnValue($controller));
|
||||
$controllerResolver->expects($this->once())->method('getController')->willReturn($controller);
|
||||
$argumentResolver = $this->getMockBuilder('Symfony\Component\HttpKernel\Controller\ArgumentResolverInterface')->getMock();
|
||||
$argumentResolver->expects($this->once())->method('getArguments')->will($this->returnValue([]));
|
||||
$argumentResolver->expects($this->once())->method('getArguments')->willReturn([]);
|
||||
|
||||
return new HttpKernel($dispatcher, $controllerResolver, new RequestStack(), $argumentResolver);
|
||||
}
|
||||
|
@ -21,15 +21,15 @@ class LazyLoadingFragmentHandlerTest extends TestCase
|
||||
public function testRender()
|
||||
{
|
||||
$renderer = $this->getMockBuilder('Symfony\Component\HttpKernel\Fragment\FragmentRendererInterface')->getMock();
|
||||
$renderer->expects($this->once())->method('getName')->will($this->returnValue('foo'));
|
||||
$renderer->expects($this->any())->method('render')->will($this->returnValue(new Response()));
|
||||
$renderer->expects($this->once())->method('getName')->willReturn('foo');
|
||||
$renderer->expects($this->any())->method('render')->willReturn(new Response());
|
||||
|
||||
$requestStack = $this->getMockBuilder('Symfony\Component\HttpFoundation\RequestStack')->getMock();
|
||||
$requestStack->expects($this->any())->method('getCurrentRequest')->will($this->returnValue(Request::create('/')));
|
||||
$requestStack->expects($this->any())->method('getCurrentRequest')->willReturn(Request::create('/'));
|
||||
|
||||
$container = $this->getMockBuilder('Psr\Container\ContainerInterface')->getMock();
|
||||
$container->expects($this->once())->method('has')->with('foo')->willReturn(true);
|
||||
$container->expects($this->once())->method('get')->will($this->returnValue($renderer));
|
||||
$container->expects($this->once())->method('get')->willReturn($renderer);
|
||||
|
||||
$handler = new LazyLoadingFragmentHandler($container, $requestStack, false);
|
||||
|
||||
|
@ -78,7 +78,7 @@ class AddRequestFormatsListenerTest extends TestCase
|
||||
|
||||
$event->expects($this->any())
|
||||
->method('getRequest')
|
||||
->will($this->returnValue($request));
|
||||
->willReturn($request);
|
||||
|
||||
return $event;
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ class DebugHandlersListenerTest extends TestCase
|
||||
$dispatcher = new EventDispatcher();
|
||||
$listener = new DebugHandlersListener(null);
|
||||
$app = $this->getMockBuilder('Symfony\Component\Console\Application')->getMock();
|
||||
$app->expects($this->once())->method('getHelperSet')->will($this->returnValue(new HelperSet()));
|
||||
$app->expects($this->once())->method('getHelperSet')->willReturn(new HelperSet());
|
||||
$command = new Command(__FUNCTION__);
|
||||
$command->setApplication($app);
|
||||
$event = new ConsoleEvent($command, new ArgvInput(), new ConsoleOutput());
|
||||
|
@ -116,9 +116,9 @@ class ExceptionListenerTest extends TestCase
|
||||
$listener = new ExceptionListener('foo', $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock());
|
||||
|
||||
$kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock();
|
||||
$kernel->expects($this->once())->method('handle')->will($this->returnCallback(function (Request $request) {
|
||||
$kernel->expects($this->once())->method('handle')->willReturnCallback(function (Request $request) {
|
||||
return new Response($request->getRequestFormat());
|
||||
}));
|
||||
});
|
||||
|
||||
$request = Request::create('/');
|
||||
$request->setRequestFormat('xml');
|
||||
@ -134,9 +134,9 @@ class ExceptionListenerTest extends TestCase
|
||||
{
|
||||
$dispatcher = new EventDispatcher();
|
||||
$kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock();
|
||||
$kernel->expects($this->once())->method('handle')->will($this->returnCallback(function (Request $request) {
|
||||
$kernel->expects($this->once())->method('handle')->willReturnCallback(function (Request $request) {
|
||||
return new Response($request->getRequestFormat());
|
||||
}));
|
||||
});
|
||||
|
||||
$listener = new ExceptionListener('foo', $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock(), true);
|
||||
|
||||
@ -160,11 +160,11 @@ class ExceptionListenerTest extends TestCase
|
||||
{
|
||||
$listener = new ExceptionListener(null);
|
||||
$kernel = $this->getMockBuilder(HttpKernelInterface::class)->getMock();
|
||||
$kernel->expects($this->once())->method('handle')->will($this->returnCallback(function (Request $request) {
|
||||
$kernel->expects($this->once())->method('handle')->willReturnCallback(function (Request $request) {
|
||||
$controller = $request->attributes->get('_controller');
|
||||
|
||||
return $controller();
|
||||
}));
|
||||
});
|
||||
$request = Request::create('/');
|
||||
$event = new ExceptionEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST, new \Exception('foo'));
|
||||
|
||||
|
@ -73,7 +73,7 @@ class LocaleListenerTest extends TestCase
|
||||
$context->expects($this->once())->method('setParameter')->with('_locale', 'es');
|
||||
|
||||
$router = $this->getMockBuilder('Symfony\Component\Routing\Router')->setMethods(['getContext'])->disableOriginalConstructor()->getMock();
|
||||
$router->expects($this->once())->method('getContext')->will($this->returnValue($context));
|
||||
$router->expects($this->once())->method('getContext')->willReturn($context);
|
||||
|
||||
$request = Request::create('/');
|
||||
|
||||
@ -89,12 +89,12 @@ class LocaleListenerTest extends TestCase
|
||||
$context->expects($this->once())->method('setParameter')->with('_locale', 'es');
|
||||
|
||||
$router = $this->getMockBuilder('Symfony\Component\Routing\Router')->setMethods(['getContext'])->disableOriginalConstructor()->getMock();
|
||||
$router->expects($this->once())->method('getContext')->will($this->returnValue($context));
|
||||
$router->expects($this->once())->method('getContext')->willReturn($context);
|
||||
|
||||
$parentRequest = Request::create('/');
|
||||
$parentRequest->setLocale('es');
|
||||
|
||||
$this->requestStack->expects($this->once())->method('getParentRequest')->will($this->returnValue($parentRequest));
|
||||
$this->requestStack->expects($this->once())->method('getParentRequest')->willReturn($parentRequest);
|
||||
|
||||
$event = $this->getMockBuilder('Symfony\Component\HttpKernel\Event\FinishRequestEvent')->disableOriginalConstructor()->getMock();
|
||||
|
||||
|
@ -36,7 +36,7 @@ class ProfilerListenerTest extends TestCase
|
||||
|
||||
$profiler->expects($this->once())
|
||||
->method('collect')
|
||||
->will($this->returnValue($profile));
|
||||
->willReturn($profile);
|
||||
|
||||
$kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock();
|
||||
|
||||
|
@ -49,7 +49,7 @@ class RouterListenerTest extends TestCase
|
||||
$context->setHttpsPort($defaultHttpsPort);
|
||||
$urlMatcher->expects($this->any())
|
||||
->method('getContext')
|
||||
->will($this->returnValue($context));
|
||||
->willReturn($context);
|
||||
|
||||
$listener = new RouterListener($urlMatcher, $this->requestStack);
|
||||
$event = $this->createRequestEventForUri($uri);
|
||||
@ -97,7 +97,7 @@ class RouterListenerTest extends TestCase
|
||||
$requestMatcher->expects($this->once())
|
||||
->method('matchRequest')
|
||||
->with($this->isInstanceOf('Symfony\Component\HttpFoundation\Request'))
|
||||
->will($this->returnValue([]));
|
||||
->willReturn([]);
|
||||
|
||||
$listener = new RouterListener($requestMatcher, $this->requestStack, new RequestContext());
|
||||
$listener->onKernelRequest($event);
|
||||
@ -113,7 +113,7 @@ class RouterListenerTest extends TestCase
|
||||
$requestMatcher->expects($this->any())
|
||||
->method('matchRequest')
|
||||
->with($this->isInstanceOf('Symfony\Component\HttpFoundation\Request'))
|
||||
->will($this->returnValue([]));
|
||||
->willReturn([]);
|
||||
|
||||
$context = new RequestContext();
|
||||
|
||||
@ -138,7 +138,7 @@ class RouterListenerTest extends TestCase
|
||||
$requestMatcher = $this->getMockBuilder('Symfony\Component\Routing\Matcher\RequestMatcherInterface')->getMock();
|
||||
$requestMatcher->expects($this->once())
|
||||
->method('matchRequest')
|
||||
->will($this->returnValue($parameter));
|
||||
->willReturn($parameter);
|
||||
|
||||
$logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock();
|
||||
$logger->expects($this->once())
|
||||
|
@ -46,7 +46,7 @@ class TestSessionListenerTest extends TestCase
|
||||
$this->session = $this->getSession();
|
||||
$this->listener->expects($this->any())
|
||||
->method('getSession')
|
||||
->will($this->returnValue($this->session));
|
||||
->willReturn($this->session);
|
||||
}
|
||||
|
||||
public function testShouldSaveMasterRequestSession()
|
||||
@ -183,28 +183,28 @@ class TestSessionListenerTest extends TestCase
|
||||
{
|
||||
$this->session->expects($this->once())
|
||||
->method('isStarted')
|
||||
->will($this->returnValue(true));
|
||||
->willReturn(true);
|
||||
}
|
||||
|
||||
private function sessionHasNotBeenStarted()
|
||||
{
|
||||
$this->session->expects($this->once())
|
||||
->method('isStarted')
|
||||
->will($this->returnValue(false));
|
||||
->willReturn(false);
|
||||
}
|
||||
|
||||
private function sessionIsEmpty()
|
||||
{
|
||||
$this->session->expects($this->once())
|
||||
->method('isEmpty')
|
||||
->will($this->returnValue(true));
|
||||
->willReturn(true);
|
||||
}
|
||||
|
||||
private function fixSessionId($sessionId)
|
||||
{
|
||||
$this->session->expects($this->any())
|
||||
->method('getId')
|
||||
->will($this->returnValue($sessionId));
|
||||
->willReturn($sessionId);
|
||||
}
|
||||
|
||||
private function getSession()
|
||||
@ -214,7 +214,7 @@ class TestSessionListenerTest extends TestCase
|
||||
->getMock();
|
||||
|
||||
// set return value for getName()
|
||||
$mock->expects($this->any())->method('getName')->will($this->returnValue('MOCKSESSID'));
|
||||
$mock->expects($this->any())->method('getName')->willReturn('MOCKSESSID');
|
||||
|
||||
return $mock;
|
||||
}
|
||||
|
@ -117,6 +117,6 @@ class TranslatorListenerTest extends TestCase
|
||||
$this->requestStack
|
||||
->expects($this->any())
|
||||
->method('getParentRequest')
|
||||
->will($this->returnValue($request));
|
||||
->willReturn($request);
|
||||
}
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ class FragmentHandlerTest extends TestCase
|
||||
$this->requestStack
|
||||
->expects($this->any())
|
||||
->method('getCurrentRequest')
|
||||
->will($this->returnValue(Request::create('/')))
|
||||
->willReturn(Request::create('/'))
|
||||
;
|
||||
}
|
||||
|
||||
@ -79,7 +79,7 @@ class FragmentHandlerTest extends TestCase
|
||||
$renderer
|
||||
->expects($this->any())
|
||||
->method('getName')
|
||||
->will($this->returnValue('foo'))
|
||||
->willReturn('foo')
|
||||
;
|
||||
$e = $renderer
|
||||
->expects($this->any())
|
||||
|
@ -124,18 +124,18 @@ class InlineFragmentRendererTest extends TestCase
|
||||
$controllerResolver
|
||||
->expects($this->once())
|
||||
->method('getController')
|
||||
->will($this->returnValue(function () {
|
||||
->willReturn(function () {
|
||||
ob_start();
|
||||
echo 'bar';
|
||||
throw new \RuntimeException();
|
||||
}))
|
||||
})
|
||||
;
|
||||
|
||||
$argumentResolver = $this->getMockBuilder('Symfony\\Component\\HttpKernel\\Controller\\ArgumentResolverInterface')->getMock();
|
||||
$argumentResolver
|
||||
->expects($this->once())
|
||||
->method('getArguments')
|
||||
->will($this->returnValue([]))
|
||||
->willReturn([])
|
||||
;
|
||||
|
||||
$kernel = new HttpKernel(new EventDispatcher(), $controllerResolver, new RequestStack(), $argumentResolver);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user