This commit is contained in:
Fabien Potencier 2014-09-21 20:53:12 +02:00
parent f5d4515200
commit 369aebf431
420 changed files with 1167 additions and 1185 deletions

View File

@ -207,11 +207,11 @@ abstract class AbstractDoctrineExtension extends Extension
} elseif ($driverType == 'annotation') { } elseif ($driverType == 'annotation') {
$mappingDriverDef = new Definition('%'.$this->getObjectManagerElementName('metadata.'.$driverType.'.class%'), array( $mappingDriverDef = new Definition('%'.$this->getObjectManagerElementName('metadata.'.$driverType.'.class%'), array(
new Reference($this->getObjectManagerElementName('metadata.annotation_reader')), new Reference($this->getObjectManagerElementName('metadata.annotation_reader')),
array_values($driverPaths) array_values($driverPaths),
)); ));
} else { } else {
$mappingDriverDef = new Definition('%'.$this->getObjectManagerElementName('metadata.'.$driverType.'.class%'), array( $mappingDriverDef = new Definition('%'.$this->getObjectManagerElementName('metadata.'.$driverType.'.class%'), array(
array_values($driverPaths) array_values($driverPaths),
)); ));
} }
$mappingDriverDef->setPublic(false); $mappingDriverDef->setPublic(false);
@ -320,7 +320,7 @@ abstract class AbstractDoctrineExtension extends Extension
$cacheDef = new Definition($memcacheClass); $cacheDef = new Definition($memcacheClass);
$memcacheInstance = new Definition($memcacheInstanceClass); $memcacheInstance = new Definition($memcacheInstanceClass);
$memcacheInstance->addMethodCall('connect', array( $memcacheInstance->addMethodCall('connect', array(
$memcacheHost, $memcachePort $memcacheHost, $memcachePort,
)); ));
$container->setDefinition($this->getObjectManagerElementName(sprintf('%s_memcache_instance', $objectManager['name'])), $memcacheInstance); $container->setDefinition($this->getObjectManagerElementName(sprintf('%s_memcache_instance', $objectManager['name'])), $memcacheInstance);
$cacheDef->addMethodCall('setMemcache', array(new Reference($this->getObjectManagerElementName(sprintf('%s_memcache_instance', $objectManager['name']))))); $cacheDef->addMethodCall('setMemcache', array(new Reference($this->getObjectManagerElementName(sprintf('%s_memcache_instance', $objectManager['name'])))));
@ -333,7 +333,7 @@ abstract class AbstractDoctrineExtension extends Extension
$cacheDef = new Definition($memcachedClass); $cacheDef = new Definition($memcachedClass);
$memcachedInstance = new Definition($memcachedInstanceClass); $memcachedInstance = new Definition($memcachedInstanceClass);
$memcachedInstance->addMethodCall('addServer', array( $memcachedInstance->addMethodCall('addServer', array(
$memcachedHost, $memcachedPort $memcachedHost, $memcachedPort,
)); ));
$container->setDefinition($this->getObjectManagerElementName(sprintf('%s_memcached_instance', $objectManager['name'])), $memcachedInstance); $container->setDefinition($this->getObjectManagerElementName(sprintf('%s_memcached_instance', $objectManager['name'])), $memcachedInstance);
$cacheDef->addMethodCall('setMemcached', array(new Reference($this->getObjectManagerElementName(sprintf('%s_memcached_instance', $objectManager['name']))))); $cacheDef->addMethodCall('setMemcached', array(new Reference($this->getObjectManagerElementName(sprintf('%s_memcached_instance', $objectManager['name'])))));
@ -346,7 +346,7 @@ abstract class AbstractDoctrineExtension extends Extension
$cacheDef = new Definition($redisClass); $cacheDef = new Definition($redisClass);
$redisInstance = new Definition($redisInstanceClass); $redisInstance = new Definition($redisInstanceClass);
$redisInstance->addMethodCall('connect', array( $redisInstance->addMethodCall('connect', array(
$redisHost, $redisPort $redisHost, $redisPort,
)); ));
$container->setDefinition($this->getObjectManagerElementName(sprintf('%s_redis_instance', $objectManager['name'])), $redisInstance); $container->setDefinition($this->getObjectManagerElementName(sprintf('%s_redis_instance', $objectManager['name'])), $redisInstance);
$cacheDef->addMethodCall('setRedis', array(new Reference($this->getObjectManagerElementName(sprintf('%s_redis_instance', $objectManager['name']))))); $cacheDef->addMethodCall('setRedis', array(new Reference($this->getObjectManagerElementName(sprintf('%s_redis_instance', $objectManager['name'])))));

View File

