This commit is contained in:
Fabien Potencier 2012-05-01 14:46:26 +02:00
parent db1d145b35
commit 26f933e7bd
57 changed files with 276 additions and 163 deletions

View File

@ -28,6 +28,7 @@ $finder
->name('*.yml')
->in(__DIR__.'/src')
->notName(basename(__FILE__))
->notName('sfTests.yml')
->exclude('.git')
->exclude('vendor')
;

View File

@ -11,8 +11,6 @@
namespace Symfony\Bridge\Propel1\Tests\Fixtures;
use \PropelPDO;
class ReadOnlyItem extends \BaseObject
{
public function getName()

View File

@ -326,4 +326,4 @@
{% block field_enctype %}{{ block('form_enctype') }}{% endblock %}
{% block field_errors %}{{ block('form_errors') }}{% endblock %}
{% block field_rest %}{{ block('form_rest') }}{% endblock %}
{% block field_rows %}{{ block('form_rows') }}{% endblock %}
{% block field_rows %}{{ block('form_rows') }}{% endblock %}

View File

@ -644,7 +644,7 @@ class FrameworkExtension extends Extension
->replaceArgument(2, $config['debug'])
;
$container->setAlias('annotation_reader', 'annotations.file_cache_reader');
} else if('none' !== $config['cache']) {
} elseif ('none' !== $config['cache']) {
$container
->getDefinition('annotations.cached_reader')
->replaceArgument(1, new Reference($config['cache']))

View File

@ -1 +1 @@
<?php echo $view['form']->renderBlock('widget_attributes') ?>
<?php echo $view['form']->renderBlock('widget_attributes') ?>

View File

@ -1 +1 @@
<?php echo $view['form']->renderBlock('choice_widget_options') ?>
<?php echo $view['form']->renderBlock('choice_widget_options') ?>

View File

@ -1 +1 @@
<?php echo $view['form']->renderBlock('widget_container_attributes') ?>
<?php echo $view['form']->renderBlock('widget_container_attributes') ?>

View File

@ -1 +1 @@
<?php echo $view['form']->renderBlock('form_enctype') ?>
<?php echo $view['form']->renderBlock('form_enctype') ?>

View File

@ -1 +1 @@
<?php echo $view['form']->renderBlock('form_errors') ?>
<?php echo $view['form']->renderBlock('form_errors') ?>

View File

@ -1 +1 @@
<?php echo $view['form']->renderBlock('form_label') ?>
<?php echo $view['form']->renderBlock('form_label') ?>

View File

@ -1 +1 @@
<?php echo $view['form']->renderBlock('form_rest') ?>
<?php echo $view['form']->renderBlock('form_rest') ?>

View File

@ -1 +1 @@
<?php echo $view['form']->renderBlock('form_row') ?>
<?php echo $view['form']->renderBlock('form_row') ?>

View File

@ -1 +1 @@
<?php echo $view['form']->renderBlock('form_rows') ?>
<?php echo $view['form']->renderBlock('form_rows') ?>

View File

@ -1 +1 @@
<?php echo $view['form']->renderBlock('form_widget_single_control') ?>
<?php echo $view['form']->renderBlock('form_widget_single_control') ?>

View File

@ -1,4 +1,4 @@
<div <?php echo $view['form']->renderBlock('widget_container_attributes') ?>>
<?php echo $view['form']->renderBlock('form_rows') ?>
<?php echo $view['form']->rest($form) ?>
</div>
</div>

View File

@ -48,4 +48,4 @@
</td>
</tr>
<?php endif; ?>
<?php endif; ?>
<?php endif; ?>

View File

@ -263,4 +263,4 @@
display: none;
}
}
</style>
</style>

View File

@ -41,4 +41,4 @@
<em><small>Note: The above matching is based on the configuration for the current router which might differ from
the configuration used while routing this request.</small></em>
</li>
</ul>
</ul>

View File

@ -154,6 +154,7 @@ class ClassCollectionLoader
$inNamespace = false;
--$i;
} else {
$output = rtrim($output);
$output .= "\n{";
$inNamespace = true;
}

View File

@ -143,7 +143,7 @@ class ClassLoader
* Loads the given class or interface.
*
* @param string $class The name of the class
*
*
* @return Boolean|null True, if loaded
*/
public function loadClass($class)

View File

@ -73,7 +73,7 @@ class DebugClassLoader
* Loads the given class or interface.
*
* @param string $class The name of the class
*
*
* @return Boolean|null True, if loaded
*/
public function loadClass($class)

View File

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

View File

