removed empty lines/trailing spaces

This commit is contained in:
Brikou CARRE 2011-04-15 21:12:02 +02:00
parent db8b118e8a
commit e898445b94
98 changed files with 292 additions and 294 deletions

View File

@ -14,7 +14,7 @@ namespace Symfony\Bridge\Twig\TokenParser;
use Symfony\Bridge\Twig\Node\TransNode;
/**
*
*
*
* @author Fabien Potencier <fabien@symfony.com>
*/

View File

@ -48,7 +48,7 @@ EOT
protected function execute(InputInterface $input, OutputInterface $output)
{
$connection = $this->getDoctrineConnection($input->getOption('connection'));
$params = $connection->getParams();
$name = isset($params['path']) ? $params['path']:$params['dbname'];

View File

@ -39,7 +39,7 @@ abstract class DoctrineCommand extends Command
{
/**
* Convenience method to push the helper sets of a given entity manager into the application.
*
*
* @param Application $application
* @param string $emName
*/

View File

@ -53,7 +53,7 @@ EOT
protected function execute(InputInterface $input, OutputInterface $output)
{
$connection = $this->getDoctrineConnection($input->getOption('connection'));
$params = $connection->getParams();
$name = isset($params['path'])?$params['path']:(isset($params['dbname'])?$params['dbname']:false);

View File

@ -51,7 +51,7 @@ EOT
if ($metadatas = $this->getBundleMetadatas($foundBundle)) {
$output->writeln(sprintf('Generating entity repositories for "<info>%s</info>"', $foundBundle->getName()));
$generator = new EntityRepositoryGenerator();
foreach ($metadatas as $metadata) {
if ($filterEntity && $filterEntity !== $metadata->reflClass->getShortname()) {
continue;

View File

@ -77,7 +77,7 @@ EOT
$em = $this->getEntityManager($this->container, $input->getOption('em'));
$databaseDriver = new DatabaseDriver($em->getConnection()->getSchemaManager());
$em->getConfiguration()->setMetadataDriverImpl($databaseDriver);
$emName = $input->getOption('em');
$emName = $emName ? $emName : 'default';

View File

@ -69,7 +69,7 @@ EOT
$output->write(sprintf("Found <info>%d</info> entities mapped in entity manager <info>%s</info>:\n",
count($entityClassNames), $entityManagerName), true);
foreach ($entityClassNames as $entityClassName) {
try {
$cm = $entityManager->getClassMetadata($entityClassName);

View File

@ -36,7 +36,7 @@ class Configuration implements ConfigurationInterface
{
$this->debug = (Boolean) $debug;
}
/**
* Generates the configuration tree builder.
*
@ -127,7 +127,7 @@ class Configuration implements ConfigurationInterface
{
$node
->children()
->arrayNode('orm')
->arrayNode('orm')
->children()
->scalarNode('default_entity_manager')->end()
->booleanNode('auto_generate_proxy_classes')->defaultFalse()->end()

View File

@ -51,7 +51,7 @@ EOT
if ($metadatas = $this->getBundleMetadatas($foundBundle)) {
$output->writeln(sprintf('Generating document repositories for "<info>%s</info>"', $foundBundle->getName()));
$generator = new DocumentRepositoryGenerator();
foreach ($metadatas as $metadata) {
if ($filterDocument && $filterDocument !== $metadata->reflClass->getShortname()) {
continue;

View File

@ -18,7 +18,7 @@ use Symfony\Component\HttpFoundation\Response;
/**
* Data collector for the Doctrine MongoDB ODM.
*
*
* @author Kris Wallsmith <kris.wallsmith@symfony.com>
*/
class DoctrineMongoDBDataCollector extends DataCollector

View File

@ -91,8 +91,8 @@ class TemplatePathsCacheWarmer extends CacheWarmer
$template = $this->parser->parseFromFilename($file->getRelativePathname());
if (false !== $template) {
if (null !== $bundle) {
$template->set('bundle', $bundle);
}
$template->set('bundle', $bundle);
}
$templates[$template->getSignature()] = $this->locator->locate($template);
}
}

View File

@ -29,14 +29,14 @@ class Shell extends BaseShell
{
return <<<EOF
<info>
_____ __ ___
/ ____| / _| |__ \
_____ __ ___
/ ____| / _| |__ \
| (___ _ _ _ __ ___ | |_ ___ _ __ _ _ ) |
\___ \| | | | '_ ` _ \| _/ _ \| '_ \| | | | / /
____) | |_| | | | | | | || (_) | | | | |_| |/ /_
\___ \| | | | '_ ` _ \| _/ _ \| '_ \| | | | / /
____) | |_| | | | | | | || (_) | | | | |_| |/ /_
|_____/ \__, |_| |_| |_|_| \___/|_| |_|\__, |____|
__/ | __/ |
|___/ |___/
__/ | __/ |
|___/ |___/
</info>
EOF

View File

@ -123,10 +123,10 @@ class TraceableEventDispatcher extends ContainerAwareEventDispatcher implements
/**
* Returns information about the listener
*
*
* @param object $listener The listener
* @param string $eventName The event name
*
*
* @return array Informations about the listener
*/
private function getListenerInfo($listener, $eventName)

View File

@ -66,9 +66,9 @@ class CachedTemplateLocator extends TemplateLocator
/**
* Returns the template path from the cache
*
*
* @param TemplateReferenceInterface $template The template
*
*
* @return string|null The path when it is present in the cache, false otherwise
*/
protected function getCachedTemplatePath(TemplateReferenceInterface $template)

View File

@ -83,7 +83,7 @@ class TemplateNameParser extends BaseTemplateNameParser
* Convert a filename to a template.
*
* @param string $file The filename
*
*
* @return TemplateReferenceInterface A template
*/
public function parseFromFilename($file)

View File

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

View File

@ -182,7 +182,7 @@ abstract class FrameworkExtensionTest extends TestCase
public function testValidationPaths()
{
require_once __DIR__ . "/Fixtures/TestBundle/TestBundle.php";
$container = $this->createContainerFromFile('validation_annotations', array(
'kernel.bundles' => array('TestBundle' => 'Symfony\Bundle\FrameworkBundle\Tests\TestBundle'),
));

View File

@ -34,7 +34,7 @@ class TemplateTest extends TestCase
{
if (!$template->get('bundle')) {
$this->assertEquals($template->getPath(), $path);
}
}
}
public function getTemplateToPathProvider()

View File

@ -24,7 +24,7 @@ class MainConfiguration implements ConfigurationInterface
/**
* Constructor.
*
* @param array $factories
* @param array $factories
*/
public function __construct(array $factories)
{

View File

@ -111,7 +111,7 @@ class RememberMeFactory implements SecurityFactoryInterface
public function addConfiguration(NodeDefinition $node)
{
$builder = $node->children();
$builder
->scalarNode('key')->isRequired()->cannotBeEmpty()->end()
->scalarNode('token_provider')->end()

View File

@ -25,7 +25,7 @@ class MessageDataCollector extends DataCollector
{
protected $logger;
protected $mailer;
public function __construct(\Swift_Events_SendListener $logger, \Swift_Mailer $mailer)
{
$this->logger = $logger;
@ -51,7 +51,7 @@ class MessageDataCollector extends DataCollector
{
return $this->data['messages'];
}
public function isSpool()
{
return $this->data['isSpool'];

View File

@ -36,7 +36,7 @@ class Configuration implements ConfigurationInterface
{
$this->debug = (Boolean) $debug;
}
/**
* Generates the configuration tree builder.
*

View File

@ -53,7 +53,7 @@ class MessageLogger implements \Swift_Events_SendListener
/**
* Empty the message list
*
*
*/
public function clear()
{

View File

@ -12,7 +12,7 @@
namespace Symfony\Bundle\TwigBundle\Node;
/**
*
*
*
* @author Fabien Potencier <fabien@symfony.com>
*/

View File

@ -12,7 +12,7 @@
namespace Symfony\Bundle\TwigBundle\Node;
/**
*
*
*
* @author Fabien Potencier <fabien@symfony.com>
*/

View File

@ -14,7 +14,7 @@ namespace Symfony\Bundle\TwigBundle\TokenParser;
use Symfony\Bundle\TwigBundle\Node\FormThemeNode;
/**
*
*
*
* @author Fabien Potencier <fabien@symfony.com>
*/

View File

@ -14,7 +14,7 @@ namespace Symfony\Bundle\TwigBundle\TokenParser;
use Symfony\Bundle\TwigBundle\Node\IncludeNode;
/**
*
*
*
* @author Fabien Potencier <fabien@symfony.com>
*/

View File

@ -56,8 +56,8 @@ abstract class BaseNode implements NodeInterface
/**
* Adds an equivalent value.
*
* @param mixed $originalValue
* @param mixed $equivalentValue
* @param mixed $originalValue
* @param mixed $equivalentValue
*/
public function addEquivalentValue($originalValue, $equivalentValue)
{
@ -143,8 +143,8 @@ abstract class BaseNode implements NodeInterface
/**
* Merges two values together.
*
* @param mixed $leftSide
* @param mixed $rightSide
* @param mixed $leftSide
* @param mixed $rightSide
* @return mixed The merged value
* @throws ForbiddenOverwriteException
*/
@ -196,7 +196,7 @@ abstract class BaseNode implements NodeInterface
/**
* Finalizes a value, applying all finalization closures.
*
* @param mixed $value The value to finalize
* @param mixed $value The value to finalize
* @return mixed The finalized value
*/
public final function finalize($value)
@ -231,7 +231,7 @@ abstract class BaseNode implements NodeInterface
* @throws InvalidTypeException when the value is invalid
*/
abstract protected function validateType($value);
/**
* Normalizes the value.
*
@ -239,16 +239,16 @@ abstract class BaseNode implements NodeInterface
* @return mixed The normalized value
*/
abstract protected function normalizeValue($value);
/**
* Merges two values together
*
* @param mixed $leftSide
* @param mixed $rightSide
* @param mixed $leftSide
* @param mixed $rightSide
* @return mixed The merged value
*/
abstract protected function mergeValues($leftSide, $rightSide);
/**
* Finalizes a value
*

View File

@ -97,7 +97,7 @@ class ArrayNodeDefinition extends NodeDefinition implements ParentNodeDefinition
return $this;
}
/**
* Requires the node to have at least one element.
*
@ -238,7 +238,7 @@ class ArrayNodeDefinition extends NodeDefinition implements ParentNodeDefinition
/**
* Returns a node builder to be used to add children and protoype
*
*
* @return NodeBuilder The node builder
*/
protected function getNodeBuilder()

View File

@ -96,7 +96,7 @@ class NodeBuilder implements NodeParentInterface
{
return $this->node($name, 'variable');
}
/**
* Returns the parent node.
*
@ -154,9 +154,9 @@ class NodeBuilder implements NodeParentInterface
/**
* Returns the class name of the node definition
*
*
* @param string $type The node type
*
*
* @return string The node definition class name
*
* @throws \RuntimeException When the node type is not registered

View File

@ -19,4 +19,3 @@ namespace Symfony\Component\Config\Definition\Builder;
interface NodeParentInterface
{
}

View File

@ -24,4 +24,3 @@ interface ParentNodeDefinitionInterface
function setBuilder(NodeBuilder $builder);
}

View File

@ -24,7 +24,7 @@ class TreeBuilder implements NodeParentInterface
/**
* Creates the root node.
*
*
* @param string $name The name of the root node
* @param string $type The type of the root node
* @param NodeBuilder $builder A custom node builder instance
@ -36,7 +36,7 @@ class TreeBuilder implements NodeParentInterface
public function root($name, $type = 'array', NodeBuilder $builder = null)
{
$builder = null === $builder ? new NodeBuilder() : $builder;
$this->root = $builder->node($name, $type);
$this->root->setParent($this);
@ -56,7 +56,7 @@ class TreeBuilder implements NodeParentInterface
if (null !== $this->tree) {
return $this->tree;
}
return $this->tree = $this->root->getNode(true);
}
}

View File

@ -37,7 +37,7 @@ class VariableNodeDefinition extends NodeDefinition
protected function createNode()
{
$node = $this->instantiateNode();
if (null !== $this->normalization) {
$node->setNormalizationClosures($this->normalization->before);
}
@ -65,5 +65,5 @@ class VariableNodeDefinition extends NodeDefinition
return $node;
}
}

View File

@ -34,21 +34,21 @@ interface NodeInterface
* @return string The node path
*/
function getPath();
/**
* Returns true when the node is required.
*
* @return Boolean If the node is required
*/
function isRequired();
/**
* Returns true when the node has a default value.
*
* @return Boolean If the node has a default value
*/
function hasDefaultValue();
/**
* Returns the default value of the node.
*
@ -56,7 +56,7 @@ interface NodeInterface
* @throws \RuntimeException if the node has no default value
*/
function getDefaultValue();
/**
* Normalizes the supplied value.
*
@ -64,16 +64,16 @@ interface NodeInterface
* @return mixed The normalized value
*/
function normalize($value);
/**
* Merges two values together.
*
* @param mixed $leftSide
* @param mixed $rightSide
* @param mixed $leftSide
* @param mixed $rightSide
* @return mixed The merged values
*/
function merge($leftSide, $rightSide);
/**
* Finalizes a value.
*

View File

@ -23,7 +23,7 @@ class Processor
*
* @param NodeInterface $configTree The node tree describing the configuration
* @param array $configs An array of configuration items to process
*
*
* @return array The processed configuration
*/
public function process(NodeInterface $configTree, array $configs)

View File

@ -63,7 +63,7 @@ abstract class Loader implements LoaderInterface
*/
public function resolve($resource, $type = null)
{
if ($this->supports($resource, $type)) {
return $this;
}
@ -76,5 +76,5 @@ abstract class Loader implements LoaderInterface
return $loader;
}
}

View File

@ -759,7 +759,7 @@ class Application
* Gets the name of the command based on input.
*
* @param InputInterface $input The input interface
*
*
* @return string The command name
*/
protected function getCommandName(InputInterface $input)

View File

@ -39,7 +39,7 @@ class ClassNode implements NodeInterface
}
/**
* {@inheritDoc}
* {@inheritDoc}
*/
public function __toString()
{

View File

@ -31,7 +31,7 @@ class ElementNode implements NodeInterface
*
* @param string $namespace Namespace
* @param string $element Element
*/
*/
public function __construct($namespace, $element)
{
$this->namespace = $namespace;

View File

@ -37,7 +37,7 @@ class FunctionNode implements NodeInterface
* @param NodeInterface $selector The XPath expression
* @param string $type
* @param string $name
* @param XPathExpr $expr
* @param XPathExpr $expr
*/
public function __construct($selector, $type, $name, $expr)
{
@ -76,10 +76,10 @@ class FunctionNode implements NodeInterface
/**
* undocumented function
*
* @param XPathExpr $xpath
* @param mixed $expr
* @param string $last
* @param string $addNameTest
* @param XPathExpr $xpath
* @param mixed $expr
* @param string $last
* @param string $addNameTest
* @return XPathExpr
*/
protected function _xpath_nth_child($xpath, $expr, $last = false, $addNameTest = true)
@ -148,8 +148,8 @@ class FunctionNode implements NodeInterface
/**
* undocumented function
*
* @param XPathExpr $xpath
* @param XPathExpr $expr
* @param XPathExpr $xpath
* @param XPathExpr $expr
* @return XPathExpr
*/
protected function _xpath_nth_last_child($xpath, $expr)
@ -160,8 +160,8 @@ class FunctionNode implements NodeInterface
/**
* undocumented function
*
* @param XPathExpr $xpath
* @param XPathExpr $expr
* @param XPathExpr $xpath
* @param XPathExpr $expr
* @return XPathExpr
*/
protected function _xpath_nth_of_type($xpath, $expr)
@ -176,8 +176,8 @@ class FunctionNode implements NodeInterface
/**
* undocumented function
*
* @param XPathExpr $xpath
* @param XPathExpr $expr
* @param XPathExpr $xpath
* @param XPathExpr $expr
* @return XPathExpr
*/
protected function _xpath_nth_last_of_type($xpath, $expr)
@ -188,8 +188,8 @@ class FunctionNode implements NodeInterface
/**
* undocumented function
*
* @param XPathExpr $xpath
* @param XPathExpr $expr
* @param XPathExpr $xpath
* @param XPathExpr $expr
* @return XPathExpr
*/
protected function _xpath_contains($xpath, $expr)
@ -211,8 +211,8 @@ class FunctionNode implements NodeInterface
/**
* undocumented function
*
* @param XPathExpr $xpath
* @param XPathExpr $expr
* @param XPathExpr $xpath
* @param XPathExpr $expr
* @return XPathExpr
*/
protected function _xpath_not($xpath, $expr)
@ -229,7 +229,7 @@ class FunctionNode implements NodeInterface
/**
* Parses things like '1n+2', or 'an+b' generally, returning (a, b)
*
* @param mixed $s
* @param mixed $s
* @return array
*/
protected function parseSeries($s)

View File

@ -38,7 +38,7 @@ class HashNode implements NodeInterface
$this->id = $id;
}
/**
/**
* {@inheritDoc}
*/
public function __toString()

View File

@ -119,7 +119,7 @@ class PseudoNode implements NodeInterface
return $xpath;
}
/**
/**
* Sets the XPath to be the last child.
*
* @param XPathExpr $xpath The XPath expression

View File

@ -31,7 +31,7 @@ class Alias
/**
* Checks if this DI Alias should be public or not.
*
* @return boolean
* @return boolean
*/
public function isPublic()
{

View File

@ -23,7 +23,7 @@ class CheckDefinitionValidityPass implements CompilerPassInterface
/**
* Processes the ContainerBuilder to validate the Definition.
*
* @param ContainerBuilder $container
* @param ContainerBuilder $container
* @throws \RuntimeException When the Definition is invalid
*/
public function process(ContainerBuilder $container)

View File

@ -22,7 +22,7 @@ interface RepeatablePassInterface extends CompilerPassInterface
/**
* Sets the RepeatedPass interface.
*
* @param RepeatedPass $repeatedPass
* @param RepeatedPass $repeatedPass
*/
function setRepeatedPass(RepeatedPass $repeatedPass);
}

View File

@ -44,7 +44,7 @@ class RepeatedPass implements CompilerPassInterface
/**
* Process the repeatable passes that run more than once.
*
* @param ContainerBuilder $container
* @param ContainerBuilder $container
*/
public function process(ContainerBuilder $container)
{

View File

@ -46,7 +46,7 @@ class ServiceReferenceGraph
*
* @param string $id The id to retrieve
* @return ServiceReferenceGraphNode The node matching the supplied identifier
* @throws \InvalidArgumentException
* @throws \InvalidArgumentException
*/
public function getNode($id)
{
@ -78,11 +78,11 @@ class ServiceReferenceGraph
/**
* Connects 2 nodes together in the Graph.
*
* @param string $sourceId
* @param string $sourceValue
* @param string $destId
* @param string $destValue
* @param string $reference
* @param string $sourceId
* @param string $sourceValue
* @param string $destId
* @param string $destValue
* @param string $reference
*/
public function connect($sourceId, $sourceValue, $destId, $destValue = null, $reference = null)
{
@ -97,8 +97,8 @@ class ServiceReferenceGraph
/**
* Creates a graph node.
*
* @param string $id
* @param string $value
* @param string $id
* @param string $value
* @return ServiceReferenceGraphNode
*/
private function createNode($id, $value)

View File

@ -27,9 +27,9 @@ class ServiceReferenceGraphEdge
/**
* Constructor.
*
* @param ServiceReferenceGraphNode $sourceNode
* @param ServiceReferenceGraphNode $destNode
* @param string $value
* @param ServiceReferenceGraphNode $sourceNode
* @param ServiceReferenceGraphNode $destNode
* @param string $value
*/
public function __construct(ServiceReferenceGraphNode $sourceNode, ServiceReferenceGraphNode $destNode, $value = null)
{

View File

@ -45,7 +45,7 @@ class ServiceReferenceGraphNode
/**
* Adds an in edge to this node.
*
* @param ServiceReferenceGraphEdge $edge
* @param ServiceReferenceGraphEdge $edge
*/
public function addInEdge(ServiceReferenceGraphEdge $edge)
{
@ -55,7 +55,7 @@ class ServiceReferenceGraphNode
/**
* Adds an out edge to this node.
*
* @param ServiceReferenceGraphEdge $edge
* @param ServiceReferenceGraphEdge $edge
*/
public function addOutEdge(ServiceReferenceGraphEdge $edge)
{

View File

@ -44,7 +44,7 @@ class DefinitionDecorator extends Definition
{
return $this->changes;
}
/**
* {@inheritDoc}
*/
@ -54,7 +54,7 @@ class DefinitionDecorator extends Definition
return parent::setClass($class);
}
/**
* {@inheritDoc}
*/
@ -64,7 +64,7 @@ class DefinitionDecorator extends Definition
return parent::setFactoryClass($class);
}
/**
* {@inheritDoc}
*/
@ -74,7 +74,7 @@ class DefinitionDecorator extends Definition
return parent::setFactoryMethod($method);
}
/**
* {@inheritDoc}
*/
@ -84,7 +84,7 @@ class DefinitionDecorator extends Definition
return parent::setFactoryService($service);
}
/**
* {@inheritDoc}
*/
@ -94,7 +94,7 @@ class DefinitionDecorator extends Definition
return parent::setConfigurator($callable);
}
/**
* {@inheritDoc}
*/
@ -104,7 +104,7 @@ class DefinitionDecorator extends Definition
return parent::setFile($file);
}
/**
* {@inheritDoc}
*/

View File

@ -12,7 +12,7 @@
namespace Symfony\Component\DependencyInjection\ParameterBag;
/**
*
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class FrozenParameterBag extends ParameterBag

View File

@ -12,7 +12,7 @@
namespace Symfony\Component\DependencyInjection\ParameterBag;
/**
*
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class ParameterBag implements ParameterBagInterface
@ -149,7 +149,7 @@ class ParameterBag implements ParameterBagInterface
*
* @see resolveValue
*
* @param array $match
* @param array $match
* @return string
*/
private function resolveValueCallback($match)

View File

@ -31,7 +31,7 @@ class Variable
/**
* Constructor
*
* @param string $name
* @param string $name
*/
public function __construct($name)
{

View File

@ -24,7 +24,7 @@ use Symfony\Component\Form\ValueTransformer\MoneyToLocalizedStringTransformer;
* * currency: The currency to display the money with. This is the 3-letter
* ISO 4217 currency code.
* * divisor: A number to divide the money by before displaying. Default 1.
*
*
* @see Symfony\Component\Form\NumberField
* @author Bernhard Schussek <bernhard.schussek@symfony.com>
*/

View File

@ -2,7 +2,7 @@
/*
* This file is part of the Symfony package.
*
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE

View File

@ -2,7 +2,7 @@
/*
* This file is part of the Symfony package.
*
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE

View File

@ -2,7 +2,7 @@
/*
* This file is part of the Symfony package.
*
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE

View File

@ -2,7 +2,7 @@
/*
* This file is part of the Symfony package.
*
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE

View File

@ -2,7 +2,7 @@
/*
* This file is part of the Symfony package.
*
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
@ -48,7 +48,7 @@ class FileBinaryMimeTypeGuesser implements MimeTypeGuesserInterface
if (!self::isSupported()) {
return null;
}
ob_start();
// need to use --mime instead of -i. see #6641

View File

@ -2,7 +2,7 @@
/*
* This file is part of the Symfony package.
*
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE

View File

@ -2,7 +2,7 @@
/*
* This file is part of the Symfony package.
*
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE

View File

@ -2,7 +2,7 @@
/*
* This file is part of the Symfony package.
*
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE

View File

@ -84,7 +84,7 @@ class AnnotationFileLoader extends FileLoader
*
* @param string $file A PHP file path
*
* @return string|false Full class name if found, false otherwise
* @return string|false Full class name if found, false otherwise
*/
protected function findClass($file)
{

View File

@ -14,7 +14,7 @@ namespace Symfony\Component\Security\Core\Authentication\RememberMe;
/**
* Interface to be implemented by persistent token classes (such as
* Doctrine entities representing a remember-me token)
*
*
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
*/
interface PersistentTokenInterface
@ -24,19 +24,19 @@ interface PersistentTokenInterface
* @return string
*/
function getUsername();
/**
* Returns the series
* @return string
*/
function getSeries();
/**
* Returns the token value
* @return string
*/
function getTokenValue();
/**
* Returns the last time the cookie was used
* @return \DateTime

View File

@ -14,7 +14,7 @@ namespace Symfony\Component\Security\Core\Exception;
/**
* This exception is thrown when the RememberMeServices implementation
* detects that a presented cookie has already been used by someone else.
*
*
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
*/
class CookieTheftException extends AuthenticationException

View File

@ -1,4 +1,4 @@
<?php
<?php
namespace Symfony\Component\Security\Core\Exception;
/*

View File

@ -174,7 +174,7 @@ class XmlEncoder extends AbstractEncoder
} else {
$value = (string) $subnode;
}
if ($key === 'item') {
if (isset($value['@key'])) {
$data[(string)$value['@key']] = $value['#'];

View File

@ -19,7 +19,7 @@ namespace Symfony\Component\Templating;
* a path on the filesystem (in fact, the template can be stored
* anywhere, like in a database).
*
* The methods should accept any name. If the name is not an instance of
* The methods should accept any name. If the name is not an instance of
* TemplateReferenceInterface, a TemplateNameParserInterface should be used to
* convert the name to a TemplateReferenceInterface instance.
*

View File

@ -106,9 +106,9 @@ class FilesystemLoader extends Loader
*/
static protected function isAbsolutePath($file)
{
if ($file[0] == '/' || $file[0] == '\\'
|| (strlen($file) > 3 && ctype_alpha($file[0])
&& $file[1] == ':'
if ($file[0] == '/' || $file[0] == '\\'
|| (strlen($file) > 3 && ctype_alpha($file[0])
&& $file[1] == ':'
&& ($file[2] == '\\' || $file[2] == '/')
)
) {

View File

@ -57,7 +57,7 @@ class Interval
$leftNumber = self::convertNumber($matches['left']);
$rightNumber = self::convertNumber($matches['right']);
return
return
('[' === $matches['left_delimiter'] ? $number >= $leftNumber : $number > $leftNumber)
&& (']' === $matches['right_delimiter'] ? $number <= $rightNumber : $number < $rightNumber)
;

View File

@ -30,13 +30,13 @@ class CsvFileLoader extends ArrayLoader implements LoaderInterface
public function load($resource, $locale, $domain = 'messages')
{
$messages = array();
try {
$file = new \SplFileObject($resource, 'rb');
} catch(\RuntimeException $e) {
throw new \InvalidArgumentException(sprintf('Error opening file "%s".', $resource));
}
$file->setFlags(\SplFileObject::READ_CSV | \SplFileObject::SKIP_EMPTY);
$file->setCsvControl(';');

View File

@ -49,7 +49,7 @@ class Escaper
{
return preg_match('/'.self::REGEX_CHARACTER_TO_ESCAPE.'/u', $value);
}
/**
* Escapes and surrounds a PHP value with double quotes.
*

View File

@ -61,14 +61,14 @@ class ResponseTest extends \PHPUnit_Framework_TestCase
{
$headers = array(
'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.= 'set-cookie: foo=bar'."\n";
$expected.= 'set-cookie: bar=foo'."\n\n";
$expected.= 'foo';
$response = new Response('foo', 304, $headers);
$this->assertEquals($expected, $response->__toString(), '->__toString() returns the headers and the content as a string');

View File

@ -43,7 +43,7 @@ namespace Foo
{
class Foo {}
}
namespace Bar
namespace Bar
{
class Foo {}
}

View File

@ -30,7 +30,7 @@ class NodeBuilderTest extends \PHPUnit_Framework_TestCase
public function testAddingANewNodeType()
{
$class = __NAMESPACE__.'\\SomeNodeDefinition';
$builder = new BaseNodeBuilder();
$node = $builder
->setNodeClass('newtype', $class)
@ -66,7 +66,7 @@ class NodeBuilderTest extends \PHPUnit_Framework_TestCase
$node2 = $builder->node('', 'custom');
$this->assertEquals(get_class($node1), get_class($node2));
}
}
}
class SomeNodeDefinition extends BaseVariableNodeDefinition

View File

@ -8,7 +8,7 @@ use Symfony\Component\Config\Definition\ScalarNode;
class PrototypedArrayNodeTest extends \PHPUnit_Framework_TestCase
{
public function testGetDefaultValueReturnsAnEmptyArrayForPrototypes()
{
$node = new PrototypedArrayNode('root');

View File

@ -20,6 +20,6 @@ class NodeBuilder extends BaseNodeBuilder
return __NAMESPACE__.'\\'.ucfirst($type).'NodeDefinition';
default:
return parent::getNodeClass($type);
}
}
}
}

View File

@ -79,7 +79,7 @@ interfaces:
FooClass:
calls:
- [setBar, [someValue]]
services:
foo:

View File

@ -69,13 +69,13 @@ class CookieTest extends \PHPUnit_Framework_TestCase
{
new Cookie('MyCookie', $value);
}
/**
* @expectedException InvalidArgumentException
*/
public function testInvalidExpiration()
{
$cookie = new Cookie('MyCookie', 'foo','bar');
$cookie = new Cookie('MyCookie', 'foo','bar');
}
/**

View File

@ -116,7 +116,7 @@ class RequestTest extends \PHPUnit_Framework_TestCase
public function testGetFormatFromMimeType($format, $mimeTypes)
{
$request = new Request();
foreach ($mimeTypes as $mime) {
foreach ($mimeTypes as $mime) {
$this->assertEquals($format, $request->getFormat($mime));
}
$request->setFormat($format, $mimeTypes);
@ -634,7 +634,7 @@ class RequestTest extends \PHPUnit_Framework_TestCase
$request = new Request();
$request->headers->set('Accept-Charset', 'ISO-8859-1, US-ASCII, UTF-8; q=0.8, ISO-10646-UCS-2; q=0.6');
$this->assertEquals(array('ISO-8859-1', 'US-ASCII', 'UTF-8', 'ISO-10646-UCS-2'), $request->getCharsets());
$request = new Request();
$request->headers->set('Accept-Charset', 'ISO-8859-1,utf-8;q=0.7,*;q=0.7');
$this->assertEquals(array('ISO-8859-1', '*', 'utf-8'), $request->getCharsets());

View File

@ -24,13 +24,13 @@ class BundleTest extends \PHPUnit_Framework_TestCase
$cmd = new FooCommand();
$app = $this->getMock('Symfony\Component\Console\Application');
$app->expects($this->once())->method('add')->with($this->equalTo($cmd));
$bundle = new ExtensionPresentBundle();
$bundle->registerCommands($app);
$bundle2 = new ExtensionAbsentBundle();
$this->assertNull($bundle2->registerCommands($app));
}
}

View File

@ -24,11 +24,11 @@ class ExceptionDataCollectorTest extends \PHPUnit_Framework_TestCase
$c = new ExceptionDataCollector();
$flattened = FlattenException::create($e);
$trace = $flattened->getTrace();
$this->assertFalse($c->hasException());
$c->collect(new Request(), new Response(),$e);
$this->assertTrue($c->hasException());
$this->assertEquals($flattened,$c->getException());
$this->assertSame('foo',$c->getMessage());
@ -36,5 +36,5 @@ class ExceptionDataCollectorTest extends \PHPUnit_Framework_TestCase
$this->assertSame('exception',$c->getName());
$this->assertSame($trace,$c->getTrace());
}
}

View File

@ -22,14 +22,14 @@ class LoggerDataCollectorTest extends \PHPUnit_Framework_TestCase
public function testCollect()
{
$c = new LoggerDataCollector(new TestLogger());
$c->collect(new Request(), new Response());
$this->assertSame('logger',$c->getName());
$this->assertSame(1337,$c->countErrors());
$this->assertSame(array('foo'),$c->getLogs());
}
}
class TestLogger extends Logger implements DebugLoggerInterface
@ -38,12 +38,12 @@ class TestLogger extends Logger implements DebugLoggerInterface
{
return 1337;
}
public function getDebugLogger()
{
return new static();
}
public function getLogs($priority = false)
{
return array('foo');

View File

@ -20,11 +20,11 @@ class MemoryDataCollectorTest extends \PHPUnit_Framework_TestCase
public function testCollect()
{
$c = new MemoryDataCollector();
$c->collect(new Request(), new Response());
$this->assertInternalType('integer',$c->getMemory());
$this->assertSame('memory',$c->getName());
}
}

View File

@ -24,9 +24,9 @@ class RequestDataCollectorTest extends \PHPUnit_Framework_TestCase
public function testCollect(Request $request, Response $response)
{
$c = new RequestDataCollector();
$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());
@ -36,27 +36,27 @@ class RequestDataCollectorTest extends \PHPUnit_Framework_TestCase
$this->assertInstanceOf('Symfony\Component\HttpFoundation\ParameterBag',$c->getRequestQuery());
$this->assertEquals('html',$c->getFormat());
$this->assertEquals(array(),$c->getSessionAttributes());
$this->assertInstanceOf('Symfony\Component\HttpFoundation\HeaderBag',$c->getResponseHeaders());
$this->assertEquals(200,$c->getStatusCode());
$this->assertEquals('application/json',$c->getContentType());
}
public function provider()
{
$request = Request::create('http://test.com/foo?bar=baz');
$request->attributes->set('foo', 'bar');
$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'));
return array(
array($request,$response)
);
}
}

View File

@ -21,27 +21,27 @@ use Symfony\Component\HttpKernel\Debug\ErrorException;
*/
class ErrorHandlerTest extends \PHPUnit_Framework_TestCase
{
public function testConstruct()
{
$e = new ErrorHandler(3);
$this->assertInstanceOf('Symfony\Component\HttpKernel\Debug\ErrorHandler',$e);
$level = new \ReflectionProperty(get_class($e),'level');
$level->setAccessible(true);
$this->assertEquals(3,$level->getValue($e));
}
public function testRegister()
{
$e = new ErrorHandler(3);
$e = $this->getMock(get_class($e), array('handle'));
$e->expects($this->once())->method('handle');
$e->register();
try{
trigger_error('foo');
}catch(\Exception $e){
@ -52,10 +52,10 @@ class ErrorHandlerTest extends \PHPUnit_Framework_TestCase
{
$e = new ErrorHandler(0);
$this->assertFalse($e->handle(0,'foo','foo.php',12,'foo'));
$e = new ErrorHandler(3);
$this->assertFalse($e->handle(4,'foo','foo.php',12,'foo'));
$e = new ErrorHandler(3);
try{
$e->handle(1, 'foo', 'foo.php', 12,'foo');

View File

@ -21,7 +21,7 @@ class FlattenExceptionTest extends \PHPUnit_Framework_TestCase
{
$flattened = FlattenException::create($exception);
$flattened2 = FlattenException::create($exception);
$flattened->setPrevious($flattened2);
$this->assertEquals($exception->getMessage(), $flattened->getMessage(), 'The message is copied from the original exception.');
@ -29,7 +29,7 @@ class FlattenExceptionTest extends \PHPUnit_Framework_TestCase
$this->assertEquals(get_class($exception), $flattened->getClass(), 'The class is set to the class of the original exception');
}
/**
* @dataProvider flattenDataProvider
*/
@ -37,14 +37,14 @@ class FlattenExceptionTest extends \PHPUnit_Framework_TestCase
{
$flattened = FlattenException::create($exception);
$flattened2 = FlattenException::create($exception);
$flattened->setPrevious($flattened2);
$this->assertSame($flattened2,$flattened->getPrevious());
$this->assertSame(array($flattened2),$flattened->getPreviouses());
}
/**
* @dataProvider flattenDataProvider
*/
@ -52,7 +52,7 @@ class FlattenExceptionTest extends \PHPUnit_Framework_TestCase
{
$flattened = FlattenException::create($exception);
$flattened->setTrace(array(),'foo.php',123);
$this->assertEquals(array(
array(
'message'=> 'test',
@ -64,7 +64,7 @@ class FlattenExceptionTest extends \PHPUnit_Framework_TestCase
)
),$flattened->toArray());
}
public function flattenDataProvider()
{
return array(

View File

@ -19,5 +19,5 @@ class FooCommand extends Command
{
$this->setName('foo');
}
}

View File

@ -341,7 +341,7 @@ EOF;
$kernel->locateResource('@Bundle1Bundle/config/routing.xml');
}
public function testLocateResourceReturnsTheFirstThatMatches()
{
$kernel = $this->getKernel();

View File

@ -21,12 +21,12 @@ class PhpGeneratorDumperTest extends \PHPUnit_Framework_TestCase
* @var RouteCollection
*/
private $routeCollection;
/**
* @var PhpGeneratorDumper
*/
private $generatorDumper;
/**
* @var string
*/
@ -45,7 +45,7 @@ class PhpGeneratorDumperTest extends \PHPUnit_Framework_TestCase
protected function tearDown()
{
parent::tearDown();
@unlink($this->testTmpFilepath);
}
@ -53,7 +53,7 @@ class PhpGeneratorDumperTest extends \PHPUnit_Framework_TestCase
{
$this->routeCollection->add('Test', new Route('/testing/{foo}'));
$this->routeCollection->add('Test2', new Route('/testing2'));
file_put_contents($this->testTmpFilepath, $this->generatorDumper->dump());
include ($this->testTmpFilepath);
@ -64,7 +64,7 @@ class PhpGeneratorDumperTest extends \PHPUnit_Framework_TestCase
'port' => 80,
'is_secure' => false
));
$absoluteUrlWithParameter = $projectUrlGenerator->generate('Test', array('foo' => 'bar'), true);
$absoluteUrlWithoutParameter = $projectUrlGenerator->generate('Test2', array(), true);
$relativeUrlWithParameter = $projectUrlGenerator->generate('Test', array('foo' => 'bar'), false);
@ -75,7 +75,7 @@ class PhpGeneratorDumperTest extends \PHPUnit_Framework_TestCase
$this->assertEquals($relativeUrlWithParameter, '/app.php/testing/bar');
$this->assertEquals($relativeUrlWithoutParameter, '/app.php/testing2');
}
/**
* @expectedException \InvalidArgumentException
*/
@ -91,17 +91,17 @@ class PhpGeneratorDumperTest extends \PHPUnit_Framework_TestCase
'port' => 80,
'is_secure' => false
));
$projectUrlGenerator->generate('Test', array());
}
public function testDumpForRouteWithDefaults()
{
$this->routeCollection->add('Test', new Route('/testing/{foo}', array('foo' => 'bar')));
file_put_contents($this->testTmpFilepath, $this->generatorDumper->dump(array('class' => 'DefaultRoutesUrlGenerator')));
include ($this->testTmpFilepath);
$projectUrlGenerator = new \DefaultRoutesUrlGenerator(array());
$url = $projectUrlGenerator->generate('Test', array());

View File

@ -104,7 +104,7 @@ class UrlGeneratorTest extends \PHPUnit_Framework_TestCase
$this->assertEquals('/app.php/testing', $url);
}
public function testRelativeUrlWithParameter()
{
$this->routeCollection->add('test', new Route('/testing/{foo}'));
@ -119,7 +119,7 @@ class UrlGeneratorTest extends \PHPUnit_Framework_TestCase
$this->assertEquals('/app.php/testing/bar', $url);
}
public function testRelativeUrlWithExtraParameters()
{
$this->routeCollection->add('test', new Route('/testing'));
@ -134,7 +134,7 @@ class UrlGeneratorTest extends \PHPUnit_Framework_TestCase
$this->assertEquals('/app.php/testing?foo=bar', $url);
}
public function testAbsoluteUrlWithExtraParameters()
{
$this->routeCollection->add('test', new Route('/testing'));
@ -149,15 +149,15 @@ class UrlGeneratorTest extends \PHPUnit_Framework_TestCase
$this->assertEquals('http://localhost/app.php/testing?foo=bar', $url);
}
/**
* @expectedException \InvalidArgumentException
*/
public function testGenerateWithoutRoutes()
{
{
$this->generator->generate('test', array(), true);
}
/**
* @expectedException \InvalidArgumentException
*/
@ -166,7 +166,7 @@ class UrlGeneratorTest extends \PHPUnit_Framework_TestCase
$this->routeCollection->add('test', new Route('/testing/{foo}'));
$this->generator->generate('test', array(), true);
}
/**
* @expectedException \InvalidArgumentException
*/
@ -176,7 +176,7 @@ class UrlGeneratorTest extends \PHPUnit_Framework_TestCase
$this->routeCollection->add('test', $route);
$this->generator->generate('test', array('foo' => 'bar'), true);
}
/**
* @expectedException \InvalidArgumentException
*/
@ -185,5 +185,5 @@ class UrlGeneratorTest extends \PHPUnit_Framework_TestCase
$route = new Route('/testing/{foo}', array(), array('foo' => 'd+'));
$this->routeCollection->add('test', $route);
$this->generator->generate('test', array('foo' => 'bar'), true);
}
}
}

View File

@ -20,14 +20,14 @@ class AuditLoggerTest extends \PHPUnit_Framework_TestCase
{
$logger = $this->getLogger();
$ace = $this->getEntry();
if (true === $granting) {
$ace
->expects($this->once())
->method('isAuditSuccess')
->will($this->returnValue($audit))
;
$ace
->expects($this->never())
->method('isAuditFailure')
@ -37,7 +37,7 @@ class AuditLoggerTest extends \PHPUnit_Framework_TestCase
->expects($this->never())
->method('isAuditSuccess')
;
$ace
->expects($this->once())
->method('isAuditFailure')
@ -57,10 +57,10 @@ class AuditLoggerTest extends \PHPUnit_Framework_TestCase
->method('doLog')
;
}
$logger->logIfNeeded($granting, $ace);
}
public function getTestLogData()
{
return array(
@ -70,12 +70,12 @@ class AuditLoggerTest extends \PHPUnit_Framework_TestCase
array(false, true),
);
}
protected function getEntry()
{
return $this->getMock('Symfony\Component\Security\Acl\Model\AuditableEntryInterface');
}
protected function getLogger()
{
return $this->getMockForAbstractClass('Symfony\Component\Security\Acl\Domain\AuditLogger');

View File

@ -18,7 +18,7 @@ class EntryTest extends \PHPUnit_Framework_TestCase
public function testConstructor()
{
$ace = $this->getAce($acl = $this->getAcl(), $sid = $this->getSid());
$this->assertEquals(123, $ace->getId());
$this->assertSame($acl, $ace->getAcl());
$this->assertSame($sid, $ace->getSecurityIdentity());
@ -28,54 +28,54 @@ class EntryTest extends \PHPUnit_Framework_TestCase
$this->assertTrue($ace->isAuditSuccess());
$this->assertFalse($ace->isAuditFailure());
}
public function testSetAuditSuccess()
{
$ace = $this->getAce();
$this->assertTrue($ace->isAuditSuccess());
$ace->setAuditSuccess(false);
$this->assertFalse($ace->isAuditSuccess());
$ace->setAuditsuccess(true);
$this->assertTrue($ace->isAuditSuccess());
}
public function testSetAuditFailure()
{
$ace = $this->getAce();
$this->assertFalse($ace->isAuditFailure());
$ace->setAuditFailure(true);
$this->assertTrue($ace->isAuditFailure());
$ace->setAuditFailure(false);
$this->assertFalse($ace->isAuditFailure());
}
public function testSetMask()
{
$ace = $this->getAce();
$this->assertEquals(123456, $ace->getMask());
$ace->setMask(4321);
$this->assertEquals(4321, $ace->getMask());
}
public function testSetStrategy()
{
$ace = $this->getAce();
$this->assertEquals('foostrat', $ace->getStrategy());
$ace->setStrategy('foo');
$this->assertEquals('foo', $ace->getStrategy());
}
public function testSerializeUnserialize()
{
$ace = $this->getAce();
$serialized = serialize($ace);
$uAce = unserialize($serialized);
$this->assertNull($uAce->getAcl());
$this->assertInstanceOf('Symfony\Component\Security\Acl\Model\SecurityIdentityInterface', $uAce->getSecurityIdentity());
$this->assertEquals($ace->getId(), $uAce->getId());
@ -85,7 +85,7 @@ class EntryTest extends \PHPUnit_Framework_TestCase
$this->assertEquals($ace->isAuditSuccess(), $uAce->isAuditSuccess());
$this->assertEquals($ace->isAuditFailure(), $uAce->isAuditFailure());
}
protected function getAce($acl = null, $sid = null)
{
if (null === $acl) {
@ -94,24 +94,24 @@ class EntryTest extends \PHPUnit_Framework_TestCase
if (null === $sid) {
$sid = $this->getSid();
}
return new Entry(
123,
$acl,
$sid,
'foostrat',
123456,
true,
false,
123,
$acl,
$sid,
'foostrat',
123456,
true,
false,
true
);
);
}
protected function getAcl()
{
return $this->getMock('Symfony\Component\Security\Acl\Model\AclInterface');
}
protected function getSid()
{
return $this->getMock('Symfony\Component\Security\Acl\Model\SecurityIdentityInterface');

View File

@ -18,17 +18,17 @@ class FieldEntryTest extends \PHPUnit_Framework_TestCase
public function testConstructor()
{
$ace = $this->getAce();
$this->assertEquals('foo', $ace->getField());
}
public function testSerializeUnserialize()
{
$ace = $this->getAce();
$serialized = serialize($ace);
$uAce = unserialize($serialized);
$this->assertNull($uAce->getAcl());
$this->assertInstanceOf('Symfony\Component\Security\Acl\Model\SecurityIdentityInterface', $uAce->getSecurityIdentity());
$this->assertEquals($ace->getId(), $uAce->getId());
@ -39,7 +39,7 @@ class FieldEntryTest extends \PHPUnit_Framework_TestCase
$this->assertEquals($ace->isAuditSuccess(), $uAce->isAuditSuccess());
$this->assertEquals($ace->isAuditFailure(), $uAce->isAuditFailure());
}
protected function getAce($acl = null, $sid = null)
{
if (null === $acl) {
@ -48,25 +48,25 @@ class FieldEntryTest extends \PHPUnit_Framework_TestCase
if (null === $sid) {
$sid = $this->getSid();
}
return new FieldEntry(
123,
$acl,
123,
$acl,
'foo',
$sid,
'foostrat',
123456,
true,
false,
$sid,
'foostrat',
123456,
true,
false,
true
);
);
}
protected function getAcl()
{
return $this->getMock('Symfony\Component\Security\Acl\Model\AclInterface');
}
protected function getSid()
{
return $this->getMock('Symfony\Component\Security\Acl\Model\SecurityIdentityInterface');

View File

@ -23,7 +23,7 @@ class MaskBuilderTest extends \PHPUnit_Framework_TestCase
{
new MaskBuilder($invalidMask);
}
public function getInvalidConstructorData()
{
return array(
@ -33,32 +33,32 @@ class MaskBuilderTest extends \PHPUnit_Framework_TestCase
array(new \stdClass()),
);
}
public function testConstructorWithoutArguments()
{
$builder = new MaskBuilder();
$this->assertEquals(0, $builder->get());
}
public function testConstructor()
{
$builder = new MaskBuilder(123456);
$this->assertEquals(123456, $builder->get());
}
public function testAddAndRemove()
{
$builder = new MaskBuilder();
$builder
->add('view')
->add('eDiT')
->add('ownEr')
;
$mask = $builder->get();
$this->assertEquals(MaskBuilder::MASK_VIEW, $mask & MaskBuilder::MASK_VIEW);
$this->assertEquals(MaskBuilder::MASK_EDIT, $mask & MaskBuilder::MASK_EDIT);
$this->assertEquals(MaskBuilder::MASK_OWNER, $mask & MaskBuilder::MASK_OWNER);
@ -66,37 +66,37 @@ class MaskBuilderTest extends \PHPUnit_Framework_TestCase
$this->assertEquals(0, $mask & MaskBuilder::MASK_CREATE);
$this->assertEquals(0, $mask & MaskBuilder::MASK_DELETE);
$this->assertEquals(0, $mask & MaskBuilder::MASK_UNDELETE);
$builder->remove('edit')->remove('OWner');
$mask = $builder->get();
$this->assertEquals(0, $mask & MaskBuilder::MASK_EDIT);
$this->assertEquals(0, $mask & MaskBuilder::MASK_OWNER);
$this->assertEquals(MaskBuilder::MASK_VIEW, $mask & MaskBuilder::MASK_VIEW);
}
public function testGetPattern()
{
$builder = new MaskBuilder;
$this->assertEquals(MaskBuilder::ALL_OFF, $builder->getPattern());
$builder->add('view');
$this->assertEquals(str_repeat('.', 31).'V', $builder->getPattern());
$builder->add('owner');
$this->assertEquals(str_repeat('.', 24).'N......V', $builder->getPattern());
$builder->add(1 << 10);
$this->assertEquals(str_repeat('.', 21).MaskBuilder::ON.'..N......V', $builder->getPattern());
}
public function testReset()
{
$builder = new MaskBuilder();
$this->assertEquals(0, $builder->get());
$builder->add('view');
$this->assertTrue($builder->get() > 0);
$builder->reset();
$this->assertEquals(0, $builder->get());
}

View File

@ -360,13 +360,13 @@ class AclVoterTest extends \PHPUnit_Framework_TestCase
$this->assertSame(VoterInterface::ACCESS_DENIED, $voter->vote($this->getToken(), new FieldVote(new \stdClass(), 'foo'), array('VIEW')));
}
public function testWhenReceivingAnObjectIdentityInterfaceWeDontRetrieveANewObjectIdentity()
{
list($voter, $provider, $permissionMap, $oidStrategy, $sidStrategy) = $this->getVoter();
$oid = new ObjectIdentity('someID','someType');
$permissionMap
->expects($this->once())
->method('contains')

View File

@ -111,16 +111,16 @@ class XmlEncoderTest extends \PHPUnit_Framework_TestCase
$this->assertEquals($expected, $this->encoder->encode($array, 'xml'));
}
public function testEncodeScalarWithAttribute()
{
$array = array(
'person' => array('@gender' => 'M', '#' => 'Peter'),
);
$expected = '<?xml version="1.0"?>'."\n".
'<response><person gender="M"><![CDATA[Peter]]></person></response>'."\n";
$this->assertEquals($expected, $this->encoder->encode($array, 'xml'));
}
@ -147,19 +147,19 @@ class XmlEncoderTest extends \PHPUnit_Framework_TestCase
$this->assertEquals(get_object_vars($obj), $this->encoder->decode($source, 'xml'));
}
public function testDecodeScalarWithAttribute()
{
$source = '<?xml version="1.0"?>'."\n".
'<response><person gender="M">Peter</person></response>'."\n";
$expected = array(
'person' => array('@gender' => 'M', '#' => 'Peter'),
);
$this->assertEquals($expected, $this->encoder->decode($source, 'xml'));
}
public function testDecodeArray()
{
$source = '<?xml version="1.0"?>'."\n".
@ -169,14 +169,14 @@ class XmlEncoderTest extends \PHPUnit_Framework_TestCase
'<person><firstname>Damien</firstname><lastname>Clay</lastname></person>'.
'</people>'.
'</response>'."\n";
$expected = array(
'people' => array('person' => array(
array('firstname' => 'Benjamin', 'lastname' => 'Alexandre'),
array('firstname' => 'Damien', 'lastname' => 'Clay')
))
);
$this->assertEquals($expected, $this->encoder->decode($source, 'xml'));
}