@ -452,7 +452,7 @@ class EntityChoiceList extends ObjectChoiceList
{ {
if (!$this->em->contains($entity)) { if (!$this->em->contains($entity)) {
throw new RuntimeException( throw new RuntimeException(
'Entities passed to the choice field must be managed. Maybe ' . 'Entities passed to the choice field must be managed. Maybe '.
'persist them in the entity manager?' 'persist them in the entity manager?'
); );
} }

View File

@ -60,7 +60,7 @@ abstract class DoctrineType extends AbstractType
public function setDefaultOptions(OptionsResolverInterface $resolver) public function setDefaultOptions(OptionsResolverInterface $resolver)
{ {
$choiceListCache =& $this->choiceListCache; $choiceListCache = & $this->choiceListCache;
$registry = $this->registry; $registry = $this->registry;
$propertyAccessor = $this->propertyAccessor; $propertyAccessor = $this->propertyAccessor;
$type = $this; $type = $this;
@ -121,7 +121,7 @@ abstract class DoctrineType extends AbstractType
$loaderHash, $loaderHash,
$choiceHashes, $choiceHashes,
$preferredChoiceHashes, $preferredChoiceHashes,
$groupByHash $groupByHash,
))); )));
if (!isset($choiceListCache[$hash])) { if (!isset($choiceListCache[$hash])) {
@ -150,7 +150,7 @@ abstract class DoctrineType extends AbstractType
if (null === $em) { if (null === $em) {
throw new RuntimeException(sprintf( throw new RuntimeException(sprintf(
'Class "%s" seems not to be a managed Doctrine entity. ' . 'Class "%s" seems not to be a managed Doctrine entity. '.
'Did you forget to map it?', 'Did you forget to map it?',
$options['class'] $options['class']
)); ));

View File

@ -218,18 +218,18 @@ class DbalSessionHandler implements \SessionHandlerInterface
switch ($platform) { switch ($platform) {
case 'mysql': case 'mysql':
return "INSERT INTO $this->table ($this->idCol, $this->dataCol, $this->timeCol) VALUES (:id, :data, :time) " . return "INSERT INTO $this->table ($this->idCol, $this->dataCol, $this->timeCol) VALUES (:id, :data, :time) ".
"ON DUPLICATE KEY UPDATE $this->dataCol = VALUES($this->dataCol), $this->timeCol = VALUES($this->timeCol)"; "ON DUPLICATE KEY UPDATE $this->dataCol = VALUES($this->dataCol), $this->timeCol = VALUES($this->timeCol)";
case 'oracle': case 'oracle':
// DUAL is Oracle specific dummy table // DUAL is Oracle specific dummy table
return "MERGE INTO $this->table USING DUAL ON ($this->idCol = :id) " . return "MERGE INTO $this->table USING DUAL ON ($this->idCol = :id) ".
"WHEN NOT MATCHED THEN INSERT ($this->idCol, $this->dataCol, $this->timeCol) VALUES (:id, :data, :time) " . "WHEN NOT MATCHED THEN INSERT ($this->idCol, $this->dataCol, $this->timeCol) VALUES (:id, :data, :time) ".
"WHEN MATCHED THEN UPDATE SET $this->dataCol = :data, $this->timeCol = :time"; "WHEN MATCHED THEN UPDATE SET $this->dataCol = :data, $this->timeCol = :time";
case $this->con->getDatabasePlatform() instanceof SQLServer2008Platform: case $this->con->getDatabasePlatform() instanceof SQLServer2008Platform:
// MERGE is only available since SQL Server 2008 and must be terminated by semicolon // MERGE is only available since SQL Server 2008 and must be terminated by semicolon
// It also requires HOLDLOCK according to http://weblogs.sqlteam.com/dang/archive/2009/01/31/UPSERT-Race-Condition-With-MERGE.aspx // It also requires HOLDLOCK according to http://weblogs.sqlteam.com/dang/archive/2009/01/31/UPSERT-Race-Condition-With-MERGE.aspx
return "MERGE INTO $this->table WITH (HOLDLOCK) USING (SELECT 1 AS dummy) AS src ON ($this->idCol = :id) " . return "MERGE INTO $this->table WITH (HOLDLOCK) USING (SELECT 1 AS dummy) AS src ON ($this->idCol = :id) ".
"WHEN NOT MATCHED THEN INSERT ($this->idCol, $this->dataCol, $this->timeCol) VALUES (:id, :data, :time) " . "WHEN NOT MATCHED THEN INSERT ($this->idCol, $this->dataCol, $this->timeCol) VALUES (:id, :data, :time) ".
"WHEN MATCHED THEN UPDATE SET $this->dataCol = :data, $this->timeCol = :time;"; "WHEN MATCHED THEN UPDATE SET $this->dataCol = :data, $this->timeCol = :time;";
case 'sqlite': case 'sqlite':
return "INSERT OR REPLACE INTO $this->table ($this->idCol, $this->dataCol, $this->timeCol) VALUES (:id, :data, :time)"; return "INSERT OR REPLACE INTO $this->table ($this->idCol, $this->dataCol, $this->timeCol) VALUES (:id, :data, :time)";

View File

@ -61,7 +61,7 @@ class DoctrineTokenProvider implements TokenProviderInterface
public function loadTokenBySeries($series) public function loadTokenBySeries($series)
{ {
$sql = 'SELECT class, username, value, lastUsed' $sql = 'SELECT class, username, value, lastUsed'
. ' FROM rememberme_token WHERE series=:series'; .' FROM rememberme_token WHERE series=:series';
$paramValues = array('series' => $series); $paramValues = array('series' => $series);
$paramTypes = array('series' => \PDO::PARAM_STR); $paramTypes = array('series' => \PDO::PARAM_STR);
$stmt = $this->conn->executeQuery($sql, $paramValues, $paramTypes); $stmt = $this->conn->executeQuery($sql, $paramValues, $paramTypes);
@ -95,13 +95,13 @@ class DoctrineTokenProvider implements TokenProviderInterface
public function updateToken($series, $tokenValue, \DateTime $lastUsed) public function updateToken($series, $tokenValue, \DateTime $lastUsed)
{ {
$sql = 'UPDATE rememberme_token SET value=:value, lastUsed=:lastUsed' $sql = 'UPDATE rememberme_token SET value=:value, lastUsed=:lastUsed'
. ' WHERE series=:series'; .' WHERE series=:series';
$paramValues = array('value' => $tokenValue, $paramValues = array('value' => $tokenValue,
'lastUsed' => $lastUsed, 'lastUsed' => $lastUsed,
'series' => $series); 'series' => $series,);
$paramTypes = array('value' => \PDO::PARAM_STR, $paramTypes = array('value' => \PDO::PARAM_STR,
'lastUsed' => DoctrineType::DATETIME, 'lastUsed' => DoctrineType::DATETIME,
'series' => \PDO::PARAM_STR); 'series' => \PDO::PARAM_STR,);
$updated = $this->conn->executeUpdate($sql, $paramValues, $paramTypes); $updated = $this->conn->executeUpdate($sql, $paramValues, $paramTypes);
if ($updated < 1) { if ($updated < 1) {
throw new TokenNotFoundException('No token found.'); throw new TokenNotFoundException('No token found.');
@ -114,18 +114,18 @@ class DoctrineTokenProvider implements TokenProviderInterface
public function createNewToken(PersistentTokenInterface $token) public function createNewToken(PersistentTokenInterface $token)
{ {
$sql = 'INSERT INTO rememberme_token' $sql = 'INSERT INTO rememberme_token'
. ' (class, username, series, value, lastUsed)' .' (class, username, series, value, lastUsed)'
. ' VALUES (:class, :username, :series, :value, :lastUsed)'; .' VALUES (:class, :username, :series, :value, :lastUsed)';
$paramValues = array('class' => $token->getClass(), $paramValues = array('class' => $token->getClass(),
'username' => $token->getUsername(), 'username' => $token->getUsername(),
'series' => $token->getSeries(), 'series' => $token->getSeries(),
'value' => $token->getTokenValue(), 'value' => $token->getTokenValue(),
'lastUsed' => $token->getLastUsed()); 'lastUsed' => $token->getLastUsed(),);
$paramTypes = array('class' => \PDO::PARAM_STR, $paramTypes = array('class' => \PDO::PARAM_STR,
'username' => \PDO::PARAM_STR, 'username' => \PDO::PARAM_STR,
'series' => \PDO::PARAM_STR, 'series' => \PDO::PARAM_STR,
'value' => \PDO::PARAM_STR, 'value' => \PDO::PARAM_STR,
'lastUsed' => DoctrineType::DATETIME); 'lastUsed' => DoctrineType::DATETIME,);
$this->conn->executeUpdate($sql, $paramValues, $paramTypes); $this->conn->executeUpdate($sql, $paramValues, $paramTypes);
} }
} }

View File

@ -87,7 +87,7 @@ class EntityUserProvider implements UserProviderInterface
if (!$id = $this->metadata->getIdentifierValues($user)) { if (!$id = $this->metadata->getIdentifierValues($user)) {
throw new \InvalidArgumentException("You cannot refresh a user ". throw new \InvalidArgumentException("You cannot refresh a user ".
"from the EntityUserProvider that does not contain an identifier. ". "from the EntityUserProvider that does not contain an identifier. ".
"The user object has to be serialized with its own identifier " . "The user object has to be serialized with its own identifier ".
"mapped by Doctrine." "mapped by Doctrine."
); );
} }

View File

@ -50,7 +50,7 @@ class DoctrineDataCollectorTest extends \PHPUnit_Framework_TestCase
$this->assertEquals(0, $c->getQueryCount()); $this->assertEquals(0, $c->getQueryCount());
$queries = array( $queries = array(
array('sql' => "SELECT * FROM table1", 'params' => array(), 'types' => array(), 'executionMS' => 0) array('sql' => "SELECT * FROM table1", 'params' => array(), 'types' => array(), 'executionMS' => 0),
); );
$c = $this->createCollector($queries); $c = $this->createCollector($queries);
$c->collect(new Request(), new Response()); $c->collect(new Request(), new Response());
@ -64,7 +64,7 @@ class DoctrineDataCollectorTest extends \PHPUnit_Framework_TestCase
$this->assertEquals(0, $c->getTime()); $this->assertEquals(0, $c->getTime());
$queries = array( $queries = array(
array('sql' => "SELECT * FROM table1", 'params' => array(), 'types' => array(), 'executionMS' => 1) array('sql' => "SELECT * FROM table1", 'params' => array(), 'types' => array(), 'executionMS' => 1),
); );
$c = $this->createCollector($queries); $c = $this->createCollector($queries);
$c->collect(new Request(), new Response()); $c->collect(new Request(), new Response());
@ -72,7 +72,7 @@ class DoctrineDataCollectorTest extends \PHPUnit_Framework_TestCase
$queries = array( $queries = array(
array('sql' => "SELECT * FROM table1", 'params' => array(), 'types' => array(), 'executionMS' => 1), array('sql' => "SELECT * FROM table1", 'params' => array(), 'types' => array(), 'executionMS' => 1),
array('sql' => "SELECT * FROM table2", 'params' => array(), 'types' => array(), 'executionMS' => 2) array('sql' => "SELECT * FROM table2", 'params' => array(), 'types' => array(), 'executionMS' => 2),
); );
$c = $this->createCollector($queries); $c = $this->createCollector($queries);
$c->collect(new Request(), new Response()); $c->collect(new Request(), new Response());
@ -85,7 +85,7 @@ class DoctrineDataCollectorTest extends \PHPUnit_Framework_TestCase
public function testCollectQueries($param, $types, $expected, $explainable) public function testCollectQueries($param, $types, $expected, $explainable)
{ {
$queries = array( $queries = array(
array('sql' => "SELECT * FROM table1 WHERE field1 = ?1", 'params' => array($param), 'types' => $types, 'executionMS' => 1) array('sql' => "SELECT * FROM table1 WHERE field1 = ?1", 'params' => array($param), 'types' => $types, 'executionMS' => 1),
); );
$c = $this->createCollector($queries); $c = $this->createCollector($queries);
$c->collect(new Request(), new Response()); $c->collect(new Request(), new Response());
@ -101,7 +101,7 @@ class DoctrineDataCollectorTest extends \PHPUnit_Framework_TestCase
public function testSerialization($param, $types, $expected, $explainable) public function testSerialization($param, $types, $expected, $explainable)
{ {
$queries = array( $queries = array(
array('sql' => "SELECT * FROM table1 WHERE field1 = ?1", 'params' => array($param), 'types' => $types, 'executionMS' => 1) array('sql' => "SELECT * FROM table1 WHERE field1 = ?1", 'params' => array($param), 'types' => $types, 'executionMS' => 1),
); );
$c = $this->createCollector($queries); $c = $this->createCollector($queries);
$c->collect(new Request(), new Response()); $c->collect(new Request(), new Response());

View File

@ -201,7 +201,7 @@ class GenericEntityChoiceListTest extends \PHPUnit_Framework_TestCase
$this->assertSame(array(1 => $entity1, 2 => $entity2), $choiceList->getChoices()); $this->assertSame(array(1 => $entity1, 2 => $entity2), $choiceList->getChoices());
$this->assertEquals(array( $this->assertEquals(array(
'group1' => array(1 => new ChoiceView($entity1, '1', 'Foo')), 'group1' => array(1 => new ChoiceView($entity1, '1', 'Foo')),
'group2' => array(2 => new ChoiceView($entity2, '2', 'Bar')) 'group2' => array(2 => new ChoiceView($entity2, '2', 'Bar')),
), $choiceList->getRemainingViews()); ), $choiceList->getRemainingViews());
} }
@ -236,7 +236,7 @@ class GenericEntityChoiceListTest extends \PHPUnit_Framework_TestCase
$this->assertEquals(array( $this->assertEquals(array(
'Group1' => array(1 => new ChoiceView($item1, '1', 'Foo'), 2 => new ChoiceView($item2, '2', 'Bar')), 'Group1' => array(1 => new ChoiceView($item1, '1', 'Foo'), 2 => new ChoiceView($item2, '2', 'Bar')),
'Group2' => array(3 => new ChoiceView($item3, '3', 'Baz')), 'Group2' => array(3 => new ChoiceView($item3, '3', 'Baz')),
4 => new ChoiceView($item4, '4', 'Boo!') 4 => new ChoiceView($item4, '4', 'Boo!'),
), $choiceList->getRemainingViews()); ), $choiceList->getRemainingViews());
} }
@ -263,7 +263,7 @@ class GenericEntityChoiceListTest extends \PHPUnit_Framework_TestCase
$this->assertEquals(array( $this->assertEquals(array(
1 => $item1, 1 => $item1,
2 => $item2 2 => $item2,
), $choiceList->getChoices()); ), $choiceList->getChoices());
} }

View File

@ -59,7 +59,7 @@ class DoctrineOrmTypeGuesserTest extends \PHPUnit_Framework_TestCase
$classMetadata->expects($this->once())->method('hasField')->with('field')->will($this->returnValue(false)); $classMetadata->expects($this->once())->method('hasField')->with('field')->will($this->returnValue(false));
$classMetadata->expects($this->once())->method('isAssociationWithSingleJoinColumn')->with('field')->will($this->returnValue(true)); $classMetadata->expects($this->once())->method('isAssociationWithSingleJoinColumn')->with('field')->will($this->returnValue(true));
$mapping = array('joinColumns' => array(array('nullable'=>true))); $mapping = array('joinColumns' => array(array('nullable' => true)));
$classMetadata->expects($this->once())->method('getAssociationMapping')->with('field')->will($this->returnValue($mapping)); $classMetadata->expects($this->once())->method('getAssociationMapping')->with('field')->will($this->returnValue($mapping));
$return[] = array($classMetadata, new ValueGuess(false, Guess::HIGH_CONFIDENCE)); $return[] = array($classMetadata, new ValueGuess(false, Guess::HIGH_CONFIDENCE));
@ -69,7 +69,7 @@ class DoctrineOrmTypeGuesserTest extends \PHPUnit_Framework_TestCase
$classMetadata->expects($this->once())->method('hasField')->with('field')->will($this->returnValue(false)); $classMetadata->expects($this->once())->method('hasField')->with('field')->will($this->returnValue(false));
$classMetadata->expects($this->once())->method('isAssociationWithSingleJoinColumn')->with('field')->will($this->returnValue(true)); $classMetadata->expects($this->once())->method('isAssociationWithSingleJoinColumn')->with('field')->will($this->returnValue(true));
$mapping = array('joinColumns' => array(array('nullable'=>false))); $mapping = array('joinColumns' => array(array('nullable' => false)));
$classMetadata->expects($this->once())->method('getAssociationMapping')->with('field')->will($this->returnValue($mapping)); $classMetadata->expects($this->once())->method('getAssociationMapping')->with('field')->will($this->returnValue($mapping));
$return[] = array($classMetadata, new ValueGuess(true, Guess::HIGH_CONFIDENCE)); $return[] = array($classMetadata, new ValueGuess(true, Guess::HIGH_CONFIDENCE));
@ -94,5 +94,4 @@ class DoctrineOrmTypeGuesserTest extends \PHPUnit_Framework_TestCase
return new DoctrineOrmTypeGuesser($registry); return new DoctrineOrmTypeGuesser($registry);
} }
} }

View File

@ -44,7 +44,7 @@ class EntityTypePerformanceTest extends FormPerformanceTestCase
return array( return array(
new CoreExtension(), new CoreExtension(),
new DoctrineOrmExtension($manager) new DoctrineOrmExtension($manager),
); );
} }

View File

@ -130,7 +130,7 @@ class EntityTypeTest extends TypeTestCase
'em' => 'default', 'em' => 'default',
'class' => self::SINGLE_IDENT_CLASS, 'class' => self::SINGLE_IDENT_CLASS,
'required' => false, 'required' => false,
'property' => 'name' 'property' => 'name',
)); ));
$this->assertEquals(array(1 => new ChoiceView($entity1, '1', 'Foo'), 2 => new ChoiceView($entity2, '2', 'Bar')), $field->createView()->vars['choices']); $this->assertEquals(array(1 => new ChoiceView($entity1, '1', 'Foo'), 2 => new ChoiceView($entity2, '2', 'Bar')), $field->createView()->vars['choices']);
@ -165,7 +165,7 @@ class EntityTypeTest extends TypeTestCase
'class' => self::SINGLE_IDENT_CLASS, 'class' => self::SINGLE_IDENT_CLASS,
'required' => false, 'required' => false,
'property' => 'name', 'property' => 'name',
'query_builder' => $qb 'query_builder' => $qb,
)); ));
$this->assertEquals(array(1 => new ChoiceView($entity1, '1', 'Foo'), 2 => new ChoiceView($entity2, '2', 'Bar')), $field->createView()->vars['choices']); $this->assertEquals(array(1 => new ChoiceView($entity1, '1', 'Foo'), 2 => new ChoiceView($entity2, '2', 'Bar')), $field->createView()->vars['choices']);
@ -541,7 +541,7 @@ class EntityTypeTest extends TypeTestCase
$this->assertEquals(array( $this->assertEquals(array(
'Group1' => array(1 => new ChoiceView($item1, '1', 'Foo'), 2 => new ChoiceView($item2, '2', 'Bar')), 'Group1' => array(1 => new ChoiceView($item1, '1', 'Foo'), 2 => new ChoiceView($item2, '2', 'Bar')),
'Group2' => array(3 => new ChoiceView($item3, '3', 'Baz')), 'Group2' => array(3 => new ChoiceView($item3, '3', 'Baz')),
'4' => new ChoiceView($item4, '4', 'Boo!') '4' => new ChoiceView($item4, '4', 'Boo!'),
), $field->createView()->vars['choices']); ), $field->createView()->vars['choices']);
} }
@ -754,7 +754,7 @@ class EntityTypeTest extends TypeTestCase
$this->factory->createNamed('name', 'entity', null, array( $this->factory->createNamed('name', 'entity', null, array(
'class' => self::SINGLE_IDENT_CLASS, 'class' => self::SINGLE_IDENT_CLASS,
'required' => false, 'required' => false,
'property' => 'name' 'property' => 'name',
)); ));
} }