@ -48,7 +48,7 @@ You can run the unit tests with the following command:
phpunit -c src/Symfony/Component/Console
Resources
---------
---------
[The Console Component](http://symfony.com/doc/current/components/console.html)

View File

@ -265,7 +265,7 @@ class Container implements IntrospectableContainerInterface
throw new ServiceNotFoundException($id);
}
}
/**
* Returns true if the given service has actually been initialized
*

View File

@ -11,11 +11,12 @@
namespace Symfony\Component\DependencyInjection\Dumper;
use Symfony\Component\Yaml\Yaml;
use Symfony\Component\Yaml\Dumper as YmlDumper;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Parameter;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
use Symfony\Component\DependencyInjection\ContainerBuilder;
/**
* YamlDumper dumps a service container as a YAML string.
@ -26,6 +27,22 @@ use Symfony\Component\DependencyInjection\Exception\RuntimeException;
*/
class YamlDumper extends Dumper
{
private $dumper;
/**
* Constructor.
*
* @param ContainerBuilder $container The service container to dump
*
* @api
*/
public function __construct(ContainerBuilder $container)
{
parent::__construct($container);
$this->dumper = new YmlDumper();
}
/**
* Dumps the service container as an YAML string.
*
@ -60,11 +77,11 @@ class YamlDumper extends Dumper
foreach ($tags as $attributes) {
$att = array();
foreach ($attributes as $key => $value) {
$att[] = sprintf('%s: %s', Yaml::dump($key), Yaml::dump($value));
$att[] = sprintf('%s: %s', $this->dumper->dump($key), $this->dumper->dump($value));
}
$att = $att ? ', '.implode(' ', $att) : '';
$tagsCode .= sprintf(" - { name: %s%s }\n", Yaml::dump($name), $att);
$tagsCode .= sprintf(" - { name: %s%s }\n", $this->dumper->dump($name), $att);
}
}
if ($tagsCode) {
@ -84,15 +101,15 @@ class YamlDumper extends Dumper
}
if ($definition->getArguments()) {
$code .= sprintf(" arguments: %s\n", Yaml::dump($this->dumpValue($definition->getArguments()), 0));
$code .= sprintf(" arguments: %s\n", $this->dumper->dump($this->dumpValue($definition->getArguments()), 0));
}
if ($definition->getProperties()) {
$code .= sprintf(" properties: %s\n", Yaml::dump($this->dumpValue($definition->getProperties()), 0));
$code .= sprintf(" properties: %s\n", $this->dumper->dump($this->dumpValue($definition->getProperties()), 0));
}
if ($definition->getMethodCalls()) {
$code .= sprintf(" calls:\n %s\n", str_replace("\n", "\n ", Yaml::dump($this->dumpValue($definition->getMethodCalls()), 1)));
$code .= sprintf(" calls:\n%s\n", $this->dumper->dump($this->dumpValue($definition->getMethodCalls()), 1, 12));
}
if (ContainerInterface::SCOPE_CONTAINER !== $scope = $definition->getScope()) {
@ -108,7 +125,7 @@ class YamlDumper extends Dumper
}
}
$code .= sprintf(" configurator: %s\n", Yaml::dump($callable, 0));
$code .= sprintf(" configurator: %s\n", $this->dumper->dump($callable, 0));
}
return $code;
@ -171,7 +188,7 @@ class YamlDumper extends Dumper
$parameters = $this->container->getParameterBag()->all();
}
return Yaml::dump(array('parameters' => $parameters), 2);
return $this->dumper->dump(array('parameters' => $parameters), 2);
}
/**

View File

@ -24,10 +24,10 @@ interface IntrospectableContainerInterface extends ContainerInterface
* Check for whether or not a service has been initialized.
*
* @param string $id
*
*
* @return Boolean true if the service has been initialized, false otherwise
*
*/
function initialized($id);
}
}

View File

@ -48,8 +48,8 @@ If your service is retrieved by calling a static method:
File Include:
For some services, especially those that are difficult or impossible to
autoload, you may need the container to include a file before
For some services, especially those that are difficult or impossible to
autoload, you may need the container to include a file before
instantiating your class.
$sc = new ContainerBuilder();

View File

@ -104,6 +104,7 @@ class ProjectServiceContainer extends Container
protected function getFooBarService()
{
$class = $this->getParameter('foo_class');
return $this->services['foo_bar'] = new $class();
}

View File

@ -15,7 +15,7 @@ services:
calls:
- [setBar, ['@bar']]
- [initialize, { }]
scope: prototype
configurator: sc_configure
bar:
@ -36,7 +36,7 @@ services:
- [setBar, ['@?foo2']]
- [setBar, ['@?foo3']]
- [setBar, ['@?foobaz']]
factory_service:
factory_method: getInstance
factory_service: foo.baz

