minor #12772 PSR-2 Fixes (GrahamCampbell)
This PR was merged into the 2.3 branch.
Discussion
----------
PSR-2 Fixes
| Q | A
| ------------- | ---
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | N/A
| License | MIT
| Doc PR | N/A
##### This pull request brings symfony 2.3 back inline with PSR-2.
Commits
-------
eda746b
PSR-2 fixes
This commit is contained in:
commit
be81a1d11b
@ -36,7 +36,7 @@ class HttpKernelExtension extends \Twig_Extension
|
||||
public function getFunctions()
|
||||
{
|
||||
return array(
|
||||
new \Twig_SimpleFunction('render',array($this, 'renderFragment'), array('is_safe' => array('html'))),
|
||||
new \Twig_SimpleFunction('render', array($this, 'renderFragment'), array('is_safe' => array('html'))),
|
||||
new \Twig_SimpleFunction('render_*', array($this, 'renderFragmentStrategy'), array('is_safe' => array('html'))),
|
||||
new \Twig_SimpleFunction('controller', array($this, 'controller')),
|
||||
);
|
||||
|
@ -226,7 +226,7 @@ class FrameworkExtension extends Extension
|
||||
'memcached' => 'Symfony\Component\HttpKernel\Profiler\MemcachedProfilerStorage',
|
||||
'redis' => 'Symfony\Component\HttpKernel\Profiler\RedisProfilerStorage',
|
||||
);
|
||||
list($class, ) = explode(':', $config['dsn'], 2);
|
||||
list($class,) = explode(':', $config['dsn'], 2);
|
||||
if (!isset($supported[$class])) {
|
||||
throw new \LogicException(sprintf('Driver "%s" is not supported for the profiler.', $class));
|
||||
}
|
||||
@ -663,7 +663,7 @@ class FrameworkExtension extends Extension
|
||||
return $files;
|
||||
}
|
||||
|
||||
private function registerAnnotationsConfiguration(array $config, ContainerBuilder $container,$loader)
|
||||
private function registerAnnotationsConfiguration(array $config, ContainerBuilder $container, $loader)
|
||||
{
|
||||
$loader->load('annotations.xml');
|
||||
|
||||
|
@ -100,9 +100,9 @@ class TemplateManagerTest extends TestCase
|
||||
->will($this->returnCallback(array($this, 'profileHasCollectorCallback')));
|
||||
|
||||
$result = $this->templateManager->getTemplates($profile);
|
||||
$this->assertArrayHasKey('foo',$result);
|
||||
$this->assertArrayNotHasKey('bar',$result);
|
||||
$this->assertArrayNotHasKey('baz',$result);
|
||||
$this->assertArrayHasKey('foo', $result);
|
||||
$this->assertArrayNotHasKey('bar', $result);
|
||||
$this->assertArrayNotHasKey('baz', $result);
|
||||
}
|
||||
|
||||
public function profilerHasCallback($panel)
|
||||
|
@ -202,9 +202,9 @@ class CookieJarTest extends \PHPUnit_Framework_TestCase
|
||||
$cookieJar->set($cookie1 = new Cookie('foo', 'bar', null, '/', '.example.com'));
|
||||
$cookieJar->set($cookie2 = new Cookie('foo1', 'bar', null, '/', 'test.example.com'));
|
||||
|
||||
$this->assertEquals($cookie1, $cookieJar->get('foo','/','foo.example.com'));
|
||||
$this->assertEquals($cookie1, $cookieJar->get('foo','/','example.com'));
|
||||
$this->assertEquals($cookie2, $cookieJar->get('foo1','/','test.example.com'));
|
||||
$this->assertEquals($cookie1, $cookieJar->get('foo', '/', 'foo.example.com'));
|
||||
$this->assertEquals($cookie1, $cookieJar->get('foo', '/', 'example.com'));
|
||||
$this->assertEquals($cookie2, $cookieJar->get('foo1', '/', 'test.example.com'));
|
||||
}
|
||||
|
||||
public function testCookieGetWithSubdirectory()
|
||||
@ -213,11 +213,11 @@ class CookieJarTest extends \PHPUnit_Framework_TestCase
|
||||
$cookieJar->set($cookie1 = new Cookie('foo', 'bar', null, '/test', '.example.com'));
|
||||
$cookieJar->set($cookie2 = new Cookie('foo1', 'bar1', null, '/', '.example.com'));
|
||||
|
||||
$this->assertNull($cookieJar->get('foo','/','.example.com'));
|
||||
$this->assertNull($cookieJar->get('foo','/bar','.example.com'));
|
||||
$this->assertEquals($cookie1, $cookieJar->get('foo','/test','example.com'));
|
||||
$this->assertEquals($cookie2, $cookieJar->get('foo1','/','example.com'));
|
||||
$this->assertEquals($cookie2, $cookieJar->get('foo1','/bar','example.com'));
|
||||
$this->assertNull($cookieJar->get('foo', '/', '.example.com'));
|
||||
$this->assertNull($cookieJar->get('foo', '/bar', '.example.com'));
|
||||
$this->assertEquals($cookie1, $cookieJar->get('foo', '/test', 'example.com'));
|
||||
$this->assertEquals($cookie2, $cookieJar->get('foo1', '/', 'example.com'));
|
||||
$this->assertEquals($cookie2, $cookieJar->get('foo1', '/bar', 'example.com'));
|
||||
}
|
||||
|
||||
public function testCookieWithWildcardDomain()
|
||||
|
@ -91,7 +91,7 @@ abstract class FileLoader extends Loader
|
||||
}
|
||||
|
||||
$resources = is_array($resource) ? $resource : array($resource);
|
||||
for ($i = 0; $i < $resourcesCount = count($resources); $i++ ) {
|
||||
for ($i = 0; $i < $resourcesCount = count($resources); $i++) {
|
||||
if (isset(self::$loading[$resources[$i]])) {
|
||||
if ($i == $resourcesCount-1) {
|
||||
throw new FileLoaderImportCircularReferenceException(array_keys(self::$loading));
|
||||
|
@ -116,10 +116,10 @@ class ArrayNodeTest extends \PHPUnit_Framework_TestCase
|
||||
'string_key' => 'just value',
|
||||
),
|
||||
array(
|
||||
0 => array (
|
||||
0 => array(
|
||||
'name' => 'something',
|
||||
),
|
||||
5 => array (
|
||||
5 => array(
|
||||
0 => 'this won\'t work too',
|
||||
'new_key' => 'some other value',
|
||||
),
|
||||
|
@ -33,16 +33,16 @@ class ExprBuilderTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertFinalizedValueIs('new_value', $test, array('key' => true));
|
||||
|
||||
$test = $this->getTestBuilder()
|
||||
->ifTrue( function ($v) { return true; })
|
||||
->ifTrue(function ($v) { return true; })
|
||||
->then($this->returnClosure('new_value'))
|
||||
->end();
|
||||
$this->assertFinalizedValueIs('new_value', $test);
|
||||
|
||||
$test = $this->getTestBuilder()
|
||||
->ifTrue( function ($v) { return false; })
|
||||
->ifTrue(function ($v) { return false; })
|
||||
->then($this->returnClosure('new_value'))
|
||||
->end();
|
||||
$this->assertFinalizedValueIs('value',$test);
|
||||
$this->assertFinalizedValueIs('value', $test);
|
||||
}
|
||||
|
||||
public function testIfStringExpression()
|
||||
|
@ -117,7 +117,7 @@ class MarkdownDescriptor extends Descriptor
|
||||
|
||||
$blocks[] = implode("\n", array_map(function ($commandName) {
|
||||
return '* '.$commandName;
|
||||
} , $namespace['commands']));
|
||||
}, $namespace['commands']));
|
||||
}
|
||||
|
||||
foreach ($description->getCommands() as $command) {
|
||||
|
@ -126,9 +126,9 @@ class FlattenExceptionTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
$flattened->setPrevious($flattened2);
|
||||
|
||||
$this->assertSame($flattened2,$flattened->getPrevious());
|
||||
$this->assertSame($flattened2, $flattened->getPrevious());
|
||||
|
||||
$this->assertSame(array($flattened2),$flattened->getAllPrevious());
|
||||
$this->assertSame(array($flattened2), $flattened->getAllPrevious());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -162,7 +162,7 @@ class FlattenExceptionTest extends \PHPUnit_Framework_TestCase
|
||||
'message' => 'test',
|
||||
'class' => 'Exception',
|
||||
'trace' => array(array(
|
||||
'namespace' => '', 'short_class' => '', 'class' => '','type' => '','function' => '', 'file' => 'foo.php', 'line' => 123,
|
||||
'namespace' => '', 'short_class' => '', 'class' => '', 'type' => '', 'function' => '', 'file' => 'foo.php', 'line' => 123,
|
||||
'args' => array(),
|
||||
)),
|
||||
),
|
||||
@ -214,12 +214,12 @@ class FlattenExceptionTest extends \PHPUnit_Framework_TestCase
|
||||
'class' => 'Exception',
|
||||
'trace' => array(
|
||||
array(
|
||||
'namespace' => '', 'short_class' => '', 'class' => '','type' => '','function' => '',
|
||||
'namespace' => '', 'short_class' => '', 'class' => '', 'type' => '', 'function' => '',
|
||||
'file' => 'foo.php', 'line' => 123,
|
||||
'args' => array(),
|
||||
),
|
||||
array(
|
||||
'namespace' => '', 'short_class' => '', 'class' => '','type' => '','function' => 'test',
|
||||
'namespace' => '', 'short_class' => '', 'class' => '', 'type' => '', 'function' => 'test',
|
||||
'file' => __FILE__, 'line' => 123,
|
||||
'args' => array(
|
||||
array(
|
||||
|
@ -147,9 +147,9 @@ class ResolveDefinitionTemplatesPassTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$container = new ContainerBuilder();
|
||||
|
||||
$container->register('parent','stdClass');
|
||||
$container->register('parent', 'stdClass');
|
||||
|
||||
$container->setDefinition('child1',new DefinitionDecorator('parent'))
|
||||
$container->setDefinition('child1', new DefinitionDecorator('parent'))
|
||||
->setLazy(true)
|
||||
;
|
||||
|
||||
@ -162,11 +162,11 @@ class ResolveDefinitionTemplatesPassTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$container = new ContainerBuilder();
|
||||
|
||||
$container->register('parent','stdClass')
|
||||
$container->register('parent', 'stdClass')
|
||||
->setLazy(true)
|
||||
;
|
||||
|
||||
$container->setDefinition('child1',new DefinitionDecorator('parent'));
|
||||
$container->setDefinition('child1', new DefinitionDecorator('parent'));
|
||||
|
||||
$this->process($container);
|
||||
|
||||
|
@ -6,7 +6,7 @@ if (is_file($file)) {
|
||||
}
|
||||
|
||||
$phar = new Phar($file, 0, 'ProjectWithXsdExtensionInPhar.phar');
|
||||
$phar->addFromString('ProjectWithXsdExtensionInPhar.php',<<<EOT
|
||||
$phar->addFromString('ProjectWithXsdExtensionInPhar.php', <<<EOT
|
||||
<?php
|
||||
|
||||
class ProjectWithXsdExtensionInPhar extends ProjectExtension
|
||||
|
@ -351,8 +351,7 @@ EOF
|
||||
public function testHtml()
|
||||
{
|
||||
$this->assertEquals('<img alt="Bar">', $this->createTestCrawler()->filterXPath('//a[5]')->html());
|
||||
$this->assertEquals('<input type="text" value="TextValue" name="TextName"><input type="submit" value="FooValue" name="FooName" id="FooId"><input type="button" value="BarValue" name="BarName" id="BarId"><button value="ButtonValue" name="ButtonName" id="ButtonId"></button>'
|
||||
, trim($this->createTestCrawler()->filterXPath('//form[@id="FooFormId"]')->html()));
|
||||
$this->assertEquals('<input type="text" value="TextValue" name="TextName"><input type="submit" value="FooValue" name="FooName" id="FooId"><input type="button" value="BarValue" name="BarName" id="BarId"><button value="ButtonValue" name="ButtonName" id="ButtonId"></button>', trim($this->createTestCrawler()->filterXPath('//form[@id="FooFormId"]')->html()));
|
||||
|
||||
try {
|
||||
$this->createTestCrawler()->filterXPath('//ol')->html();
|
||||
|
@ -53,28 +53,28 @@ class FilecontentFilterIteratorTest extends IteratorTestCase
|
||||
'name' => 'a.txt',
|
||||
'contents' => 'Lorem ipsum...',
|
||||
'type' => 'file',
|
||||
'mode' => 'r+',)
|
||||
'mode' => 'r+', )
|
||||
);
|
||||
|
||||
$inner[] = new MockSplFileInfo(array(
|
||||
'name' => 'b.yml',
|
||||
'contents' => 'dolor sit...',
|
||||
'type' => 'file',
|
||||
'mode' => 'r+',)
|
||||
'mode' => 'r+', )
|
||||
);
|
||||
|
||||
$inner[] = new MockSplFileInfo(array(
|
||||
'name' => 'some/other/dir/third.php',
|
||||
'contents' => 'amet...',
|
||||
'type' => 'file',
|
||||
'mode' => 'r+',)
|
||||
'mode' => 'r+', )
|
||||
);
|
||||
|
||||
$inner[] = new MockSplFileInfo(array(
|
||||
'name' => 'unreadable-file.txt',
|
||||
'contents' => false,
|
||||
'type' => 'file',
|
||||
'mode' => 'r+',)
|
||||
'mode' => 'r+', )
|
||||
);
|
||||
|
||||
return array(
|
||||
|
@ -32,7 +32,7 @@ class ArrayToPartsTransformer implements DataTransformerInterface
|
||||
$array = array();
|
||||
}
|
||||
|
||||
if (!is_array($array) ) {
|
||||
if (!is_array($array)) {
|
||||
throw new TransformationFailedException('Expected an array.');
|
||||
}
|
||||
|
||||
@ -51,7 +51,7 @@ class ArrayToPartsTransformer implements DataTransformerInterface
|
||||
|
||||
public function reverseTransform($array)
|
||||
{
|
||||
if (!is_array($array) ) {
|
||||
if (!is_array($array)) {
|
||||
throw new TransformationFailedException('Expected an array.');
|
||||
}
|
||||
|
||||
|
@ -113,7 +113,7 @@ class ValidatorTypeGuesserTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function maxLengthTypeProvider()
|
||||
{
|
||||
return array (
|
||||
return array(
|
||||
array('double'),
|
||||
array('float'),
|
||||
array('numeric'),
|
||||
|
@ -168,7 +168,7 @@ class ViolationMapperTest extends \PHPUnit_Framework_TestCase
|
||||
$child = $this->getForm('address', 'address', null, array(), false, false);
|
||||
// even though "street" is synchronized, it should not have any errors
|
||||
// due to its parent not being synchronized
|
||||
$grandChild = $this->getForm('street' , 'street');
|
||||
$grandChild = $this->getForm('street', 'street');
|
||||
|
||||
$parent->add($child);
|
||||
$child->add($grandChild);
|
||||
|
@ -51,7 +51,7 @@ class CookieTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testInvalidExpiration()
|
||||
{
|
||||
$cookie = new Cookie('MyCookie', 'foo','bar');
|
||||
$cookie = new Cookie('MyCookie', 'foo', 'bar');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -116,7 +116,7 @@ class FileTest extends \PHPUnit_Framework_TestCase
|
||||
copy(__DIR__.'/Fixtures/test.gif', $path);
|
||||
|
||||
$file = new File($path);
|
||||
$movedFile = $file->move($targetDir,$filename);
|
||||
$movedFile = $file->move($targetDir, $filename);
|
||||
$this->assertInstanceOf('Symfony\Component\HttpFoundation\File\File', $movedFile);
|
||||
|
||||
$this->assertTrue(file_exists($targetPath));
|
||||
|
@ -97,18 +97,18 @@ class HeaderBagTest extends \PHPUnit_Framework_TestCase
|
||||
public function testGet()
|
||||
{
|
||||
$bag = new HeaderBag(array('foo' => 'bar', 'fuzz' => 'bizz'));
|
||||
$this->assertEquals( 'bar', $bag->get('foo'), '->get return current value');
|
||||
$this->assertEquals( 'bar', $bag->get('FoO'), '->get key in case insensitive');
|
||||
$this->assertEquals( array('bar'), $bag->get('foo', 'nope', false), '->get return the value as array');
|
||||
$this->assertEquals('bar', $bag->get('foo'), '->get return current value');
|
||||
$this->assertEquals('bar', $bag->get('FoO'), '->get key in case insensitive');
|
||||
$this->assertEquals(array('bar'), $bag->get('foo', 'nope', false), '->get return the value as array');
|
||||
|
||||
// defaults
|
||||
$this->assertNull($bag->get('none'), '->get unknown values returns null');
|
||||
$this->assertEquals( 'default', $bag->get('none', 'default'), '->get unknown values returns default');
|
||||
$this->assertEquals( array('default'), $bag->get('none', 'default', false), '->get unknown values returns default as array');
|
||||
$this->assertEquals('default', $bag->get('none', 'default'), '->get unknown values returns default');
|
||||
$this->assertEquals(array('default'), $bag->get('none', 'default', false), '->get unknown values returns default as array');
|
||||
|
||||
$bag->set('foo', 'bor', false);
|
||||
$this->assertEquals( 'bar', $bag->get('foo'), '->get return first value');
|
||||
$this->assertEquals( array('bar', 'bor'), $bag->get('foo', 'nope', false), '->get return all values as array');
|
||||
$this->assertEquals('bar', $bag->get('foo'), '->get return first value');
|
||||
$this->assertEquals(array('bar', 'bor'), $bag->get('foo', 'nope', false), '->get return all values as array');
|
||||
}
|
||||
|
||||
public function testSetAssociativeArray()
|
||||
@ -125,16 +125,16 @@ class HeaderBagTest extends \PHPUnit_Framework_TestCase
|
||||
public function testContains()
|
||||
{
|
||||
$bag = new HeaderBag(array('foo' => 'bar', 'fuzz' => 'bizz'));
|
||||
$this->assertTrue( $bag->contains('foo', 'bar'), '->contains first value');
|
||||
$this->assertTrue( $bag->contains('fuzz', 'bizz'), '->contains second value');
|
||||
$this->assertFalse( $bag->contains('nope', 'nope'), '->contains unknown value');
|
||||
$this->assertFalse( $bag->contains('foo', 'nope'), '->contains unknown value');
|
||||
$this->assertTrue($bag->contains('foo', 'bar'), '->contains first value');
|
||||
$this->assertTrue($bag->contains('fuzz', 'bizz'), '->contains second value');
|
||||
$this->assertFalse($bag->contains('nope', 'nope'), '->contains unknown value');
|
||||
$this->assertFalse($bag->contains('foo', 'nope'), '->contains unknown value');
|
||||
|
||||
// Multiple values
|
||||
$bag->set('foo', 'bor', false);
|
||||
$this->assertTrue( $bag->contains('foo', 'bar'), '->contains first value');
|
||||
$this->assertTrue( $bag->contains('foo', 'bor'), '->contains second value');
|
||||
$this->assertFalse( $bag->contains('foo', 'nope'), '->contains unknown value');
|
||||
$this->assertTrue($bag->contains('foo', 'bar'), '->contains first value');
|
||||
$this->assertTrue($bag->contains('foo', 'bor'), '->contains second value');
|
||||
$this->assertFalse($bag->contains('foo', 'nope'), '->contains unknown value');
|
||||
}
|
||||
|
||||
public function testCacheControlDirectiveAccessors()
|
||||
|
@ -212,12 +212,12 @@ class ParameterBagTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
$this->assertFalse($bag->filter('dec', '', false, FILTER_VALIDATE_INT, array(
|
||||
'flags' => FILTER_FLAG_ALLOW_HEX,
|
||||
'options' => array('min_range' => 1, 'max_range' => 0xff),)
|
||||
'options' => array('min_range' => 1, 'max_range' => 0xff))
|
||||
), '->filter() gets a value of parameter as integer between boundaries');
|
||||
|
||||
$this->assertFalse($bag->filter('hex', '', false, FILTER_VALIDATE_INT, array(
|
||||
'flags' => FILTER_FLAG_ALLOW_HEX,
|
||||
'options' => array('min_range' => 1, 'max_range' => 0xff),)
|
||||
'options' => array('min_range' => 1, 'max_range' => 0xff))
|
||||
), '->filter() gets a value of parameter as integer between boundaries');
|
||||
|
||||
$this->assertEquals(array('bang'), $bag->filter('array', '', false), '->filter() gets a value of parameter as an array');
|
||||
|
@ -217,7 +217,7 @@ class RequestTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals(80, $request->getPort());
|
||||
$this->assertEquals('test.com', $request->getHttpHost());
|
||||
$this->assertEquals('username', $request->getUser());
|
||||
$this->assertSame('',$request->getPassword());
|
||||
$this->assertSame('', $request->getPassword());
|
||||
$this->assertFalse($request->isSecure());
|
||||
|
||||
$request = Request::create('http://test.com/?foo');
|
||||
@ -501,7 +501,7 @@ class RequestTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
$request = new Request();
|
||||
|
||||
$request->initialize(array(), array(), array(), array(), array(),$server);
|
||||
$request->initialize(array(), array(), array(), array(), array(), $server);
|
||||
|
||||
$this->assertEquals('http://host:8080/index.php/some/path', $request->getUriForPath('/some/path'), '->getUriForPath() with non default port');
|
||||
|
||||
|
@ -91,7 +91,7 @@ class FlashBagTest extends \PHPUnit_Framework_TestCase
|
||||
$this->bag->set('error', 'Bar');
|
||||
$this->assertEquals(array(
|
||||
'notice' => array('Foo'),
|
||||
'error' => array('Bar'),), $this->bag->all()
|
||||
'error' => array('Bar'), ), $this->bag->all()
|
||||
);
|
||||
|
||||
$this->assertEquals(array(), $this->bag->all());
|
||||
|
@ -33,12 +33,12 @@ class ConfigDataCollectorTest extends \PHPUnit_Framework_TestCase
|
||||
$c->setKernel($kernel);
|
||||
$c->collect(new Request(), new Response());
|
||||
|
||||
$this->assertSame('test',$c->getEnv());
|
||||
$this->assertSame('test', $c->getEnv());
|
||||
$this->assertTrue($c->isDebug());
|
||||
$this->assertSame('config',$c->getName());
|
||||
$this->assertSame('testkernel',$c->getAppName());
|
||||
$this->assertSame(PHP_VERSION,$c->getPhpVersion());
|
||||
$this->assertSame(Kernel::VERSION,$c->getSymfonyVersion());
|
||||
$this->assertSame('config', $c->getName());
|
||||
$this->assertSame('testkernel', $c->getAppName());
|
||||
$this->assertSame(PHP_VERSION, $c->getPhpVersion());
|
||||
$this->assertSame(Kernel::VERSION, $c->getSymfonyVersion());
|
||||
$this->assertNull($c->getToken());
|
||||
|
||||
// if else clause because we don't know it
|
||||
|
@ -27,20 +27,20 @@ class ExceptionDataCollectorTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testCollect()
|
||||
{
|
||||
$e = new \Exception('foo',500);
|
||||
$e = new \Exception('foo', 500);
|
||||
$c = new ExceptionDataCollector();
|
||||
$flattened = FlattenException::create($e);
|
||||
$trace = $flattened->getTrace();
|
||||
|
||||
$this->assertFalse($c->hasException());
|
||||
|
||||
$c->collect(new Request(), new Response(),$e);
|
||||
$c->collect(new Request(), new Response(), $e);
|
||||
|
||||
$this->assertTrue($c->hasException());
|
||||
$this->assertEquals($flattened,$c->getException());
|
||||
$this->assertSame('foo',$c->getMessage());
|
||||
$this->assertSame(500,$c->getCode());
|
||||
$this->assertSame('exception',$c->getName());
|
||||
$this->assertSame($trace,$c->getTrace());
|
||||
$this->assertEquals($flattened, $c->getException());
|
||||
$this->assertSame('foo', $c->getMessage());
|
||||
$this->assertSame(500, $c->getCode());
|
||||
$this->assertSame('exception', $c->getName());
|
||||
$this->assertSame($trace, $c->getTrace());
|
||||
}
|
||||
}
|
||||
|
@ -38,21 +38,21 @@ class RequestDataCollectorTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
$c->collect($request, $response);
|
||||
|
||||
$this->assertSame('request',$c->getName());
|
||||
$this->assertInstanceOf('Symfony\Component\HttpFoundation\HeaderBag',$c->getRequestHeaders());
|
||||
$this->assertInstanceOf('Symfony\Component\HttpFoundation\ParameterBag',$c->getRequestServer());
|
||||
$this->assertInstanceOf('Symfony\Component\HttpFoundation\ParameterBag',$c->getRequestCookies());
|
||||
$this->assertInstanceOf('Symfony\Component\HttpFoundation\ParameterBag',$c->getRequestAttributes());
|
||||
$this->assertInstanceOf('Symfony\Component\HttpFoundation\ParameterBag',$c->getRequestRequest());
|
||||
$this->assertInstanceOf('Symfony\Component\HttpFoundation\ParameterBag',$c->getRequestQuery());
|
||||
$this->assertEquals('html',$c->getFormat());
|
||||
$this->assertEquals(array(),$c->getSessionAttributes());
|
||||
$this->assertEquals('en',$c->getLocale());
|
||||
$this->assertSame('request', $c->getName());
|
||||
$this->assertInstanceOf('Symfony\Component\HttpFoundation\HeaderBag', $c->getRequestHeaders());
|
||||
$this->assertInstanceOf('Symfony\Component\HttpFoundation\ParameterBag', $c->getRequestServer());
|
||||
$this->assertInstanceOf('Symfony\Component\HttpFoundation\ParameterBag', $c->getRequestCookies());
|
||||
$this->assertInstanceOf('Symfony\Component\HttpFoundation\ParameterBag', $c->getRequestAttributes());
|
||||
$this->assertInstanceOf('Symfony\Component\HttpFoundation\ParameterBag', $c->getRequestRequest());
|
||||
$this->assertInstanceOf('Symfony\Component\HttpFoundation\ParameterBag', $c->getRequestQuery());
|
||||
$this->assertEquals('html', $c->getFormat());
|
||||
$this->assertEquals(array(), $c->getSessionAttributes());
|
||||
$this->assertEquals('en', $c->getLocale());
|
||||
|
||||
$this->assertInstanceOf('Symfony\Component\HttpFoundation\HeaderBag',$c->getResponseHeaders());
|
||||
$this->assertEquals('OK',$c->getStatusText());
|
||||
$this->assertEquals(200,$c->getStatusCode());
|
||||
$this->assertEquals('application/json',$c->getContentType());
|
||||
$this->assertInstanceOf('Symfony\Component\HttpFoundation\HeaderBag', $c->getResponseHeaders());
|
||||
$this->assertEquals('OK', $c->getStatusText());
|
||||
$this->assertEquals(200, $c->getStatusCode());
|
||||
$this->assertEquals('application/json', $c->getContentType());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -161,9 +161,9 @@ class RequestDataCollectorTest extends \PHPUnit_Framework_TestCase
|
||||
$response = new Response();
|
||||
$response->setStatusCode(200);
|
||||
$response->headers->set('Content-Type', 'application/json');
|
||||
$response->headers->setCookie(new Cookie('foo','bar',1,'/foo','localhost',true,true));
|
||||
$response->headers->setCookie(new Cookie('bar','foo',new \DateTime('@946684800')));
|
||||
$response->headers->setCookie(new Cookie('bazz','foo','2000-12-12'));
|
||||
$response->headers->setCookie(new Cookie('foo', 'bar', 1, '/foo', 'localhost', true, true));
|
||||
$response->headers->setCookie(new Cookie('bar', 'foo', new \DateTime('@946684800')));
|
||||
$response->headers->setCookie(new Cookie('bazz', 'foo', '2000-12-12'));
|
||||
|
||||
return array(
|
||||
array($request, $response),
|
||||
|
@ -91,7 +91,7 @@ class StoreTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$cacheKey = $this->storeSimpleEntry();
|
||||
$entries = $this->getStoreMetadata($cacheKey);
|
||||
list ($req, $res) = $entries[0];
|
||||
list($req, $res) = $entries[0];
|
||||
|
||||
$this->assertEquals('ena94a8fe5ccb19ba61c4c0873d391e987982fbbd3', $res['x-content-digest'][0]);
|
||||
}
|
||||
|
@ -497,7 +497,7 @@ EOF;
|
||||
|
||||
$this->assertEquals(array(
|
||||
__DIR__.'/Fixtures/Bundle2Bundle/foo.txt',
|
||||
__DIR__.'/Fixtures/Bundle1Bundle/foo.txt',),
|
||||
__DIR__.'/Fixtures/Bundle1Bundle/foo.txt', ),
|
||||
$kernel->locateResource('@Bundle1Bundle/foo.txt', null, false));
|
||||
}
|
||||
|
||||
@ -560,7 +560,7 @@ EOF;
|
||||
|
||||
$this->assertEquals(array(
|
||||
__DIR__.'/Fixtures/Resources/Bundle1Bundle/foo.txt',
|
||||
__DIR__.'/Fixtures/Bundle1Bundle/Resources/foo.txt',),
|
||||
__DIR__.'/Fixtures/Bundle1Bundle/Resources/foo.txt', ),
|
||||
$kernel->locateResource('@Bundle1Bundle/Resources/foo.txt', __DIR__.'/Fixtures/Resources', false)
|
||||
);
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ abstract class AbstractCurrencyDataProviderTest extends AbstractDataProviderTest
|
||||
{
|
||||
// The below arrays document the state of the ICU data bundled with this package.
|
||||
|
||||
protected static $currencies = array (
|
||||
protected static $currencies = array(
|
||||
'ADP',
|
||||
'AED',
|
||||
'AFA',
|
||||
@ -309,7 +309,7 @@ abstract class AbstractCurrencyDataProviderTest extends AbstractDataProviderTest
|
||||
'ZWR',
|
||||
);
|
||||
|
||||
protected static $alpha3ToNumeric = array (
|
||||
protected static $alpha3ToNumeric = array(
|
||||
'ADP' => 20,
|
||||
'AED' => 784,
|
||||
'AFA' => 4,
|
||||
|
@ -633,7 +633,7 @@ abstract class AbstractLanguageDataProviderTest extends AbstractDataProviderTest
|
||||
'zza',
|
||||
);
|
||||
|
||||
protected static $alpha2ToAlpha3 = array (
|
||||
protected static $alpha2ToAlpha3 = array(
|
||||
'aa' => 'aar',
|
||||
'ab' => 'abk',
|
||||
'ae' => 'ave',
|
||||
|
@ -20,7 +20,7 @@ abstract class AbstractIntlGlobalsTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function errorNameProvider()
|
||||
{
|
||||
return array (
|
||||
return array(
|
||||
array(-129, '[BOGUS UErrorCode]'),
|
||||
array(0, 'U_ZERO_ERROR'),
|
||||
array(1, 'U_ILLEGAL_ARGUMENT_ERROR'),
|
||||
|
@ -10,7 +10,7 @@ $collection->add('blog_show', new Route(
|
||||
array('compiler_class' => 'RouteCompiler'),
|
||||
'{locale}.example.com',
|
||||
array('https'),
|
||||
array('GET','POST','put','OpTiOnS')
|
||||
array('GET', 'POST', 'put', 'OpTiOnS')
|
||||
));
|
||||
$collection->add('blog_show_legacy', new Route(
|
||||
'/blog/{slug}',
|
||||
|
@ -113,7 +113,7 @@ class AnnotationClassLoaderTest extends AbstractAnnotationLoaderTest
|
||||
$route = $routeCollection->get($routeDatas['name']);
|
||||
|
||||
$this->assertSame($routeDatas['path'], $route->getPath(), '->load preserves path annotation');
|
||||
$this->assertSame($routeDatas['requirements'],$route->getRequirements(), '->load preserves requirements annotation');
|
||||
$this->assertSame($routeDatas['requirements'], $route->getRequirements(), '->load preserves requirements annotation');
|
||||
$this->assertCount(0, array_intersect($route->getOptions(), $routeDatas['options']), '->load preserves options annotation');
|
||||
$this->assertSame(array_replace($methodArgs, $routeDatas['defaults']), $route->getDefaults(), '->load preserves defaults annotation');
|
||||
}
|
||||
|
@ -244,12 +244,12 @@ class UrlMatcherTest extends \PHPUnit_Framework_TestCase
|
||||
// 'w' eagerly matches as much as possible and the other variables match the remaining chars.
|
||||
// This also shows that the variables w-z must all exclude the separating char (the dot '.' in this case) by default requirement.
|
||||
// Otherwise they would also consume '.xml' and _format would never match as it's an optional variable.
|
||||
$this->assertEquals(array('w' => 'wwwww', 'x' => 'x', 'y' => 'Y', 'z' => 'Z','_format' => 'xml', '_route' => 'test'), $matcher->match('/wwwwwxYZ.xml'));
|
||||
$this->assertEquals(array('w' => 'wwwww', 'x' => 'x', 'y' => 'Y', 'z' => 'Z', '_format' => 'xml', '_route' => 'test'), $matcher->match('/wwwwwxYZ.xml'));
|
||||
// As 'y' has custom requirement and can only be of value 'y|Y', it will leave 'ZZZ' to variable z.
|
||||
// So with carefully chosen requirements adjacent variables, can be useful.
|
||||
$this->assertEquals(array('w' => 'wwwww', 'x' => 'x', 'y' => 'y', 'z' => 'ZZZ','_format' => 'html', '_route' => 'test'), $matcher->match('/wwwwwxyZZZ'));
|
||||
$this->assertEquals(array('w' => 'wwwww', 'x' => 'x', 'y' => 'y', 'z' => 'ZZZ', '_format' => 'html', '_route' => 'test'), $matcher->match('/wwwwwxyZZZ'));
|
||||
// z and _format are optional.
|
||||
$this->assertEquals(array('w' => 'wwwww', 'x' => 'x', 'y' => 'y', 'z' => 'default-z','_format' => 'html', '_route' => 'test'), $matcher->match('/wwwwwxy'));
|
||||
$this->assertEquals(array('w' => 'wwwww', 'x' => 'x', 'y' => 'y', 'z' => 'default-z', '_format' => 'html', '_route' => 'test'), $matcher->match('/wwwwwxy'));
|
||||
|
||||
$this->setExpectedException('Symfony\Component\Routing\Exception\ResourceNotFoundException');
|
||||
$matcher->match('/wxy.html');
|
||||
|
@ -104,7 +104,7 @@ class AclProvider implements AclProviderInterface
|
||||
$currentBatch = array();
|
||||
$oidLookup = array();
|
||||
|
||||
for ($i = 0,$c = count($oids); $i<$c; $i++) {
|
||||
for ($i = 0, $c = count($oids); $i<$c; $i++) {
|
||||
$oid = $oids[$i];
|
||||
$oidLookupKey = $oid->getIdentifier().$oid->getType();
|
||||
$oidLookup[$oidLookupKey] = $oid;
|
||||
|
@ -787,7 +787,7 @@ QUERY;
|
||||
$classIds = new \SplObjectStorage();
|
||||
$currentIds = array();
|
||||
foreach ($changes[1] as $field => $new) {
|
||||
for ($i = 0,$c = count($new); $i<$c; $i++) {
|
||||
for ($i = 0, $c = count($new); $i<$c; $i++) {
|
||||
$ace = $new[$i];
|
||||
|
||||
if (null === $ace->getId()) {
|
||||
@ -864,7 +864,7 @@ QUERY;
|
||||
$sids = new \SplObjectStorage();
|
||||
$classIds = new \SplObjectStorage();
|
||||
$currentIds = array();
|
||||
for ($i = 0,$c = count($new); $i<$c; $i++) {
|
||||
for ($i = 0, $c = count($new); $i<$c; $i++) {
|
||||
$ace = $new[$i];
|
||||
|
||||
if (null === $ace->getId()) {
|
||||
@ -907,7 +907,7 @@ QUERY;
|
||||
list($old, $new) = $changes;
|
||||
$currentIds = array();
|
||||
|
||||
for ($i = 0,$c = count($new); $i<$c; $i++) {
|
||||
for ($i = 0, $c = count($new); $i<$c; $i++) {
|
||||
$ace = $new[$i];
|
||||
|
||||
if (null !== $ace->getId()) {
|
||||
|
@ -414,7 +414,7 @@ class Acl implements AuditableAclInterface, NotifyPropertyChanged
|
||||
$this->$property = array_values($this->$property);
|
||||
$this->onPropertyChanged($property, $oldValue, $this->$property);
|
||||
|
||||
for ($i = $index,$c = count($this->$property); $i<$c; $i++) {
|
||||
for ($i = $index, $c = count($this->$property); $i<$c; $i++) {
|
||||
$this->onEntryPropertyChanged($aces[$i], 'aceOrder', $i+1, $i);
|
||||
}
|
||||
}
|
||||
@ -440,7 +440,7 @@ class Acl implements AuditableAclInterface, NotifyPropertyChanged
|
||||
$aces[$field] = array_values($aces[$field]);
|
||||
$this->onPropertyChanged($property, $oldValue, $this->$property);
|
||||
|
||||
for ($i = $index,$c = count($aces[$field]); $i<$c; $i++) {
|
||||
for ($i = $index, $c = count($aces[$field]); $i<$c; $i++) {
|
||||
$this->onEntryPropertyChanged($aces[$field][$i], 'aceOrder', $i+1, $i);
|
||||
}
|
||||
}
|
||||
@ -485,7 +485,7 @@ class Acl implements AuditableAclInterface, NotifyPropertyChanged
|
||||
array_slice($this->$property, $index)
|
||||
);
|
||||
|
||||
for ($i = $index,$c = count($this->$property)-1; $i<$c; $i++) {
|
||||
for ($i = $index, $c = count($this->$property)-1; $i<$c; $i++) {
|
||||
$this->onEntryPropertyChanged($aces[$i+1], 'aceOrder', $i, $i+1);
|
||||
}
|
||||
}
|
||||
@ -543,7 +543,7 @@ class Acl implements AuditableAclInterface, NotifyPropertyChanged
|
||||
array_slice($aces[$field], $index)
|
||||
);
|
||||
|
||||
for ($i = $index,$c = count($aces[$field])-1; $i<$c; $i++) {
|
||||
for ($i = $index, $c = count($aces[$field])-1; $i<$c; $i++) {
|
||||
$this->onEntryPropertyChanged($aces[$field][$i+1], 'aceOrder', $i, $i+1);
|
||||
}
|
||||
}
|
||||
|
@ -111,7 +111,7 @@ class AclProviderBenchmarkTest extends \PHPUnit_Framework_TestCase
|
||||
protected function generateAclLevel($depth, $parentId, $ancestors)
|
||||
{
|
||||
$level = count($ancestors);
|
||||
for ($i = 0,$t = rand(1, 10); $i<$t; $i++) {
|
||||
for ($i = 0, $t = rand(1, 10); $i<$t; $i++) {
|
||||
$id = $this->generateAcl($this->chooseClassId(), $parentId, $ancestors);
|
||||
|
||||
if ($level < $depth) {
|
||||
|
@ -27,7 +27,7 @@ class AclVoterTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testSupportsAttribute($attribute, $supported)
|
||||
{
|
||||
list($voter,, $permissionMap,,) = $this->getVoter(true, false);
|
||||
list($voter, , $permissionMap, ,) = $this->getVoter(true, false);
|
||||
|
||||
$permissionMap
|
||||
->expects($this->once())
|
||||
@ -44,7 +44,7 @@ class AclVoterTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testSupportsAttributeNonString($attribute)
|
||||
{
|
||||
list($voter,,,,,) = $this->getVoter(true, false);
|
||||
list($voter, , , , ,) = $this->getVoter(true, false);
|
||||
|
||||
$this->assertFalse($voter->supportsAttribute($attribute));
|
||||
}
|
||||
@ -72,7 +72,7 @@ class AclVoterTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testSupportsClass($class)
|
||||
{
|
||||
list($voter,,,,) = $this->getVoter();
|
||||
list($voter, , , ,) = $this->getVoter();
|
||||
|
||||
$this->assertTrue($voter->supportsClass($class));
|
||||
}
|
||||
@ -88,7 +88,7 @@ class AclVoterTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testVote()
|
||||
{
|
||||
list($voter,, $permissionMap,,) = $this->getVoter();
|
||||
list($voter, , $permissionMap, ,) = $this->getVoter();
|
||||
$permissionMap
|
||||
->expects($this->atLeastOnce())
|
||||
->method('getMasks')
|
||||
@ -103,7 +103,7 @@ class AclVoterTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testVoteWhenNoObjectIsPassed($allowIfObjectIdentityUnavailable)
|
||||
{
|
||||
list($voter,, $permissionMap,,) = $this->getVoter($allowIfObjectIdentityUnavailable);
|
||||
list($voter, , $permissionMap, ,) = $this->getVoter($allowIfObjectIdentityUnavailable);
|
||||
$permissionMap
|
||||
->expects($this->once())
|
||||
->method('getMasks')
|
||||
@ -124,7 +124,7 @@ class AclVoterTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testVoteWhenOidStrategyReturnsNull($allowIfUnavailable)
|
||||
{
|
||||
list($voter,, $permissionMap, $oidStrategy,) = $this->getVoter($allowIfUnavailable);
|
||||
list($voter, , $permissionMap, $oidStrategy,) = $this->getVoter($allowIfUnavailable);
|
||||
$permissionMap
|
||||
->expects($this->once())
|
||||
->method('getMasks')
|
||||
@ -365,7 +365,7 @@ class AclVoterTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
list($voter, $provider, $permissionMap, $oidStrategy, $sidStrategy) = $this->getVoter();
|
||||
|
||||
$oid = new ObjectIdentity('someID','someType');
|
||||
$oid = new ObjectIdentity('someID', 'someType');
|
||||
|
||||
$permissionMap
|
||||
->expects($this->once())
|
||||
|
@ -99,8 +99,8 @@ class AccessDecisionManagerTest extends \PHPUnit_Framework_TestCase
|
||||
$voter->expects($this->exactly(2))
|
||||
->method('vote')
|
||||
->will($this->returnValueMap(array(
|
||||
array($token, null, array("ROLE_FOO"),$vote1),
|
||||
array($token, null, array("ROLE_BAR"),$vote2),
|
||||
array($token, null, array("ROLE_FOO"), $vote1),
|
||||
array($token, null, array("ROLE_BAR"), $vote2),
|
||||
)))
|
||||
;
|
||||
|
||||
|
@ -34,7 +34,7 @@ class RememberMeListenerTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testOnCoreSecurityDoesNotTryToPopulateNonEmptySecurityContext()
|
||||
{
|
||||
list($listener, $context, $service,,) = $this->getListener();
|
||||
list($listener, $context, $service, ,) = $this->getListener();
|
||||
|
||||
$context
|
||||
->expects($this->once())
|
||||
@ -52,7 +52,7 @@ class RememberMeListenerTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testOnCoreSecurityDoesNothingWhenNoCookieIsSet()
|
||||
{
|
||||
list($listener, $context, $service,,) = $this->getListener();
|
||||
list($listener, $context, $service, ,) = $this->getListener();
|
||||
|
||||
$context
|
||||
->expects($this->once())
|
||||
|
@ -62,7 +62,7 @@ class StopwatchTest extends \PHPUnit_Framework_TestCase
|
||||
'foo' =>
|
||||
$this->getMockBuilder('Symfony\Component\Stopwatch\StopwatchEvent')
|
||||
->setConstructorArgs(array(microtime(true) * 1000))
|
||||
->getMock(),)
|
||||
->getMock())
|
||||
);
|
||||
|
||||
$this->assertFalse($stopwatch->isStarted('foo'));
|
||||
|
@ -89,7 +89,7 @@ class ChoiceValidatorTest extends AbstractConstraintValidatorTest
|
||||
{
|
||||
$constraint = new Choice(array('callback' => function () {
|
||||
return array('foo', 'bar');
|
||||
},));
|
||||
}, ));
|
||||
|
||||
$this->validator->validate('bar', $constraint);
|
||||
|
||||
|
@ -106,7 +106,7 @@ class ClassMetadataFactoryTest extends \PHPUnit_Framework_TestCase
|
||||
->method('read')
|
||||
->will($this->returnValue($metadata));
|
||||
|
||||
$this->assertEquals($metadata,$factory->getMetadataFor(self::PARENTCLASS));
|
||||
$this->assertEquals($metadata, $factory->getMetadataFor(self::PARENTCLASS));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -114,7 +114,7 @@ class Parser
|
||||
$data[] = $this->parseValue($values['value'], $exceptionOnInvalidType, $objectSupport);
|
||||
}
|
||||
}
|
||||
} elseif (preg_match('#^(?P<key>'.Inline::REGEX_QUOTED_STRING.'|[^ \'"\[\{].*?) *\:(\s+(?P<value>.+?))?\s*$#u', $this->currentLine, $values) && (false === strpos($values['key'],' #') || in_array($values['key'][0], array('"', "'")))) {
|
||||
} elseif (preg_match('#^(?P<key>'.Inline::REGEX_QUOTED_STRING.'|[^ \'"\[\{].*?) *\:(\s+(?P<value>.+?))?\s*$#u', $this->currentLine, $values) && (false === strpos($values['key'], ' #') || in_array($values['key'][0], array('"', "'")))) {
|
||||
if ($context && 'sequence' == $context) {
|
||||
throw new ParseException('You cannot define a mapping item when in a sequence');
|
||||
}
|
||||
|
Reference in New Issue
Block a user