View File

@ -138,5 +138,4 @@ class DbalLoggerTest extends \PHPUnit_Framework_TestCase
'long' => $longString, 'long' => $longString,
)); ));
} }
} }

View File

@ -64,7 +64,7 @@ class UniqueEntityValidator extends ConstraintValidator
$em = $this->registry->getManager($constraint->em); $em = $this->registry->getManager($constraint->em);
if (!$em) { if (!$em) {
throw new ConstraintDefinitionException(sprintf('Object manager "%s" does not exist.', $constraint->em)); throw new ConstraintDefinitionException(sprintf('Object manager "%s" does not exist.', $constraint->em));
} }
} else { } else {
$em = $this->registry->getManagerForClass(get_class($entity)); $em = $this->registry->getManagerForClass(get_class($entity));
@ -101,7 +101,7 @@ class UniqueEntityValidator extends ConstraintValidator
if (count($relatedId) > 1) { if (count($relatedId) > 1) {
throw new ConstraintDefinitionException( throw new ConstraintDefinitionException(
"Associated entities are not allowed to have more than one identifier field to be " . "Associated entities are not allowed to have more than one identifier field to be ".
"part of a unique constraint in: ".$class->getName()."#".$fieldName "part of a unique constraint in: ".$class->getName()."#".$fieldName
); );
} }

View File

@ -43,7 +43,6 @@ class ChromePhpHandler extends BaseChromePhpHandler
} }
if (!preg_match('{\bChrome/\d+[\.\d+]*\b}', $event->getRequest()->headers->get('User-Agent'))) { if (!preg_match('{\bChrome/\d+[\.\d+]*\b}', $event->getRequest()->headers->get('User-Agent'))) {
$this->sendHeaders = false; $this->sendHeaders = false;
$this->headers = array(); $this->headers = array();

View File

@ -44,7 +44,6 @@ class FirePHPHandler extends BaseFirePHPHandler
if (!preg_match('{\bFirePHP/\d+\.\d+\b}', $event->getRequest()->headers->get('User-Agent')) if (!preg_match('{\bFirePHP/\d+\.\d+\b}', $event->getRequest()->headers->get('User-Agent'))
&& !$event->getRequest()->headers->has('X-FirePHP-Version')) { && !$event->getRequest()->headers->has('X-FirePHP-Version')) {
$this->sendHeaders = false; $this->sendHeaders = false;
$this->headers = array(); $this->headers = array();

View File

@ -32,7 +32,7 @@ class WebProcessorTest extends \PHPUnit_Framework_TestCase
'REMOTE_ADDR' => 'B', 'REMOTE_ADDR' => 'B',
'REQUEST_METHOD' => 'C', 'REQUEST_METHOD' => 'C',
'SERVER_NAME' => 'D', 'SERVER_NAME' => 'D',
'HTTP_REFERER' => 'E' 'HTTP_REFERER' => 'E',
); );
$request = new Request(); $request = new Request();

View File

@ -22,7 +22,6 @@ use Symfony\Component\Form\FormEvent;
*/ */
class TranslationCollectionFormListener implements EventSubscriberInterface class TranslationCollectionFormListener implements EventSubscriberInterface
{ {
private $i18nClass; private $i18nClass;
private $languages; private $languages;

View File

@ -70,7 +70,7 @@ class TranslationFormListener implements EventSubscriberInterface
$customOptions = $options['options']; $customOptions = $options['options'];
} }
$options = array( $options = array(
'label' => $label.' '.strtoupper($data->getLocale()) 'label' => $label.' '.strtoupper($data->getLocale()),
); );
$options = array_merge($options, $customOptions); $options = array_merge($options, $customOptions);

View File

@ -26,7 +26,7 @@ class PropelExtension extends AbstractExtension
return array( return array(
new Type\ModelType(PropertyAccess::createPropertyAccessor()), new Type\ModelType(PropertyAccess::createPropertyAccessor()),
new Type\TranslationCollectionType(), new Type\TranslationCollectionType(),
new Type\TranslationType() new Type\TranslationType(),
); );
} }

View File

@ -59,7 +59,7 @@ class TranslationCollectionType extends AbstractType
public function setDefaultOptions(OptionsResolverInterface $resolver) public function setDefaultOptions(OptionsResolverInterface $resolver)
{ {
$resolver->setRequired(array( $resolver->setRequired(array(
'languages' 'languages',
)); ));
$resolver->setDefaults(array( $resolver->setDefaults(array(
@ -68,8 +68,8 @@ class TranslationCollectionType extends AbstractType
'allow_delete' => false, 'allow_delete' => false,
'options' => array( 'options' => array(
'data_class' => null, 'data_class' => null,
'columns' => null 'columns' => null,
) ),
)); ));
} }
} }

View File

@ -48,7 +48,7 @@ class TranslationType extends AbstractType
{ {
$resolver->setRequired(array( $resolver->setRequired(array(
'data_class', 'data_class',
'columns' 'columns',
)); ));
} }
} }

View File

@ -47,9 +47,9 @@ class PropelDataCollectorTest extends Propel1TestCase
array( array(
'sql' => "SET NAMES 'utf8'", 'sql' => "SET NAMES 'utf8'",
'time' => '0.000 sec', 'time' => '0.000 sec',
'connection'=> 'default', 'connection' => 'default',
'memory' => '1.4 MB' 'memory' => '1.4 MB',
) ),
), $c->getQueries()); ), $c->getQueries());
$this->assertEquals(1, $c->getQueryCount()); $this->assertEquals(1, $c->getQueryCount());
} }
@ -69,20 +69,20 @@ class PropelDataCollectorTest extends Propel1TestCase
array( array(
'sql' => "SET NAMES 'utf8'", 'sql' => "SET NAMES 'utf8'",
'time' => '0.000 sec', 'time' => '0.000 sec',
'connection'=> 'default', 'connection' => 'default',
'memory' => '1.4 MB' 'memory' => '1.4 MB',
), ),
array( array(
'sql' => "SELECT tags.NAME, image.FILENAME FROM tags LEFT JOIN image ON tags.IMAGEID = image.ID WHERE image.ID = 12", 'sql' => "SELECT tags.NAME, image.FILENAME FROM tags LEFT JOIN image ON tags.IMAGEID = image.ID WHERE image.ID = 12",
'time' => '0.012 sec', 'time' => '0.012 sec',
'connection'=> 'default', 'connection' => 'default',
'memory' => '2.4 MB' 'memory' => '2.4 MB',
), ),
array( array(
'sql' => "INSERT INTO `table` (`some_array`) VALUES ('| 1 | 2 | 3 |')", 'sql' => "INSERT INTO `table` (`some_array`) VALUES ('| 1 | 2 | 3 |')",
'time' => '0.012 sec', 'time' => '0.012 sec',
'connection'=> 'default', 'connection' => 'default',
'memory' => '2.4 MB' 'memory' => '2.4 MB',
), ),
), $c->getQueries()); ), $c->getQueries());
$this->assertEquals(3, $c->getQueryCount()); $this->assertEquals(3, $c->getQueryCount());

View File

@ -96,7 +96,7 @@ class ItemQuery
return array( return array(
$mainAuthorRelation, $mainAuthorRelation,
$authorRelation, $authorRelation,
$resellerRelation $resellerRelation,
); );
} }
} }

View File

@ -94,7 +94,6 @@ class TranslatableItemI18n implements \Persistent
public function setLocale($locale) public function setLocale($locale)
{ {
$this->locale = $locale; $this->locale = $locale;
} }
@ -115,7 +114,6 @@ class TranslatableItemI18n implements \Persistent
public function setValue($value) public function setValue($value)
{ {
$this->value = $value; $this->value = $value;
} }
@ -126,7 +124,6 @@ class TranslatableItemI18n implements \Persistent
public function setValue2($value2) public function setValue2($value2)
{ {
$this->value2 = $value2; $this->value2 = $value2;
} }

View File

@ -97,7 +97,7 @@ class ModelChoiceListTest extends Propel1TestCase
null, null,
null, null,
array( array(
$item1 $item1,
) )
); );
@ -122,7 +122,7 @@ class ModelChoiceListTest extends Propel1TestCase
$this->assertSame(array(1 => $item1, 2 => $item2), $choiceList->getChoices()); $this->assertSame(array(1 => $item1, 2 => $item2), $choiceList->getChoices());
$this->assertEquals(array( $this->assertEquals(array(
'group1' => array(1 => new ChoiceView($item1, '1', 'Foo')), 'group1' => array(1 => new ChoiceView($item1, '1', 'Foo')),
'group2' => array(2 => new ChoiceView($item2, '2', 'Bar')) 'group2' => array(2 => new ChoiceView($item2, '2', 'Bar')),
), $choiceList->getRemainingViews()); ), $choiceList->getRemainingViews());
} }
@ -150,7 +150,7 @@ class ModelChoiceListTest extends Propel1TestCase
$this->assertEquals(array( $this->assertEquals(array(
'Group1' => array(1 => new ChoiceView($item1, '1', 'Foo'), 2 => new ChoiceView($item2, '2', 'Bar')), 'Group1' => array(1 => new ChoiceView($item1, '1', 'Foo'), 2 => new ChoiceView($item2, '2', 'Bar')),
'Group2' => array(3 => new ChoiceView($item3, '3', 'Baz')), 'Group2' => array(3 => new ChoiceView($item3, '3', 'Baz')),
4 => new ChoiceView($item4, '4', 'Boo!') 4 => new ChoiceView($item4, '4', 'Boo!'),
), $choiceList->getRemainingViews()); ), $choiceList->getRemainingViews());
} }
@ -172,7 +172,7 @@ class ModelChoiceListTest extends Propel1TestCase
$this->assertEquals(array( $this->assertEquals(array(
1 => $item1, 1 => $item1,
2 => $item2 2 => $item2,
), $choiceList->getChoices()); ), $choiceList->getChoices());
} }