View File

@ -558,7 +558,7 @@ class Finder implements \IteratorAggregate, \Countable
throw new \InvalidArgumentException('Finder::append() method wrong argument type.');
}
}
/**
* Counts all the results collected by the iterators.
*

View File

@ -320,33 +320,33 @@ class FinderTest extends Iterator\RealIteratorTestCase
$this->assertIterator($this->toAbsolute(array('foo', 'foo/bar.tmp', 'toto')), $finder->getIterator());
}
public function testCountDirectories()
{
$finder = new Finder();
$directory = $finder->directories()->in(self::$tmpDir);
$i = 0;
foreach ($directory as $dir) {
$i++;
}
$this->assertCount($i, $directory);
}
public function testCountFiles()
{
$finder = new Finder();
$files = $finder->files()->in(__DIR__.DIRECTORY_SEPARATOR.'Fixtures');
$i = 0;
foreach ($files as $file) {
$i++;
}
$this->assertCount($i, $files);
}
public function testCountWithoutIn()
{
$finder = new Finder();

View File

@ -62,4 +62,4 @@ class TestMultiplePcreFilterIterator extends MultiplePcreFilterIterator
{
throw new \BadFunctionCallException('Not implemented');
}
}
}

View File

@ -69,4 +69,4 @@ CHANGELOG
* added method `guessPattern` to FormTypeGuesserInterface to guess which pattern to use in the HTML5 attribute "pattern"
* deprecated method `guessMinLength` in favor of `guessPattern`
* labels don't display field attributes anymore. Label attributes can be
passed in the "label_attr" option/variable
passed in the "label_attr" option/variable

View File

@ -317,4 +317,4 @@ class DefaultOptions
}
}
}
}
}

View File

@ -70,4 +70,4 @@ class LazyOption
return $this->closure->__invoke($options, $this->previousValue);
}
}
}

View File

@ -203,8 +203,8 @@ class Options implements ArrayAccess, Iterator
*/
public function offsetExists($option)
{
return isset($this->options[$option]);
}
return isset($this->options[$option]);
}
/**
* Returns the value of the given option.
@ -220,7 +220,7 @@ class Options implements ArrayAccess, Iterator
* between two lazy options.
*
* @see ArrayAccess::offsetGet()
*/
*/
public function offsetGet($option)
{
if (!array_key_exists($option, $this->options)) {
@ -243,8 +243,8 @@ class Options implements ArrayAccess, Iterator
$this->lock[$option] = false;
}
return $this->options[$option];
}
return $this->options[$option];
}
/**
* Sets the value of a given option.
@ -259,7 +259,7 @@ class Options implements ArrayAccess, Iterator
*
* @see DefaultOptions::add()
* @see ArrayAccess::offsetSet()
*/
*/
public function offsetSet($option, $value)
{
// Setting is not possible once an option is read, because then lazy
@ -288,7 +288,7 @@ class Options implements ArrayAccess, Iterator
}
$this->options[$option] = $newValue;
}
}
/**
* Removes an option with the given name.
@ -300,7 +300,7 @@ class Options implements ArrayAccess, Iterator
* becomes immutable.
*
* @see ArrayAccess::offsetUnset()
*/
*/
public function offsetUnset($option)
{
if ($this->resolved) {
@ -308,8 +308,8 @@ class Options implements ArrayAccess, Iterator
}
unset($this->options[$option]);
unset($this->allowedValues[$option]);
unset($this->lock[$option]);
unset($this->allowedValues[$option]);
unset($this->lock[$option]);
}
/**
@ -324,41 +324,41 @@ class Options implements ArrayAccess, Iterator
/**
* @see Iterator::current()
*/
*/
public function current()
{
return $this->offsetGet($this->key());
}
return $this->offsetGet($this->key());
}
/**
* @see Iterator::next()
*/
*/
public function next()
{
next($this->options);
}
next($this->options);
}
/**
* @see Iterator::key()
*/
*/
public function key()
{
return key($this->options);
}
return key($this->options);
}
/**
* @see Iterator::valid()
*/
*/
public function valid()
{
return null !== $this->key();
}
return null !== $this->key();
}
/**
* @see Iterator::rewind()
*/
*/
public function rewind()
{
reset($this->options);
reset($this->options);
}
}
}

View File

@ -73,4 +73,4 @@ class DefaultOptionsTest extends \PHPUnit_Framework_TestCase
'foo' => 'bam',
));
}
}
}

View File

@ -10,8 +10,8 @@
*/
namespace Symfony\Component\Form\Tests\Extension\Core\EventListener;
use Symfony\Component\Form\Tests\Fixtures\CustomArrayObject;
use Symfony\Component\Form\Tests\Fixtures\CustomArrayObject;
class MergeCollectionListenerCustomArrayObjectTest extends MergeCollectionListenerTest
{

View File

@ -2,8 +2,6 @@
namespace Symfony\Component\Form\Tests\Fixtures;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilder;

View File

@ -11,60 +11,60 @@
namespace Symfony\Component\Form\Tests\Fixtures;
/**
* This class is a hand written simplified version of PHP native `ArrayObject`
* class, to show that it behaves differently than the PHP native implementation.
*/
class CustomArrayObject implements \ArrayAccess, \IteratorAggregate, \Countable, \Serializable
{
private $array;
public function __construct(array $array = null)
{
$this->array = $array ?: array();
}
public function offsetExists($offset)
{
return array_key_exists($offset, $this->array);
}
public function offsetGet($offset)
{
return $this->array[$offset];
}
public function offsetSet($offset, $value)
{
if (null === $offset) {
$this->array[] = $value;
} else {
$this->array[$offset] = $value;
}
}
public function offsetUnset($offset)
{
unset($this->array[$offset]);
}
public function getIterator()
{
return new \ArrayIterator($this->array);
}
public function count()
{
return count($this->array);
}
public function serialize()
{
return serialize($this->array);
}
public function unserialize($serialized)
{
$this->array = (array) unserialize((string) $serialized);
}
}
/**
* This class is a hand written simplified version of PHP native `ArrayObject`
* class, to show that it behaves differently than the PHP native implementation.
*/
class CustomArrayObject implements \ArrayAccess, \IteratorAggregate, \Countable, \Serializable
{
private $array;
public function __construct(array $array = null)
{
$this->array = $array ?: array();
}
public function offsetExists($offset)
{
return array_key_exists($offset, $this->array);
}
public function offsetGet($offset)
{
return $this->array[$offset];
}
public function offsetSet($offset, $value)
{
if (null === $offset) {
$this->array[] = $value;
} else {
$this->array[$offset] = $value;
}
}
public function offsetUnset($offset)
{
unset($this->array[$offset]);
}
public function getIterator()
{
return new \ArrayIterator($this->array);
}
public function count()
{
return count($this->array);
}
public function serialize()
{
return serialize($this->array);
}
public function unserialize($serialized)
{
$this->array = (array) unserialize((string) $serialized);
}
}

View File

@ -40,9 +40,9 @@ class OptionsTest extends \PHPUnit_Framework_TestCase
$this->assertFalse(isset($this->options['bar']));
$this->assertEquals(0, $this->options['foo']);
}
/**
* @expectedException \OutOfBoundsException
/**
* @expectedException \OutOfBoundsException
*/
public function testGetNonExisting()
{
@ -165,4 +165,4 @@ class OptionsTest extends \PHPUnit_Framework_TestCase
$this->options['foo'];
}
}
}

View File

@ -120,6 +120,7 @@ class MemcacheSessionHandler implements \SessionHandlerInterface
if (!$this->memcache->replace($this->prefix.$sessionId, $data, 0, $this->memcacheOptions['expiretime'])) {
return $this->memcache->set($this->prefix.$sessionId, $data, 0, $this->memcacheOptions['expiretime']);
}
return true;
}

View File

@ -142,4 +142,4 @@ class MongoDbSessionHandler implements \SessionHandlerInterface
return $this->collection;
}
}
}

View File

@ -1053,7 +1053,7 @@ class RequestTest extends \PHPUnit_Framework_TestCase
array('fo%2Bo/bar', 'fo+o', 'fo%2Bo'),
);
}
private function stopTrustingProxyData()
{
$class = new \ReflectionClass('Symfony\\Component\\HttpFoundation\\Request');

View File

@ -96,4 +96,4 @@ class MongoDbSessionHandlerTest extends \PHPUnit_Framework_TestCase
$this->assertEquals(0, $coll->count());
}
}
}

View File