View File

@ -108,4 +108,6 @@ class CollectionToArrayTransformerTest extends Propel1TestCase
} }
} }
class DummyObject {} class DummyObject
{
}

View File

@ -42,15 +42,15 @@ class TranslationCollectionTypeTest extends TypeTestCase
$item->addTranslatableItemI18n(new TranslatableItemI18n(2, 'en', 'val2')); $item->addTranslatableItemI18n(new TranslatableItemI18n(2, 'en', 'val2'));
$builder = $this->factory->createBuilder('form', null, array( $builder = $this->factory->createBuilder('form', null, array(
'data_class' => self::TRANSLATION_CLASS 'data_class' => self::TRANSLATION_CLASS,
)); ));
$builder->add('translatableItemI18ns', 'propel1_translation_collection', array( $builder->add('translatableItemI18ns', 'propel1_translation_collection', array(
'languages' => array('en', 'fr'), 'languages' => array('en', 'fr'),
'options' => array( 'options' => array(
'data_class' => self::TRANSLATABLE_I18N_CLASS, 'data_class' => self::TRANSLATABLE_I18N_CLASS,
'columns' => array('value', 'value2' => array('label' => 'Label', 'type' => 'textarea')) 'columns' => array('value', 'value2' => array('label' => 'Label', 'type' => 'textarea')),
) ),
)); ));
$form = $builder->getForm(); $form = $builder->getForm();
$form->setData($item); $form->setData($item);
@ -79,14 +79,14 @@ class TranslationCollectionTypeTest extends TypeTestCase
$this->assertCount(0, $item->getTranslatableItemI18ns()); $this->assertCount(0, $item->getTranslatableItemI18ns());
$builder = $this->factory->createBuilder('form', null, array( $builder = $this->factory->createBuilder('form', null, array(
'data_class' => self::TRANSLATION_CLASS 'data_class' => self::TRANSLATION_CLASS,
)); ));
$builder->add('translatableItemI18ns', 'propel1_translation_collection', array( $builder->add('translatableItemI18ns', 'propel1_translation_collection', array(
'languages' => array('en', 'fr'), 'languages' => array('en', 'fr'),
'options' => array( 'options' => array(
'data_class' => self::TRANSLATABLE_I18N_CLASS, 'data_class' => self::TRANSLATABLE_I18N_CLASS,
'columns' => array('value', 'value2' => array('label' => 'Label', 'type' => 'textarea')) 'columns' => array('value', 'value2' => array('label' => 'Label', 'type' => 'textarea')),
) ),
)); ));
$form = $builder->getForm(); $form = $builder->getForm();
@ -103,14 +103,14 @@ class TranslationCollectionTypeTest extends TypeTestCase
$item = new Item(null, 'val'); $item = new Item(null, 'val');
$builder = $this->factory->createBuilder('form', null, array( $builder = $this->factory->createBuilder('form', null, array(
'data_class' => self::NON_TRANSLATION_CLASS 'data_class' => self::NON_TRANSLATION_CLASS,
)); ));
$builder->add('value', 'propel1_translation_collection', array( $builder->add('value', 'propel1_translation_collection', array(
'languages' => array('en', 'fr'), 'languages' => array('en', 'fr'),
'options' => array( 'options' => array(
'data_class' => self::TRANSLATABLE_I18N_CLASS, 'data_class' => self::TRANSLATABLE_I18N_CLASS,
'columns' => array('value', 'value2' => array('label' => 'Label', 'type' => 'textarea')) 'columns' => array('value', 'value2' => array('label' => 'Label', 'type' => 'textarea')),
) ),
)); ));
$form = $builder->getForm(); $form = $builder->getForm();
@ -125,8 +125,8 @@ class TranslationCollectionTypeTest extends TypeTestCase
$this->factory->createNamed('itemI18ns', 'propel1_translation_collection', null, array( $this->factory->createNamed('itemI18ns', 'propel1_translation_collection', null, array(
'languages' => array('en', 'fr'), 'languages' => array('en', 'fr'),
'options' => array( 'options' => array(
'columns' => array('value', 'value2') 'columns' => array('value', 'value2'),
) ),
)); ));
} }
@ -138,8 +138,8 @@ class TranslationCollectionTypeTest extends TypeTestCase
$this->factory->createNamed('itemI18ns', 'propel1_translation_collection', null, array( $this->factory->createNamed('itemI18ns', 'propel1_translation_collection', null, array(
'options' => array( 'options' => array(
'data_class' => self::TRANSLATABLE_I18N_CLASS, 'data_class' => self::TRANSLATABLE_I18N_CLASS,
'columns' => array('value', 'value2') 'columns' => array('value', 'value2'),
) ),
)); ));
} }
@ -151,8 +151,8 @@ class TranslationCollectionTypeTest extends TypeTestCase
$this->factory->createNamed('itemI18ns', 'propel1_translation_collection', null, array( $this->factory->createNamed('itemI18ns', 'propel1_translation_collection', null, array(
'languages' => array('en', 'fr'), 'languages' => array('en', 'fr'),
'options' => array( 'options' => array(
'data_class' => self::TRANSLATABLE_I18N_CLASS 'data_class' => self::TRANSLATABLE_I18N_CLASS,
) ),
)); ));
} }
} }

View File

@ -11,7 +11,7 @@
namespace Symfony\Bridge\ProxyManager\Tests\LazyProxy; namespace Symfony\Bridge\ProxyManager\Tests\LazyProxy;
require_once __DIR__ . '/Fixtures/includes/foo.php'; require_once __DIR__.'/Fixtures/includes/foo.php';
use Symfony\Bridge\ProxyManager\LazyProxy\Instantiator\RuntimeInstantiator; use Symfony\Bridge\ProxyManager\LazyProxy\Instantiator\RuntimeInstantiator;
use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\ContainerBuilder;

View File

@ -65,7 +65,6 @@ class LazyServiceProjectServiceContainer extends Container
class stdClass_c1d194250ee2e2b7d2eab8b8212368a8 extends \stdClass implements \ProxyManager\Proxy\LazyLoadingInterface, \ProxyManager\Proxy\ValueHolderInterface class stdClass_c1d194250ee2e2b7d2eab8b8212368a8 extends \stdClass implements \ProxyManager\Proxy\LazyLoadingInterface, \ProxyManager\Proxy\ValueHolderInterface
{ {
/** /**
* @var \Closure|null initializer responsible for generating the wrapped object * @var \Closure|null initializer responsible for generating the wrapped object
*/ */
@ -193,5 +192,4 @@ class stdClass_c1d194250ee2e2b7d2eab8b8212368a8 extends \stdClass implements \Pr
{ {
return $this->valueHolder5157dd96e88c0; return $this->valueHolder5157dd96e88c0;
} }
} }

View File

@ -57,7 +57,7 @@ class ProxyDumperTest extends \PHPUnit_Framework_TestCase
$this->assertStringMatchesFormat( $this->assertStringMatchesFormat(
'%Aclass SymfonyBridgeProxyManagerTestsLazyProxyPhpDumperProxyDumperTest%aextends%w' '%Aclass SymfonyBridgeProxyManagerTestsLazyProxyPhpDumperProxyDumperTest%aextends%w'
. '\Symfony\Bridge\ProxyManager\Tests\LazyProxy\PhpDumper\ProxyDumperTest%a', .'\Symfony\Bridge\ProxyManager\Tests\LazyProxy\PhpDumper\ProxyDumperTest%a',
$code $code
); );
} }
@ -72,10 +72,10 @@ class ProxyDumperTest extends \PHPUnit_Framework_TestCase
$this->assertStringMatchesFormat( $this->assertStringMatchesFormat(
'%wif ($lazyLoad) {%w$container = $this;%wreturn $this->services[\'foo\'] = new ' '%wif ($lazyLoad) {%w$container = $this;%wreturn $this->services[\'foo\'] = new '
. 'SymfonyBridgeProxyManagerTestsLazyProxyPhpDumperProxyDumperTest_%s(%wfunction ' .'SymfonyBridgeProxyManagerTestsLazyProxyPhpDumperProxyDumperTest_%s(%wfunction '
. '(&$wrappedInstance, \ProxyManager\Proxy\LazyLoadingInterface $proxy) use ($container) {' .'(&$wrappedInstance, \ProxyManager\Proxy\LazyLoadingInterface $proxy) use ($container) {'
. '%w$wrappedInstance = $container->getFooService(false);%w$proxy->setProxyInitializer(null);' .'%w$wrappedInstance = $container->getFooService(false);%w$proxy->setProxyInitializer(null);'
. '%wreturn true;%w}%w);%w}%w', .'%wreturn true;%w}%w);%w}%w',
$code $code
); );
} }
@ -88,7 +88,7 @@ class ProxyDumperTest extends \PHPUnit_Framework_TestCase
$definitions = array( $definitions = array(
array(new Definition(__CLASS__), true), array(new Definition(__CLASS__), true),
array(new Definition('stdClass'), true), array(new Definition('stdClass'), true),
array(new Definition('foo' . uniqid()), false), array(new Definition('foo'.uniqid()), false),
array(new Definition(), false), array(new Definition(), false),
); );

View File

@ -35,6 +35,5 @@ class FormThemeNode extends \Twig_Node
->raw(', ') ->raw(', ')
->subcompile($this->getNode('resources')) ->subcompile($this->getNode('resources'))
->raw(");\n"); ->raw(");\n");
;
} }
} }

View File

@ -29,7 +29,7 @@ class RenderBlockNode extends \Twig_Node_Expression_Function
if (isset($arguments[0])) { if (isset($arguments[0])) {
$compiler->subcompile($arguments[0]); $compiler->subcompile($arguments[0]);
$compiler->raw(', \'' . $this->getAttribute('name') . '\''); $compiler->raw(', \''.$this->getAttribute('name').'\'');
if (isset($arguments[1])) { if (isset($arguments[1])) {
$compiler->raw(', '); $compiler->raw(', ');

View File

@ -53,7 +53,7 @@ class CodeExtensionTest extends \PHPUnit_Framework_TestCase
array('F\Q\N\Foo::Method', '<abbr title="F\Q\N\Foo">Foo</abbr>::Method()'), array('F\Q\N\Foo::Method', '<abbr title="F\Q\N\Foo">Foo</abbr>::Method()'),
array('Bare::Method', '<abbr title="Bare">Bare</abbr>::Method()'), array('Bare::Method', '<abbr title="Bare">Bare</abbr>::Method()'),
array('Closure', '<abbr title="Closure">Closure</abbr>'), array('Closure', '<abbr title="Closure">Closure</abbr>'),
array('Method', '<abbr title="Method">Method</abbr>()') array('Method', '<abbr title="Method">Method</abbr>()'),
); );
} }

View File

@ -210,14 +210,14 @@ class FormExtensionDivLayoutTest extends AbstractDivLayoutTest
public static function themeBlockInheritanceProvider() public static function themeBlockInheritanceProvider()
{ {
return array( return array(
array(array('theme.html.twig')) array(array('theme.html.twig')),
); );
} }
public static function themeInheritanceProvider() public static function themeInheritanceProvider()
{ {
return array( return array(
array(array('parent_label.html.twig'), array('child_label.html.twig')) array(array('parent_label.html.twig'), array('child_label.html.twig')),
); );
} }
} }

View File