@ -40,8 +40,10 @@ class MemcacheMock
{
if ('127.0.0.1' == $host && 11211 == $port) {
$this->connected = true;
return true;
}
return false;
}
@ -58,8 +60,10 @@ class MemcacheMock
{
if ('127.0.0.1' == $host && 11211 == $port) {
$this->connected = true;
return true;
}
return false;
}
@ -82,8 +86,10 @@ class MemcacheMock
{
if ('127.0.0.1' == $host && 11211 == $port) {
$this->connected = true;
return true;
}
return false;
}
@ -105,8 +111,10 @@ class MemcacheMock
if (!isset($this->storage[$key])) {
$this->storeData($key, $var);
return true;
}
return false;
}
@ -127,6 +135,7 @@ class MemcacheMock
}
$this->storeData($key, $var);
return true;
}
@ -148,8 +157,10 @@ class MemcacheMock
if (isset($this->storage[$key])) {
$this->storeData($key, $var);
return true;
}
return false;
}
@ -174,6 +185,7 @@ class MemcacheMock
$result[] = $this->getData($k);
}
}
return $result;
}
@ -195,8 +207,10 @@ class MemcacheMock
if (isset($this->storage[$key])) {
unset($this->storage[$key]);
return true;
}
return false;
}
@ -212,6 +226,7 @@ class MemcacheMock
}
$this->storage = array();
return true;
}
@ -223,6 +238,7 @@ class MemcacheMock
public function close()
{
$this->connected = false;
return true;
}
@ -231,12 +247,14 @@ class MemcacheMock
if (isset($this->storage[$key])) {
return unserialize($this->storage[$key]);
}
return false;
}
private function storeData($key, $value)
{
$this->storage[$key] = serialize($value);
return true;
}
}

View File

@ -53,8 +53,10 @@ class MemcachedMock
{
if ('127.0.0.1' == $host && 11211 == $port) {
$this->connected = true;
return true;
}
return false;
}
@ -75,8 +77,10 @@ class MemcachedMock
if (!isset($this->storage[$key])) {
$this->storeData($key, $value);
return true;
}
return false;
}
@ -96,6 +100,7 @@ class MemcachedMock
}
$this->storeData($key, $value);
return true;
}
@ -116,8 +121,10 @@ class MemcachedMock
if (isset($this->storage[$key])) {
$this->storeData($key, $value);
return true;
}
return false;
}
@ -155,8 +162,10 @@ class MemcachedMock
if (isset($this->storage[$key])) {
$this->storeData($key, $this->getData($key).$value);
return true;
}
return false;
}
@ -175,8 +184,10 @@ class MemcachedMock
if (isset($this->storage[$key])) {
unset($this->storage[$key]);
return true;
}
return false;
}
@ -192,6 +203,7 @@ class MemcachedMock
}
$this->storage = array();
return true;
}
@ -200,12 +212,14 @@ class MemcachedMock
if (isset($this->storage[$key])) {
return unserialize($this->storage[$key]);
}
return false;
}
private function storeData($key, $value)
{
$this->storage[$key] = serialize($value);
return true;
}
}

View File

@ -41,8 +41,10 @@ class RedisMock
{
if ('127.0.0.1' == $host && 6379 == $port) {
$this->connected = true;
return true;
}
return false;
}
@ -95,6 +97,7 @@ class RedisMock
}
$this->storeData($key, $value);
return true;
}
@ -115,6 +118,7 @@ class RedisMock
if (isset($this->storage[$key])) {
return true;
}
return false;
}
@ -150,8 +154,10 @@ class RedisMock
if (isset($this->storage[$key])) {
$this->storeData($key, $this->getData($key).$value);
return strlen($this->storage[$key]);
}
return false;
}
@ -176,13 +182,16 @@ class RedisMock
++$result;
}
}
return $result;
}
if (isset($this->storage[$key])) {
unset($this->storage[$key]);
return 1;
}
return 0;
}
@ -198,6 +207,7 @@ class RedisMock
}
$this->storage = array();
return true;
}
@ -209,6 +219,7 @@ class RedisMock
public function close()
{
$this->connected = false;
return true;
}
@ -217,12 +228,14 @@ class RedisMock
if (isset($this->storage[$key])) {
return unserialize($this->storage[$key]);
}
return false;
}
private function storeData($key, $value)
{
$this->storage[$key] = serialize($value);
return true;
}
}

View File

@ -231,6 +231,7 @@ EOF;
goto $gotoname;
}
EOF;
} else {
$methods = implode("', '", $methods);
@ -240,6 +241,7 @@ EOF;
goto $gotoname;
}
EOF;
}
}
@ -250,6 +252,7 @@ EOF;
return \$this->redirect(\$pathinfo.'/', '$name');
}
EOF;
}
@ -263,6 +266,7 @@ EOF;
return \$this->redirect(\$pathinfo, '$name', '$scheme');
}
EOF;
}
@ -271,7 +275,7 @@ EOF;
$code .= sprintf(" return array_merge(\$this->mergeDefaults(\$matches, %s), array('_route' => '%s'));\n"
, str_replace("\n", '', var_export($compiledRoute->getDefaults(), true)), $name);
} elseif (true === $matches) {
$code .= sprintf(" \$matches['_route'] = '%s';\n", $name);
$code .= sprintf(" \$matches['_route'] = '%s';\n\n", $name);
$code .= " return \$matches;\n";
} elseif ($compiledRoute->getDefaults()) {
$code .= sprintf(" return %s;\n", str_replace("\n", '', var_export(array_merge($compiledRoute->getDefaults(), array('_route' => $name)), true)));

View File

@ -36,7 +36,9 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
$allow = array_merge($allow, array('GET', 'HEAD'));
goto not_bar;
}
$matches['_route'] = 'bar';
return $matches;
}
not_bar:
@ -47,7 +49,9 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
$allow = array_merge($allow, array('GET', 'HEAD'));
goto not_barhead;
}
$matches['_route'] = 'barhead';
return $matches;
}
not_barhead:
@ -70,6 +74,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
// baz4
if (0 === strpos($pathinfo, '/test') && preg_match('#^/test/(?<foo>[^/]+?)/$#s', $pathinfo, $matches)) {
$matches['_route'] = 'baz4';
return $matches;
}
@ -79,7 +84,9 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
$allow[] = 'POST';
goto not_baz5;
}
$matches['_route'] = 'baz5';
return $matches;
}
not_baz5:
@ -90,7 +97,9 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
$allow[] = 'PUT';
goto not_bazbaz6;
}
$matches['_route'] = 'baz.baz6';
return $matches;
}
not_bazbaz6:
@ -103,6 +112,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
// quoter
if (preg_match('#^/(?<quoter>[\']+)$#s', $pathinfo, $matches)) {
$matches['_route'] = 'quoter';
return $matches;
}
@ -116,12 +126,14 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
// foo1
if (preg_match('#^/a/b\'b/(?<foo>[^/]+?)$#s', $pathinfo, $matches)) {
$matches['_route'] = 'foo1';
return $matches;
}
// bar1
if (preg_match('#^/a/b\'b/(?<bar>[^/]+?)$#s', $pathinfo, $matches)) {
$matches['_route'] = 'bar1';
return $matches;
}
@ -130,6 +142,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
// overriden
if (preg_match('#^/a/(?<var>.*)$#s', $pathinfo, $matches)) {
$matches['_route'] = 'overriden';
return $matches;
}
@ -137,12 +150,14 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
// foo2
if (preg_match('#^/a/b\'b/(?<foo1>[^/]+?)$#s', $pathinfo, $matches)) {
$matches['_route'] = 'foo2';
return $matches;
}
// bar2
if (preg_match('#^/a/b\'b/(?<bar1>[^/]+?)$#s', $pathinfo, $matches)) {
$matches['_route'] = 'bar2';
return $matches;
}
@ -171,12 +186,14 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
// foo3
if (preg_match('#^/(?<_locale>[^/]+?)/b/(?<foo>[^/]+?)$#s', $pathinfo, $matches)) {
$matches['_route'] = 'foo3';
return $matches;
}
// bar3
if (preg_match('#^/(?<_locale>[^/]+?)/b/(?<bar>[^/]+?)$#s', $pathinfo, $matches)) {
$matches['_route'] = 'bar3';
return $matches;
}
@ -188,6 +205,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
// foo4
if (0 === strpos($pathinfo, '/aba') && preg_match('#^/aba/(?<foo>[^/]+?)$#s', $pathinfo, $matches)) {
$matches['_route'] = 'foo4';
return $matches;
}
@ -201,12 +219,14 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
// b
if (preg_match('#^/a/b/(?<var>[^/]+?)$#s', $pathinfo, $matches)) {
$matches['_route'] = 'b';
return $matches;
}
// c
if (0 === strpos($pathinfo, '/a/b/c') && preg_match('#^/a/b/c/(?<var>[^/]+?)$#s', $pathinfo, $matches)) {
$matches['_route'] = 'c';
return $matches;
}

View File