@ -101,17 +101,17 @@ class TranslationExtensionTest extends TestCase
// transchoice // transchoice
array('{% transchoice count from "messages" %}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples{% endtranschoice %}', array('{% transchoice count from "messages" %}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples{% endtranschoice %}',
'There is no apples', array('count' => 0)), 'There is no apples', array('count' => 0),),
array('{% transchoice count %}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples{% endtranschoice %}', array('{% transchoice count %}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples{% endtranschoice %}',
'There is 5 apples', array('count' => 5)), 'There is 5 apples', array('count' => 5),),
array('{% transchoice count %}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples (%name%){% endtranschoice %}', array('{% transchoice count %}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples (%name%){% endtranschoice %}',
'There is 5 apples (Symfony2)', array('count' => 5, 'name' => 'Symfony2')), 'There is 5 apples (Symfony2)', array('count' => 5, 'name' => 'Symfony2'),),
array('{% transchoice count with { \'%name%\': \'Symfony2\' } %}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples (%name%){% endtranschoice %}', array('{% transchoice count with { \'%name%\': \'Symfony2\' } %}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples (%name%){% endtranschoice %}',
'There is 5 apples (Symfony2)', array('count' => 5)), 'There is 5 apples (Symfony2)', array('count' => 5),),
array('{% transchoice count into "fr"%}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples{% endtranschoice %}', array('{% transchoice count into "fr"%}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples{% endtranschoice %}',
'There is no apples', array('count' => 0)), 'There is no apples', array('count' => 0),),
array('{% transchoice 5 into "fr"%}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples{% endtranschoice %}', array('{% transchoice 5 into "fr"%}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples{% endtranschoice %}',
'There is 5 apples'), 'There is 5 apples',),
// trans filter // trans filter
array('{{ "Hello"|trans }}', 'Hello'), array('{{ "Hello"|trans }}', 'Hello'),

View File

@ -21,7 +21,7 @@ class FormThemeTest extends TestCase
$form = new \Twig_Node_Expression_Name('form', 0); $form = new \Twig_Node_Expression_Name('form', 0);
$resources = new \Twig_Node(array( $resources = new \Twig_Node(array(
new \Twig_Node_Expression_Constant('tpl1', 0), new \Twig_Node_Expression_Constant('tpl1', 0),
new \Twig_Node_Expression_Constant('tpl2', 0) new \Twig_Node_Expression_Constant('tpl2', 0),
)); ));
$node = new FormThemeNode($form, $resources, 0); $node = new FormThemeNode($form, $resources, 0);
@ -37,7 +37,7 @@ class FormThemeTest extends TestCase
new \Twig_Node_Expression_Constant(0, 0), new \Twig_Node_Expression_Constant(0, 0),
new \Twig_Node_Expression_Constant('tpl1', 0), new \Twig_Node_Expression_Constant('tpl1', 0),
new \Twig_Node_Expression_Constant(1, 0), new \Twig_Node_Expression_Constant(1, 0),
new \Twig_Node_Expression_Constant('tpl2', 0) new \Twig_Node_Expression_Constant('tpl2', 0),
), 0); ), 0);
$node = new FormThemeNode($form, $resources, 0); $node = new FormThemeNode($form, $resources, 0);

View File

@ -43,7 +43,7 @@ class FormThemeTokenParserTest extends TestCase
), 1), ), 1),
1, 1,
'form_theme' 'form_theme'
) ),
), ),
array( array(
'{% form_theme form "tpl1" "tpl2" %}', '{% form_theme form "tpl1" "tpl2" %}',
@ -53,11 +53,11 @@ class FormThemeTokenParserTest extends TestCase
new \Twig_Node_Expression_Constant(0, 1), new \Twig_Node_Expression_Constant(0, 1),
new \Twig_Node_Expression_Constant('tpl1', 1), new \Twig_Node_Expression_Constant('tpl1', 1),
new \Twig_Node_Expression_Constant(1, 1), new \Twig_Node_Expression_Constant(1, 1),
new \Twig_Node_Expression_Constant('tpl2', 1) new \Twig_Node_Expression_Constant('tpl2', 1),
), 1), ), 1),
1, 1,
'form_theme' 'form_theme'
) ),
), ),
array( array(
'{% form_theme form with "tpl1" %}', '{% form_theme form with "tpl1" %}',
@ -66,7 +66,7 @@ class FormThemeTokenParserTest extends TestCase
new \Twig_Node_Expression_Constant('tpl1', 1), new \Twig_Node_Expression_Constant('tpl1', 1),
1, 1,
'form_theme' 'form_theme'
) ),
), ),
array( array(
'{% form_theme form with ["tpl1"] %}', '{% form_theme form with ["tpl1"] %}',
@ -78,7 +78,7 @@ class FormThemeTokenParserTest extends TestCase
), 1), ), 1),
1, 1,
'form_theme' 'form_theme'
) ),
), ),
array( array(
'{% form_theme form with ["tpl1", "tpl2"] %}', '{% form_theme form with ["tpl1", "tpl2"] %}',
@ -88,11 +88,11 @@ class FormThemeTokenParserTest extends TestCase
new \Twig_Node_Expression_Constant(0, 1), new \Twig_Node_Expression_Constant(0, 1),
new \Twig_Node_Expression_Constant('tpl1', 1), new \Twig_Node_Expression_Constant('tpl1', 1),
new \Twig_Node_Expression_Constant(1, 1), new \Twig_Node_Expression_Constant(1, 1),
new \Twig_Node_Expression_Constant('tpl2', 1) new \Twig_Node_Expression_Constant('tpl2', 1),
), 1), ), 1),
1, 1,
'form_theme' 'form_theme'
) ),
), ),
); );
} }

View File

@ -32,7 +32,7 @@ class ConfigDumpReferenceCommand extends ContainerDebugCommand
$this $this
->setName('config:dump-reference') ->setName('config:dump-reference')
->setDefinition(array( ->setDefinition(array(
new InputArgument('name', InputArgument::OPTIONAL, 'The Bundle or extension alias') new InputArgument('name', InputArgument::OPTIONAL, 'The Bundle or extension alias'),
)) ))
->setDescription('Dumps default configuration for an extension') ->setDescription('Dumps default configuration for an extension')
->setHelp(<<<EOF ->setHelp(<<<EOF

View File

@ -46,7 +46,7 @@ class ContainerDebugCommand extends ContainerAwareCommand
new InputOption('tag', null, InputOption::VALUE_REQUIRED, 'Show all services with a specific tag'), new InputOption('tag', null, InputOption::VALUE_REQUIRED, 'Show all services with a specific tag'),
new InputOption('tags', null, InputOption::VALUE_NONE, 'Displays tagged services for an application'), new InputOption('tags', null, InputOption::VALUE_NONE, 'Displays tagged services for an application'),
new InputOption('parameter', null, InputOption::VALUE_REQUIRED, 'Displays a specific parameter for an application'), new InputOption('parameter', null, InputOption::VALUE_REQUIRED, 'Displays a specific parameter for an application'),
new InputOption('parameters', null, InputOption::VALUE_NONE, 'Displays parameters for an application') new InputOption('parameters', null, InputOption::VALUE_NONE, 'Displays parameters for an application'),
)) ))
->setDescription('Displays current services for an application') ->setDescription('Displays current services for an application')
->setHelp(<<<EOF ->setHelp(<<<EOF

View File

@ -55,7 +55,7 @@ class TranslationUpdateCommand extends ContainerAwareCommand
new InputOption( new InputOption(
'clean', null, InputOption::VALUE_NONE, 'clean', null, InputOption::VALUE_NONE,
'Should clean not found messages' 'Should clean not found messages'
) ),
)) ))
->setDescription('Updates the translation file') ->setDescription('Updates the translation file')
->setHelp(<<<EOF ->setHelp(<<<EOF

View File

@ -17,7 +17,6 @@ use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\HttpKernel\Event\GetResponseEvent; use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
/** /**
* Sets the session in the request. * Sets the session in the request.

View File

@ -90,7 +90,7 @@ class Router extends BaseRouter implements WarmableInterface
} }
foreach ($route->getRequirements() as $name => $value) { foreach ($route->getRequirements() as $name => $value) {
$route->setRequirement($name, $this->resolve($value)); $route->setRequirement($name, $this->resolve($value));
} }
$route->setPath($this->resolve($route->getPath())); $route->setPath($this->resolve($route->getPath()));
@ -138,7 +138,7 @@ class Router extends BaseRouter implements WarmableInterface
} }
throw new RuntimeException(sprintf( throw new RuntimeException(sprintf(
'The container parameter "%s", used in the route configuration value "%s", ' . 'The container parameter "%s", used in the route configuration value "%s", '.
'must be a string or numeric, but it is of type %s.', 'must be a string or numeric, but it is of type %s.',
$match[1], $match[1],
$value, $value,

View File

@ -53,5 +53,4 @@ class TemplateFinderTest extends TestCase
$this->assertContains('::this.is.a.template.format.engine', $templates); $this->assertContains('::this.is.a.template.format.engine', $templates);
$this->assertContains('::resource.format.engine', $templates); $this->assertContains('::resource.format.engine', $templates);
} }
} }

View File

@ -60,7 +60,7 @@ class RedirectControllerTest extends TestCase
'route' => $route, 'route' => $route,
'permanent' => $permanent, 'permanent' => $permanent,
'additional-parameter' => 'value', 'additional-parameter' => 'value',
'ignoreAttributes' => $ignoreAttributes 'ignoreAttributes' => $ignoreAttributes,
), ),
); );

View File

@ -23,7 +23,7 @@ class AddCacheWarmerPassTest extends \PHPUnit_Framework_TestCase
$services = array( $services = array(
'my_cache_warmer_service1' => array(0 => array('priority' => 100)), 'my_cache_warmer_service1' => array(0 => array('priority' => 100)),
'my_cache_warmer_service2' => array(0 => array('priority' => 200)), 'my_cache_warmer_service2' => array(0 => array('priority' => 200)),
'my_cache_warmer_service3' => array() 'my_cache_warmer_service3' => array(),
); );
$definition = $this->getMock('Symfony\Component\DependencyInjection\Definition'); $definition = $this->getMock('Symfony\Component\DependencyInjection\Definition');
@ -46,7 +46,7 @@ class AddCacheWarmerPassTest extends \PHPUnit_Framework_TestCase
->with(0, array( ->with(0, array(
new Reference('my_cache_warmer_service2'), new Reference('my_cache_warmer_service2'),
new Reference('my_cache_warmer_service1'), new Reference('my_cache_warmer_service1'),
new Reference('my_cache_warmer_service3') new Reference('my_cache_warmer_service3'),
)); ));
$addCacheWarmerPass = new AddCacheWarmerPass(); $addCacheWarmerPass = new AddCacheWarmerPass();

View File

@ -22,7 +22,6 @@ use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\SerializerPass;
*/ */
class SerializerPassTest extends \PHPUnit_Framework_TestCase class SerializerPassTest extends \PHPUnit_Framework_TestCase
{ {
public function testThrowExceptionWhenNoNormalizers() public function testThrowExceptionWhenNoNormalizers()
{ {
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerBuilder'); $container = $this->getMock('Symfony\Component\DependencyInjection\ContainerBuilder');
@ -72,16 +71,16 @@ class SerializerPassTest extends \PHPUnit_Framework_TestCase
public function testServicesAreOrderedAccordingToPriority() public function testServicesAreOrderedAccordingToPriority()
{ {
$services = array( $services = array(
'n3' => array('tag' => array()), 'n3' => array('tag' => array()),
'n1' => array('tag' => array('priority' => 200)), 'n1' => array('tag' => array('priority' => 200)),
'n2' => array('tag' => array('priority' => 100)) 'n2' => array('tag' => array('priority' => 100)),
); );
$expected = array( $expected = array(
new Reference('n1'), new Reference('n1'),
new Reference('n2'), new Reference('n2'),
new Reference('n3') new Reference('n3'),
); );
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerBuilder'); $container = $this->getMock('Symfony\Component\DependencyInjection\ContainerBuilder');

View File

@ -40,8 +40,6 @@ class TranslatorPassTest extends \PHPUnit_Framework_TestCase
$container->expects($this->once()) $container->expects($this->once())
->method('findDefinition') ->method('findDefinition')
->will($this->returnValue($this->getMock('Symfony\Component\DependencyInjection\Definition'))); ->will($this->returnValue($this->getMock('Symfony\Component\DependencyInjection\Definition')));
;
$pass = new TranslatorPass(); $pass = new TranslatorPass();
$pass->process($container); $pass->process($container);
} }

View File

@ -36,7 +36,7 @@ class ConfigurationTest extends \PHPUnit_Framework_TestCase
$configuration = new Configuration(); $configuration = new Configuration();
$config = $processor->processConfiguration($configuration, array(array( $config = $processor->processConfiguration($configuration, array(array(
'secret' => 's3cr3t', 'secret' => 's3cr3t',
'trusted_proxies' => $trustedProxies 'trusted_proxies' => $trustedProxies,
))); )));
$this->assertEquals($processedProxies, $config['trusted_proxies']); $this->assertEquals($processedProxies, $config['trusted_proxies']);
@ -66,8 +66,8 @@ class ConfigurationTest extends \PHPUnit_Framework_TestCase
$processor->processConfiguration($configuration, array( $processor->processConfiguration($configuration, array(
array( array(
'secret' => 's3cr3t', 'secret' => 's3cr3t',
'trusted_proxies' => 'Not an IP address' 'trusted_proxies' => 'Not an IP address',
) ),
)); ));
} }
@ -81,8 +81,8 @@ class ConfigurationTest extends \PHPUnit_Framework_TestCase
$processor->processConfiguration($configuration, array( $processor->processConfiguration($configuration, array(
array( array(
'secret' => 's3cr3t', 'secret' => 's3cr3t',
'trusted_proxies' => array('Not an IP address') 'trusted_proxies' => array('Not an IP address'),
) ),
)); ));
} }
@ -128,8 +128,8 @@ class ConfigurationTest extends \PHPUnit_Framework_TestCase
'debug' => '%kernel.debug%', 'debug' => '%kernel.debug%',
), ),
'serializer' => array( 'serializer' => array(
'enabled' => false 'enabled' => false,
) ),
); );
} }
} }