@ -36,7 +36,9 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
$allow = array_merge($allow, array('GET', 'HEAD'));
goto not_bar;
}
$matches['_route'] = 'bar';
return $matches;
}
not_bar:
@ -47,7 +49,9 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
$allow = array_merge($allow, array('GET', 'HEAD'));
goto not_barhead;
}
$matches['_route'] = 'barhead';
return $matches;
}
not_barhead:
@ -67,6 +71,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
if (substr($pathinfo, -1) !== '/') {
return $this->redirect($pathinfo.'/', 'baz3');
}
return array('_route' => 'baz3');
}
@ -75,7 +80,9 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
if (substr($pathinfo, -1) !== '/') {
return $this->redirect($pathinfo.'/', 'baz4');
}
$matches['_route'] = 'baz4';
return $matches;
}
@ -85,7 +92,9 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
$allow[] = 'POST';
goto not_baz5;
}
$matches['_route'] = 'baz5';
return $matches;
}
not_baz5:
@ -96,7 +105,9 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
$allow[] = 'PUT';
goto not_bazbaz6;
}
$matches['_route'] = 'baz.baz6';
return $matches;
}
not_bazbaz6:
@ -109,6 +120,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
// quoter
if (preg_match('#^/(?<quoter>[\']+)$#s', $pathinfo, $matches)) {
$matches['_route'] = 'quoter';
return $matches;
}
@ -122,12 +134,14 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
// foo1
if (preg_match('#^/a/b\'b/(?<foo>[^/]+?)$#s', $pathinfo, $matches)) {
$matches['_route'] = 'foo1';
return $matches;
}
// bar1
if (preg_match('#^/a/b\'b/(?<bar>[^/]+?)$#s', $pathinfo, $matches)) {
$matches['_route'] = 'bar1';
return $matches;
}
@ -136,6 +150,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
// overriden
if (preg_match('#^/a/(?<var>.*)$#s', $pathinfo, $matches)) {
$matches['_route'] = 'overriden';
return $matches;
}
@ -143,12 +158,14 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
// foo2
if (preg_match('#^/a/b\'b/(?<foo1>[^/]+?)$#s', $pathinfo, $matches)) {
$matches['_route'] = 'foo2';
return $matches;
}
// bar2
if (preg_match('#^/a/b\'b/(?<bar1>[^/]+?)$#s', $pathinfo, $matches)) {
$matches['_route'] = 'bar2';
return $matches;
}
@ -172,6 +189,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
if (substr($pathinfo, -1) !== '/') {
return $this->redirect($pathinfo.'/', 'hey');
}
return array('_route' => 'hey');
}
@ -180,12 +198,14 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
// foo3
if (preg_match('#^/(?<_locale>[^/]+?)/b/(?<foo>[^/]+?)$#s', $pathinfo, $matches)) {
$matches['_route'] = 'foo3';
return $matches;
}
// bar3
if (preg_match('#^/(?<_locale>[^/]+?)/b/(?<bar>[^/]+?)$#s', $pathinfo, $matches)) {
$matches['_route'] = 'bar3';
return $matches;
}
@ -197,6 +217,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
// foo4
if (0 === strpos($pathinfo, '/aba') && preg_match('#^/aba/(?<foo>[^/]+?)$#s', $pathinfo, $matches)) {
$matches['_route'] = 'foo4';
return $matches;
}
@ -210,12 +231,14 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
// b
if (preg_match('#^/a/b/(?<var>[^/]+?)$#s', $pathinfo, $matches)) {
$matches['_route'] = 'b';
return $matches;
}
// c
if (0 === strpos($pathinfo, '/a/b/c') && preg_match('#^/a/b/c/(?<var>[^/]+?)$#s', $pathinfo, $matches)) {
$matches['_route'] = 'c';
return $matches;
}
@ -228,6 +251,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
if ($this->context->getScheme() !== 'https') {
return $this->redirect($pathinfo, 'secure', 'https');
}
return array('_route' => 'secure');
}
@ -236,6 +260,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
if ($this->context->getScheme() !== 'http') {
return $this->redirect($pathinfo, 'nonsecure', 'http');
}
return array('_route' => 'nonsecure');
}

View File

@ -34,6 +34,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
// dynamic
if (preg_match('#^/rootprefix/(?<var>[^/]+?)$#s', $pathinfo, $matches)) {
$matches['_route'] = 'dynamic';
return $matches;
}

View File