View File

@ -13,5 +13,4 @@ namespace Symfony\Bundle\FrameworkBundle\Tests;
class TestBundle extends \Symfony\Component\HttpKernel\Bundle\Bundle class TestBundle extends \Symfony\Component\HttpKernel\Bundle\Bundle
{ {
} }

View File

@ -54,7 +54,7 @@ $container->loadFromExtension('framework', array(
), ),
), ),
'form' => array( 'form' => array(
'resources' => array('theme1', 'theme2') 'resources' => array('theme1', 'theme2'),
), ),
'hinclude_default_template' => 'global_hinclude_template', 'hinclude_default_template' => 'global_hinclude_template',
), ),
@ -71,5 +71,5 @@ $container->loadFromExtension('framework', array(
'debug' => true, 'debug' => true,
'file_cache_dir' => '%kernel.cache_dir%/annotations', 'file_cache_dir' => '%kernel.cache_dir%/annotations',
), ),
'ide' => 'file%%link%%format' 'ide' => 'file%%link%%format',
)); ));

View File

@ -185,19 +185,19 @@ abstract class FrameworkExtensionTest extends TestCase
$files = array_map(function ($resource) { return realpath($resource[1]); }, $resources); $files = array_map(function ($resource) { return realpath($resource[1]); }, $resources);
$ref = new \ReflectionClass('Symfony\Component\Validator\Validator'); $ref = new \ReflectionClass('Symfony\Component\Validator\Validator');
$this->assertContains( $this->assertContains(
strtr(dirname($ref->getFileName()) . '/Resources/translations/validators.en.xlf', '/', DIRECTORY_SEPARATOR), strtr(dirname($ref->getFileName()).'/Resources/translations/validators.en.xlf', '/', DIRECTORY_SEPARATOR),
$files, $files,
'->registerTranslatorConfiguration() finds Validator translation resources' '->registerTranslatorConfiguration() finds Validator translation resources'
); );
$ref = new \ReflectionClass('Symfony\Component\Form\Form'); $ref = new \ReflectionClass('Symfony\Component\Form\Form');
$this->assertContains( $this->assertContains(
strtr(dirname($ref->getFileName()) . '/Resources/translations/validators.en.xlf', '/', DIRECTORY_SEPARATOR), strtr(dirname($ref->getFileName()).'/Resources/translations/validators.en.xlf', '/', DIRECTORY_SEPARATOR),
$files, $files,
'->registerTranslatorConfiguration() finds Form translation resources' '->registerTranslatorConfiguration() finds Form translation resources'
); );
$ref = new \ReflectionClass('Symfony\Component\Security\Core\SecurityContext'); $ref = new \ReflectionClass('Symfony\Component\Security\Core\SecurityContext');
$this->assertContains( $this->assertContains(
strtr(dirname(dirname($ref->getFileName())) . '/Resources/translations/security.en.xlf', '/', DIRECTORY_SEPARATOR), strtr(dirname(dirname($ref->getFileName())).'/Resources/translations/security.en.xlf', '/', DIRECTORY_SEPARATOR),
$files, $files,
'->registerTranslatorConfiguration() finds Security translation resources' '->registerTranslatorConfiguration() finds Security translation resources'
); );

View File

@ -17,7 +17,7 @@ use Symfony\Component\DependencyInjection\ContainerAware;
class SessionController extends ContainerAware class SessionController extends ContainerAware
{ {
public function welcomeAction($name=null) public function welcomeAction($name = null)
{ {
$request = $this->container->get('request'); $request = $this->container->get('request');
$session = $request->getSession(); $session = $request->getSession();

View File

@ -24,7 +24,7 @@ class RouterTest extends \PHPUnit_Framework_TestCase
$routes->add('foo', new Route( $routes->add('foo', new Route(
' /{_locale}', ' /{_locale}',
array( array(
'_locale' => '%locale%' '_locale' => '%locale%',
), ),
array( array(
'_locale' => 'en|es', '_locale' => 'en|es',

View File

@ -125,14 +125,14 @@ class FormHelperDivLayoutTest extends AbstractDivLayoutTest
public static function themeBlockInheritanceProvider() public static function themeBlockInheritanceProvider()
{ {
return array( return array(
array(array('TestBundle:Parent')) array(array('TestBundle:Parent')),
); );
} }
public static function themeInheritanceProvider() public static function themeInheritanceProvider()
{ {
return array( return array(
array(array('TestBundle:Parent'), array('TestBundle:Child')) array(array('TestBundle:Parent'), array('TestBundle:Child')),
); );
} }
} }

View File

@ -183,7 +183,6 @@ class TranslatorTest extends \PHPUnit_Framework_TestCase
$this->assertSame('en-US', $translator->getLocale()); $this->assertSame('en-US', $translator->getLocale());
} }
protected function getCatalogue($locale, $messages) protected function getCatalogue($locale, $messages)
{ {
$catalogue = new MessageCatalogue($locale); $catalogue = new MessageCatalogue($locale);

View File

@ -96,7 +96,7 @@ class PhpStringTokenParser
public static function parseEscapeSequences($str, $quote) public static function parseEscapeSequences($str, $quote)
{ {
if (null !== $quote) { if (null !== $quote) {
$str = str_replace('\\' . $quote, $quote, $str); $str = str_replace('\\'.$quote, $quote, $str);
} }
return preg_replace_callback( return preg_replace_callback(

View File

@ -309,11 +309,11 @@ class MainConfiguration implements ConfigurationInterface
'memory' => array( 'memory' => array(
'users' => array( 'users' => array(
'foo' => array('password' => 'foo', 'roles' => 'ROLE_USER'), 'foo' => array('password' => 'foo', 'roles' => 'ROLE_USER'),
'bar' => array('password' => 'bar', 'roles' => '[ROLE_USER, ROLE_ADMIN]') 'bar' => array('password' => 'bar', 'roles' => '[ROLE_USER, ROLE_ADMIN]'),
), ),
) ),
), ),
'my_entity_provider' => array('entity' => array('class' => 'SecurityBundle:User', 'property' => 'username')) 'my_entity_provider' => array('entity' => array('class' => 'SecurityBundle:User', 'property' => 'username')),
)) ))
->disallowNewKeysInSubsequentConfigs() ->disallowNewKeysInSubsequentConfigs()
->isRequired() ->isRequired()
@ -370,8 +370,8 @@ class MainConfiguration implements ConfigurationInterface
'Acme\DemoBundle\Entity\User2' => array( 'Acme\DemoBundle\Entity\User2' => array(
'algorithm' => 'sha512', 'algorithm' => 'sha512',
'encode_as_base64' => 'true', 'encode_as_base64' => 'true',
'iterations'=> 5000 'iterations' => 5000,
) ),
)) ))
->requiresAtLeastOneElement() ->requiresAtLeastOneElement()
->useAttributeAsKey('class') ->useAttributeAsKey('class')

View File

@ -61,7 +61,7 @@ class RememberMeFactory implements SecurityFactoryInterface
if (isset($config['token_provider'])) { if (isset($config['token_provider'])) {
$rememberMeServices->addMethodCall('setTokenProvider', array( $rememberMeServices->addMethodCall('setTokenProvider', array(
new Reference($config['token_provider']) new Reference($config['token_provider']),
)); ));
} }

View File

@ -136,7 +136,7 @@ class SecurityExtension extends Extension
->addTag('doctrine.event_listener', array( ->addTag('doctrine.event_listener', array(
'connection' => $config['connection'], 'connection' => $config['connection'],
'event' => 'postGenerateSchema', 'event' => 'postGenerateSchema',
'lazy' => true 'lazy' => true,
)) ))
; ;

View File

@ -5,5 +5,5 @@ $this->load('container1.php', $container);
$container->loadFromExtension('security', array( $container->loadFromExtension('security', array(
'acl' => array( 'acl' => array(
'provider' => 'foo', 'provider' => 'foo',
) ),
)); ));

View File

@ -16,5 +16,5 @@ $container->loadFromExtension('security', array(
'role_hierarchy' => array( 'role_hierarchy' => array(
'FOO' => array('MOO'), 'FOO' => array('MOO'),
) ),
)); ));

View File

@ -5,8 +5,8 @@ $container->loadFromExtension('security', array(
'main' => array( 'main' => array(
'form_login' => array( 'form_login' => array(
'login_path' => '/login', 'login_path' => '/login',
) ),
) ),
), ),
'role_hierarchy' => array( 'role_hierarchy' => array(
'FOO' => 'BAR', 'FOO' => 'BAR',

View File

@ -35,9 +35,9 @@ class SecurityExtensionTest extends \PHPUnit_Framework_TestCase
'pattern' => '/secured_area/.*', 'pattern' => '/secured_area/.*',
'form_login' => array( 'form_login' => array(
'check_path' => '/some_area/login_check', 'check_path' => '/some_area/login_check',
) ),
) ),
) ),
)); ));
$container->compile(); $container->compile();
@ -59,8 +59,8 @@ class SecurityExtensionTest extends \PHPUnit_Framework_TestCase
'firewalls' => array( 'firewalls' => array(
'some_firewall' => array( 'some_firewall' => array(
'pattern' => '/.*', 'pattern' => '/.*',
) ),
) ),
)); ));
$container->compile(); $container->compile();