@ -12,13 +12,13 @@
namespace Symfony\Component\Security\Tests\Acl\Domain
{
use Symfony\Component\Security\Acl\Domain\ObjectIdentity;
class ObjectIdentityTest extends \PHPUnit_Framework_TestCase
{
public function testConstructor()
{
$id = new ObjectIdentity('fooid', 'footype');
$this->assertEquals('fooid', $id->getIdentifier());
$this->assertEquals('footype', $id->getType());
}
@ -31,7 +31,7 @@ namespace Symfony\Component\Security\Tests\Acl\Domain
$this->assertEquals('fooid', $id->getIdentifier());
$this->assertEquals('Acme\DemoBundle\Proxy\__CG__\Symfony\Component\Security\Tests\Acl\Domain\TestDomainObject', $id->getType());
}
public function testFromDomainObjectPrefersInterfaceOverGetId()
{
$domainObject = $this->getMock('Symfony\Component\Security\Acl\Model\DomainObjectInterface');
@ -45,11 +45,11 @@ namespace Symfony\Component\Security\Tests\Acl\Domain
->method('getId')
->will($this->returnValue('getId()'))
;
$id = ObjectIdentity::fromDomainObject($domainObject);
$this->assertEquals('getObjectIdentifier()', $id->getIdentifier());
}
public function testFromDomainObjectWithoutInterface()
{
$id = ObjectIdentity::fromDomainObject(new TestDomainObject());
@ -63,7 +63,7 @@ namespace Symfony\Component\Security\Tests\Acl\Domain
$this->assertEquals('getId()', $id->getIdentifier());
$this->assertEquals('Symfony\Component\Security\Tests\Acl\Domain\TestDomainObject', $id->getType());
}
/**
* @dataProvider getCompareData
*/
@ -75,7 +75,7 @@ namespace Symfony\Component\Security\Tests\Acl\Domain
$this->assertFalse($oid1->equals($oid2));
}
}
public function getCompareData()
{
return array(
@ -85,7 +85,7 @@ namespace Symfony\Component\Security\Tests\Acl\Domain
array(new ObjectIdentity('1', 'bla'), new ObjectIdentity('1', 'blub'), false),
);
}
protected function setUp()
{
if (!class_exists('Doctrine\DBAL\DriverManager')) {
@ -93,14 +93,14 @@ namespace Symfony\Component\Security\Tests\Acl\Domain
}
}
}
class TestDomainObject
{
public function getObjectIdentifier()
{
return 'getObjectIdentifier()';
}
public function getId()
{
return 'getId()';

View File

@ -3,7 +3,7 @@
namespace Symfony\Component\Security\Tests\Core\Util
{
use Symfony\Component\Security\Core\Util\ClassUtils;
class ClassUtilsTest extends \PHPUnit_Framework_TestCase
{
static public function dataGetClass()
@ -18,7 +18,7 @@ namespace Symfony\Component\Security\Tests\Core\Util
array(new \Acme\DemoBundle\Proxy\__CG__\Symfony\Component\Security\Tests\Core\Util\TestObject(), 'Symfony\Component\Security\Tests\Core\Util\TestObject'),
);
}
/**
* @dataProvider dataGetClass
*/

View File

@ -134,6 +134,7 @@ class GetSetMethodNormalizerTest extends \PHPUnit_Framework_TestCase
foreach ($bars as $bar) {
$foos .= $bar->getFoo();
}
return $foos;
},
),

View File

@ -54,7 +54,7 @@ class EmailValidator extends ConstraintValidator
// Check for host DNS resource records
if ($valid && $constraint->checkMX) {
$valid = $this->checkMX($host);
} else if ($valid && $constraint->checkHost) {
} elseif ($valid && $constraint->checkHost) {
$valid = $this->checkHost($host);
}
}
@ -75,12 +75,12 @@ class EmailValidator extends ConstraintValidator
{
return checkdnsrr($host, 'MX');
}
/**
* Check if one of MX, A or AAAA DNS RR exists.
*
* @param string $host Hostname
*
*
* @return Boolean
*/
private function checkHost($host)

View File

@ -56,7 +56,7 @@ class ExecutionContext
* @param string $message The error message.
* @param array $params The parameters parsed into the error message.
* @param mixed $invalidValue The invalid, validated value.
* @param integer|null $pluralization The number to use to pluralize of the message.
* @param integer|null $pluralization The number to use to pluralize of the message.
*
* @api
*/
@ -81,7 +81,7 @@ class ExecutionContext
* @param string $message The error message.
* @param array $params The parameters parsed into the error message.
* @param mixed $invalidValue The invalid, validated value.
* @param integer|null $pluralization The number to use to pluralize of the message.
* @param integer|null $pluralization The number to use to pluralize of the message.
*/
public function addViolationAtPath($propertyPath, $message, array $params = array(), $invalidValue = null, $pluralization = null)
{
@ -104,7 +104,7 @@ class ExecutionContext
* @param string $message The error message.
* @param array $params The parameters parsed into the error message.
* @param mixed $invalidValue The invalid, validated value.
* @param integer|null $pluralization The number to use to pluralize of the message.
* @param integer|null $pluralization The number to use to pluralize of the message.
*/
public function addViolationAtSubPath($subPath, $message, array $params = array(), $invalidValue = null, $pluralization = null)
{