View File

@ -42,7 +42,7 @@ class TwigExtension extends Extension
if (is_array($value) && isset($value['key'])) { if (is_array($value) && isset($value['key'])) {
$config['globals'][$name] = array( $config['globals'][$name] = array(
'key' => $name, 'key' => $name,
'value' => $config['globals'][$name] 'value' => $config['globals'][$name],
); );
} }
} }

View File

@ -4,7 +4,7 @@ $container->loadFromExtension('twig', array(
'form' => array( 'form' => array(
'resources' => array( 'resources' => array(
'MyBundle::form.html.twig', 'MyBundle::form.html.twig',
) ),
), ),
'globals' => array( 'globals' => array(
'foo' => '@bar', 'foo' => '@bar',

View File

@ -40,7 +40,7 @@ class RenderTokenParserTest extends TestCase
new \Twig_Node_Expression_Array(array(), 1), new \Twig_Node_Expression_Array(array(), 1),
1, 1,
'render' 'render'
) ),
), ),
array( array(
'{% render "foo", {foo: 1} %}', '{% render "foo", {foo: 1} %}',
@ -52,7 +52,7 @@ class RenderTokenParserTest extends TestCase
), 1), ), 1),
1, 1,
'render' 'render'
) ),
), ),
); );
} }

View File

@ -148,7 +148,7 @@ class ProfilerController
$this->profiler->disable(); $this->profiler->disable();
return new Response($this->twig->render('@WebProfiler/Profiler/info.html.twig', array( return new Response($this->twig->render('@WebProfiler/Profiler/info.html.twig', array(
'about' => $about 'about' => $about,
)), 200, array('Content-Type' => 'text/html')); )), 200, array('Content-Type' => 'text/html'));
} }

View File

@ -13,7 +13,6 @@ namespace Symfony\Bundle\WebProfilerBundle\Tests\Command;
use Symfony\Bundle\WebProfilerBundle\Command\ExportCommand; use Symfony\Bundle\WebProfilerBundle\Command\ExportCommand;
use Symfony\Component\Console\Tester\CommandTester; use Symfony\Component\Console\Tester\CommandTester;
use Symfony\Component\Console\Application;
use Symfony\Component\HttpKernel\Profiler\Profile; use Symfony\Component\HttpKernel\Profiler\Profile;
class ExportCommandTest extends \PHPUnit_Framework_TestCase class ExportCommandTest extends \PHPUnit_Framework_TestCase

View File

@ -13,7 +13,6 @@ namespace Symfony\Bundle\WebProfilerBundle\Tests\Command;
use Symfony\Bundle\WebProfilerBundle\Command\ImportCommand; use Symfony\Bundle\WebProfilerBundle\Command\ImportCommand;
use Symfony\Component\Console\Tester\CommandTester; use Symfony\Component\Console\Tester\CommandTester;
use Symfony\Component\Console\Application;
use Symfony\Component\HttpKernel\Profiler\Profile; use Symfony\Component\HttpKernel\Profiler\Profile;
class ImportCommandTest extends \PHPUnit_Framework_TestCase class ImportCommandTest extends \PHPUnit_Framework_TestCase

View File

@ -48,9 +48,9 @@ class TemplateManagerTest extends TestCase
$profiler = $this->mockProfiler(); $profiler = $this->mockProfiler();
$twigEnvironment = $this->mockTwigEnvironment(); $twigEnvironment = $this->mockTwigEnvironment();
$templates = array( $templates = array(
'data_collector.foo'=>array('foo','FooBundle:Collector:foo'), 'data_collector.foo' => array('foo','FooBundle:Collector:foo'),
'data_collector.bar'=>array('bar','FooBundle:Collector:bar'), 'data_collector.bar' => array('bar','FooBundle:Collector:bar'),
'data_collector.baz'=>array('baz','FooBundle:Collector:baz') 'data_collector.baz' => array('baz','FooBundle:Collector:baz'),
); );
$this->templateManager = new TemplateManager($profiler, $twigEnvironment, $templates); $this->templateManager = new TemplateManager($profiler, $twigEnvironment, $templates);

View File

@ -498,7 +498,7 @@ class ClientTest extends \PHPUnit_Framework_TestCase
'HTTP_HOST' => 'www.example.com:8080', 'HTTP_HOST' => 'www.example.com:8080',
'HTTP_USER_AGENT' => 'Symfony2 BrowserKit', 'HTTP_USER_AGENT' => 'Symfony2 BrowserKit',
'HTTPS' => false, 'HTTPS' => false,
'HTTP_REFERER' => 'http://www.example.com:8080/' 'HTTP_REFERER' => 'http://www.example.com:8080/',
); );
$client = new TestClient(); $client = new TestClient();
@ -636,7 +636,7 @@ class ClientTest extends \PHPUnit_Framework_TestCase
'HTTP_HOST' => 'testhost', 'HTTP_HOST' => 'testhost',
'HTTP_USER_AGENT' => 'testua', 'HTTP_USER_AGENT' => 'testua',
'HTTPS' => false, 'HTTPS' => false,
'NEW_SERVER_KEY' => 'new-server-key-value' 'NEW_SERVER_KEY' => 'new-server-key-value',
)); ));
$this->assertEquals('localhost', $client->getServerParameter('HTTP_HOST')); $this->assertEquals('localhost', $client->getServerParameter('HTTP_HOST'));

View File

@ -61,13 +61,13 @@ class ResponseTest extends \PHPUnit_Framework_TestCase
{ {
$headers = array( $headers = array(
'content-type' => 'text/html; charset=utf-8', 'content-type' => 'text/html; charset=utf-8',
'set-cookie' => array('foo=bar', 'bar=foo') 'set-cookie' => array('foo=bar', 'bar=foo'),
); );
$expected = 'content-type: text/html; charset=utf-8'."\n"; $expected = 'content-type: text/html; charset=utf-8'."\n";
$expected.= 'set-cookie: foo=bar'."\n"; $expected .= 'set-cookie: foo=bar'."\n";
$expected.= 'set-cookie: bar=foo'."\n\n"; $expected .= 'set-cookie: bar=foo'."\n\n";
$expected.= 'foo'; $expected .= 'foo';
$response = new Response('foo', 304, $headers); $response = new Response('foo', 304, $headers);

View File

@ -71,7 +71,6 @@ class ClassMapGenerator
foreach ($classes as $class) { foreach ($classes as $class) {
$map[$class] = $path; $map[$class] = $path;
} }
} }
return $map; return $map;

View File

@ -55,13 +55,13 @@ class ApcUniversalClassLoaderTest extends \PHPUnit_Framework_TestCase
$this->assertTrue(class_exists($className), $message); $this->assertTrue(class_exists($className), $message);
} }
public function getLoadClassTests() public function getLoadClassTests()
{ {
return array( return array(
array('\\Apc\\Namespaced\\Foo', 'Apc\\Namespaced\\Foo', '->loadClass() loads Apc\Namespaced\Foo class'), array('\\Apc\\Namespaced\\Foo', 'Apc\\Namespaced\\Foo', '->loadClass() loads Apc\Namespaced\Foo class'),
array('Apc_Pearlike_Foo', 'Apc_Pearlike_Foo', '->loadClass() loads Apc_Pearlike_Foo class'), array('Apc_Pearlike_Foo', 'Apc_Pearlike_Foo', '->loadClass() loads Apc_Pearlike_Foo class'),
); );
} }
/** /**
* @dataProvider getLoadClassFromFallbackTests * @dataProvider getLoadClassFromFallbackTests
@ -77,15 +77,15 @@ class ApcUniversalClassLoaderTest extends \PHPUnit_Framework_TestCase
$this->assertTrue(class_exists($className), $message); $this->assertTrue(class_exists($className), $message);
} }
public function getLoadClassFromFallbackTests() public function getLoadClassFromFallbackTests()
{ {
return array( return array(
array('\\Apc\\Namespaced\\Baz', 'Apc\\Namespaced\\Baz', '->loadClass() loads Apc\Namespaced\Baz class'), array('\\Apc\\Namespaced\\Baz', 'Apc\\Namespaced\\Baz', '->loadClass() loads Apc\Namespaced\Baz class'),
array('Apc_Pearlike_Baz', 'Apc_Pearlike_Baz', '->loadClass() loads Apc_Pearlike_Baz class'), array('Apc_Pearlike_Baz', 'Apc_Pearlike_Baz', '->loadClass() loads Apc_Pearlike_Baz class'),
array('\\Apc\\Namespaced\\FooBar', 'Apc\\Namespaced\\FooBar', '->loadClass() loads Apc\Namespaced\Baz class from fallback dir'), array('\\Apc\\Namespaced\\FooBar', 'Apc\\Namespaced\\FooBar', '->loadClass() loads Apc\Namespaced\Baz class from fallback dir'),
array('Apc_Pearlike_FooBar', 'Apc_Pearlike_FooBar', '->loadClass() loads Apc_Pearlike_Baz class from fallback dir'), array('Apc_Pearlike_FooBar', 'Apc_Pearlike_FooBar', '->loadClass() loads Apc_Pearlike_Baz class from fallback dir'),
); );
} }
/** /**
* @dataProvider getLoadClassNamespaceCollisionTests * @dataProvider getLoadClassNamespaceCollisionTests
@ -100,9 +100,9 @@ class ApcUniversalClassLoaderTest extends \PHPUnit_Framework_TestCase
$this->assertTrue(class_exists($className), $message); $this->assertTrue(class_exists($className), $message);
} }
public function getLoadClassNamespaceCollisionTests() public function getLoadClassNamespaceCollisionTests()
{ {
return array( return array(
array( array(
array( array(
'Apc\\NamespaceCollision\\A' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/Apc/alpha', 'Apc\\NamespaceCollision\\A' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/Apc/alpha',
@ -136,7 +136,7 @@ class ApcUniversalClassLoaderTest extends \PHPUnit_Framework_TestCase
'->loadClass() loads NamespaceCollision\A\B\Bar from beta.', '->loadClass() loads NamespaceCollision\A\B\Bar from beta.',
), ),
); );
} }
/** /**
* @dataProvider getLoadClassPrefixCollisionTests * @dataProvider getLoadClassPrefixCollisionTests
@ -150,9 +150,9 @@ class ApcUniversalClassLoaderTest extends \PHPUnit_Framework_TestCase
$this->assertTrue(class_exists($className), $message); $this->assertTrue(class_exists($className), $message);
} }
public function getLoadClassPrefixCollisionTests() public function getLoadClassPrefixCollisionTests()
{ {
return array( return array(
array( array(
array( array(
'ApcPrefixCollision_A_' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/Apc/alpha/Apc', 'ApcPrefixCollision_A_' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/Apc/alpha/Apc',
@ -186,5 +186,5 @@ class ApcUniversalClassLoaderTest extends \PHPUnit_Framework_TestCase
'->loadClass() loads ApcPrefixCollision_A_B_Bar from beta.', '->loadClass() loads ApcPrefixCollision_A_B_Bar from beta.',
), ),
); );
} }
} }

View File

@ -76,7 +76,7 @@ class ClassMapGeneratorTest extends \PHPUnit_Framework_TestCase
'Namespaced\\Foo' => realpath(__DIR__).'/Fixtures/Namespaced/Foo.php', 'Namespaced\\Foo' => realpath(__DIR__).'/Fixtures/Namespaced/Foo.php',
'Namespaced\\Baz' => realpath(__DIR__).'/Fixtures/Namespaced/Baz.php', 'Namespaced\\Baz' => realpath(__DIR__).'/Fixtures/Namespaced/Baz.php',
'Namespaced\\WithComments' => realpath(__DIR__).'/Fixtures/Namespaced/WithComments.php', 'Namespaced\\WithComments' => realpath(__DIR__).'/Fixtures/Namespaced/WithComments.php',
) ),
), ),
array(__DIR__.'/Fixtures/beta/NamespaceCollision', array( array(__DIR__.'/Fixtures/beta/NamespaceCollision', array(
'NamespaceCollision\\A\\B\\Bar' => realpath(__DIR__).'/Fixtures/beta/NamespaceCollision/A/B/Bar.php', 'NamespaceCollision\\A\\B\\Bar' => realpath(__DIR__).'/Fixtures/beta/NamespaceCollision/A/B/Bar.php',

View File

@ -2,4 +2,6 @@
namespace ClassesWithParents; namespace ClassesWithParents;
class A extends B {} class A extends B
{
}

View File

@ -2,4 +2,6 @@
namespace ClassesWithParents; namespace ClassesWithParents;
class B implements CInterface {} class B implements CInterface
{
}

View File

@ -13,5 +13,4 @@ namespace ClassMap;
class SomeClass extends SomeParent implements SomeInterface class SomeClass extends SomeParent implements SomeInterface
{ {
} }

View File

@ -13,5 +13,4 @@ namespace ClassMap;
interface SomeInterface interface SomeInterface
{ {
} }

View File

@ -13,5 +13,4 @@ namespace ClassMap;
abstract class SomeParent abstract class SomeParent
{ {
} }

View File

@ -1,14 +1,24 @@
<?php <?php
namespace { namespace {
class A {} class A
{
}
} }
namespace Alpha { namespace Alpha {
class A {} class A
class B {} {
}
class B
{
}
} }
namespace Beta { namespace Beta {
class A {} class A
class B {} {
}
class B
{
}
} }

View File

@ -11,5 +11,9 @@
namespace Foo\Bar; namespace Foo\Bar;
class A {} class A
class B {} {
}
class B
{
}

View File

@ -1,7 +1,8 @@
<?php <?php
trait TD trait TD
{} {
}
trait TZ trait TZ
{ {

View File

@ -25,6 +25,7 @@ namespace Foo {
class CBar implements IBar class CBar implements IBar
{ {
use TBar, TFooBar; use TBar;
use TFooBar;
} }
} }

View File

@ -287,7 +287,6 @@ class UniversalClassLoader
return $file; return $file;
} }
} }
} else { } else {
// PEAR-like class name // PEAR-like class name
$normalizedClass = str_replace('_', DIRECTORY_SEPARATOR, $class).'.php'; $normalizedClass = str_replace('_', DIRECTORY_SEPARATOR, $class).'.php';

View File

@ -123,5 +123,4 @@ class ConfigCache
{ {
return $this->file.'.meta'; return $this->file.'.meta';
} }
} }

View File

@ -39,5 +39,4 @@ class BooleanNodeDefinition extends ScalarNodeDefinition
{ {
return new BooleanNode($this->name, $this->parent); return new BooleanNode($this->name, $this->parent);
} }
} }

View File

@ -243,5 +243,4 @@ class NodeBuilder implements NodeParentInterface
return $class; return $class;
} }
} }

View File

@ -343,5 +343,4 @@ abstract class NodeDefinition implements NodeParentInterface
* @throws InvalidDefinitionException When the definition is invalid * @throws InvalidDefinitionException When the definition is invalid
*/ */
abstract protected function createNode(); abstract protected function createNode();
} }

View File

@ -64,5 +64,4 @@ class VariableNodeDefinition extends NodeDefinition
return $node; return $node;
} }
} }

View File

@ -323,7 +323,7 @@ class PrototypedArrayNode extends ArrayNode
if (!array_key_exists($k, $leftSide)) { if (!array_key_exists($k, $leftSide)) {
if (!$this->allowNewKeys) { if (!$this->allowNewKeys) {
$ex = new InvalidConfigurationException(sprintf( $ex = new InvalidConfigurationException(sprintf(
'You are not allowed to define new elements for path "%s". ' . 'You are not allowed to define new elements for path "%s". '.
'Please define all elements for this path in one config file.', 'Please define all elements for this path in one config file.',
$this->getPath() $this->getPath()
)); ));

View File

@ -120,7 +120,7 @@ class ReferenceDumper
if ($info = $node->getInfo()) { if ($info = $node->getInfo()) {
$this->writeLine(''); $this->writeLine('');
// indenting multi-line info // indenting multi-line info
$info = str_replace("\n", sprintf("\n%".$depth * 4 . "s# ", ' '), $info); $info = str_replace("\n", sprintf("\n%".($depth * 4)."s# ", ' '), $info);
$this->writeLine('# '.$info, $depth * 4); $this->writeLine('# '.$info, $depth * 4);
} }

View File

@ -49,5 +49,4 @@ interface LoaderInterface
* @param LoaderResolverInterface $resolver A LoaderResolverInterface instance * @param LoaderResolverInterface $resolver A LoaderResolverInterface instance
*/ */
public function setResolver(LoaderResolverInterface $resolver); public function setResolver(LoaderResolverInterface $resolver);
} }

View File

@ -77,7 +77,7 @@ class ArrayNodeTest extends \PHPUnit_Framework_TestCase
array( array(
array('foo-bar' => null, 'foo_bar' => 'foo'), array('foo-bar' => null, 'foo_bar' => 'foo'),
array('foo-bar' => null, 'foo_bar' => 'foo'), array('foo-bar' => null, 'foo_bar' => 'foo'),
) ),
); );
} }

View File

@ -53,7 +53,7 @@ class ArrayNodeDefinitionTest extends \PHPUnit_Framework_TestCase
array('defaultValue', array(array())), array('defaultValue', array(array())),
array('addDefaultChildrenIfNoneSet', array()), array('addDefaultChildrenIfNoneSet', array()),
array('requiresAtLeastOneElement', array()), array('requiresAtLeastOneElement', array()),
array('useAttributeAsKey', array('foo')) array('useAttributeAsKey', array('foo')),
); );
} }

View File

@ -15,7 +15,6 @@ use Symfony\Component\Config\Definition\Builder\TreeBuilder;
class ExprBuilderTest extends \PHPUnit_Framework_TestCase class ExprBuilderTest extends \PHPUnit_Framework_TestCase
{ {
public function testAlwaysExpression() public function testAlwaysExpression()
{ {
$test = $this->getTestBuilder() $test = $this->getTestBuilder()
@ -31,7 +30,7 @@ class ExprBuilderTest extends \PHPUnit_Framework_TestCase
->ifTrue() ->ifTrue()
->then($this->returnClosure('new_value')) ->then($this->returnClosure('new_value'))
->end(); ->end();
$this->assertFinalizedValueIs('new_value', $test, array('key'=>true)); $this->assertFinalizedValueIs('new_value', $test, array('key' => true));
$test = $this->getTestBuilder() $test = $this->getTestBuilder()
->ifTrue( function ($v) { return true; }) ->ifTrue( function ($v) { return true; })
@ -58,8 +57,7 @@ class ExprBuilderTest extends \PHPUnit_Framework_TestCase
->ifString() ->ifString()
->then($this->returnClosure('new_value')) ->then($this->returnClosure('new_value'))
->end(); ->end();
$this->assertFinalizedValueIs(45, $test, array('key'=>45)); $this->assertFinalizedValueIs(45, $test, array('key' => 45));
} }
public function testIfNullExpression() public function testIfNullExpression()
@ -68,7 +66,7 @@ class ExprBuilderTest extends \PHPUnit_Framework_TestCase
->ifNull() ->ifNull()
->then($this->returnClosure('new_value')) ->then($this->returnClosure('new_value'))
->end(); ->end();
$this->assertFinalizedValueIs('new_value', $test, array('key'=>null)); $this->assertFinalizedValueIs('new_value', $test, array('key' => null));
$test = $this->getTestBuilder() $test = $this->getTestBuilder()
->ifNull() ->ifNull()
@ -83,7 +81,7 @@ class ExprBuilderTest extends \PHPUnit_Framework_TestCase
->ifArray() ->ifArray()
->then($this->returnClosure('new_value')) ->then($this->returnClosure('new_value'))
->end(); ->end();
$this->assertFinalizedValueIs('new_value', $test, array('key'=>array())); $this->assertFinalizedValueIs('new_value', $test, array('key' => array()));
$test = $this->getTestBuilder() $test = $this->getTestBuilder()
->ifArray() ->ifArray()
@ -182,7 +180,7 @@ class ExprBuilderTest extends \PHPUnit_Framework_TestCase
->end() ->end()
->end() ->end()
->buildTree() ->buildTree()
->finalize(null === $config ? array('key'=>'value') : $config) ->finalize(null === $config ? array('key' => 'value') : $config)
; ;
} }
@ -207,6 +205,6 @@ class ExprBuilderTest extends \PHPUnit_Framework_TestCase
*/ */
protected function assertFinalizedValueIs($value, $treeBuilder, $config = null) protected function assertFinalizedValueIs($value, $treeBuilder, $config = null)
{ {
$this->assertEquals(array('key'=>$value), $this->finalizeTestBuilder($treeBuilder, $config)); $this->assertEquals(array('key' => $value), $this->finalizeTestBuilder($treeBuilder, $config));
} }
} }

View File

@ -34,7 +34,7 @@ class FloatNodeTest extends \PHPUnit_Framework_TestCase
// Integer are accepted too, they will be cast // Integer are accepted too, they will be cast
array(17), array(17),
array(-10), array(-10),
array(0) array(0),
); );
} }

View File

@ -115,14 +115,14 @@ class MergeTest extends \PHPUnit_Framework_TestCase
$a = array( $a = array(
'test' => array( 'test' => array(
'a' => array('value' => 'foo') 'a' => array('value' => 'foo'),
) ),
); );
$b = array( $b = array(
'test' => array( 'test' => array(
'b' => array('value' => 'foo') 'b' => array('value' => 'foo'),
) ),
); );
$tree->merge($a, $b); $tree->merge($a, $b);
@ -157,13 +157,13 @@ class MergeTest extends \PHPUnit_Framework_TestCase
$b = array( $b = array(
'no_deep_merging' => array( 'no_deep_merging' => array(
'c' => 'd', 'c' => 'd',
) ),
); );
$this->assertEquals(array( $this->assertEquals(array(
'no_deep_merging' => array( 'no_deep_merging' => array(
'c' => 'd', 'c' => 'd',
) ),
), $tree->merge($a, $b)); ), $tree->merge($a, $b));
} }

View File

@ -176,8 +176,8 @@ class NormalizationTest extends \PHPUnit_Framework_TestCase
{ {
$denormalized = array( $denormalized = array(
'thing' => array( 'thing' => array(
array('foo', 'bar'), array('baz', 'qux') array('foo', 'bar'), array('baz', 'qux'),
) ),
); );
$this->assertNormalized($this->getNumericKeysTestTree(), $denormalized, array()); $this->assertNormalized($this->getNumericKeysTestTree(), $denormalized, array());

View File

@ -26,7 +26,7 @@ class ReferenceDumperTest extends \PHPUnit_Framework_TestCase
private function getConfigurationAsString() private function getConfigurationAsString()
{ {
return <<<EOL return <<<EOL
root: root:
boolean: true boolean: true
scalar_empty: ~ scalar_empty: ~

Some files were not shown because too many files have changed in this diff Show More