Merge branch '2.7' into 2.8
* 2.7: Refactoring tests.
This commit is contained in:
commit
263eda3dd6
@ -150,7 +150,7 @@ abstract class CompleteConfigurationTest extends TestCase
|
|||||||
list($matcherId, $attributes, $channel) = $rule;
|
list($matcherId, $attributes, $channel) = $rule;
|
||||||
$requestMatcher = $container->getDefinition($matcherId);
|
$requestMatcher = $container->getDefinition($matcherId);
|
||||||
|
|
||||||
$this->assertFalse(isset($matcherIds[$matcherId]));
|
$this->assertArrayNotHasKey($matcherId, $matcherIds);
|
||||||
$matcherIds[$matcherId] = true;
|
$matcherIds[$matcherId] = true;
|
||||||
|
|
||||||
$i = count($matcherIds);
|
$i = count($matcherIds);
|
||||||
|
@ -110,9 +110,9 @@ class MainConfigurationTest extends TestCase
|
|||||||
$processor = new Processor();
|
$processor = new Processor();
|
||||||
$configuration = new MainConfiguration(array(), array());
|
$configuration = new MainConfiguration(array(), array());
|
||||||
$processedConfig = $processor->processConfiguration($configuration, array($config));
|
$processedConfig = $processor->processConfiguration($configuration, array($config));
|
||||||
$this->assertTrue(isset($processedConfig['firewalls']['stub']['logout']['csrf_token_generator']));
|
$this->assertArrayHasKey('csrf_token_generator', $processedConfig['firewalls']['stub']['logout']);
|
||||||
$this->assertEquals('a_token_generator', $processedConfig['firewalls']['stub']['logout']['csrf_token_generator']);
|
$this->assertEquals('a_token_generator', $processedConfig['firewalls']['stub']['logout']['csrf_token_generator']);
|
||||||
$this->assertTrue(isset($processedConfig['firewalls']['stub']['logout']['csrf_token_id']));
|
$this->assertArrayHasKey('csrf_token_id', $processedConfig['firewalls']['stub']['logout']);
|
||||||
$this->assertEquals('a_token_id', $processedConfig['firewalls']['stub']['logout']['csrf_token_id']);
|
$this->assertEquals('a_token_id', $processedConfig['firewalls']['stub']['logout']['csrf_token_id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ class ArrayNodeDefinitionTest extends TestCase
|
|||||||
->append($child);
|
->append($child);
|
||||||
|
|
||||||
$this->assertCount(3, $this->getField($parent, 'children'));
|
$this->assertCount(3, $this->getField($parent, 'children'));
|
||||||
$this->assertTrue(in_array($child, $this->getField($parent, 'children')));
|
$this->assertContains($child, $this->getField($parent, 'children'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -164,6 +164,6 @@ class DirectoryResourceTest extends TestCase
|
|||||||
$resourceA = new DirectoryResource($this->directory, '/.xml$/');
|
$resourceA = new DirectoryResource($this->directory, '/.xml$/');
|
||||||
$resourceB = new DirectoryResource($this->directory, '/.yaml$/');
|
$resourceB = new DirectoryResource($this->directory, '/.yaml$/');
|
||||||
|
|
||||||
$this->assertEquals(2, count(array_unique(array($resourceA, $resourceB))));
|
$this->assertCount(2, array_unique(array($resourceA, $resourceB)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ class TranslatorTest extends TestCase
|
|||||||
$translator = new Translator();
|
$translator = new Translator();
|
||||||
$document = new \SimpleXMLElement(file_get_contents(__DIR__.'/Fixtures/lang.xml'));
|
$document = new \SimpleXMLElement(file_get_contents(__DIR__.'/Fixtures/lang.xml'));
|
||||||
$elements = $document->xpath($translator->cssToXPath($css));
|
$elements = $document->xpath($translator->cssToXPath($css));
|
||||||
$this->assertEquals(count($elementsId), count($elements));
|
$this->assertCount(count($elementsId), $elements);
|
||||||
foreach ($elements as $element) {
|
foreach ($elements as $element) {
|
||||||
$this->assertTrue(in_array($element->attributes()->id, $elementsId));
|
$this->assertTrue(in_array($element->attributes()->id, $elementsId));
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ class ContainerBuilderTest extends TestCase
|
|||||||
|
|
||||||
$builder->setDefinition('foobar', $foo = new Definition('FooBarClass'));
|
$builder->setDefinition('foobar', $foo = new Definition('FooBarClass'));
|
||||||
$this->assertEquals($foo, $builder->getDefinition('foobar'), '->getDefinition() returns a service definition if defined');
|
$this->assertEquals($foo, $builder->getDefinition('foobar'), '->getDefinition() returns a service definition if defined');
|
||||||
$this->assertTrue($builder->setDefinition('foobar', $foo = new Definition('FooBarClass')) === $foo, '->setDefinition() implements a fluid interface by returning the service reference');
|
$this->assertSame($builder->setDefinition('foobar', $foo = new Definition('FooBarClass')), $foo, '->setDefinition() implements a fluid interface by returning the service reference');
|
||||||
|
|
||||||
$builder->addDefinitions($defs = array('foobar' => new Definition('FooBarClass')));
|
$builder->addDefinitions($defs = array('foobar' => new Definition('FooBarClass')));
|
||||||
$this->assertEquals(array_merge($definitions, $defs), $builder->getDefinitions(), '->addDefinitions() adds the service definitions');
|
$this->assertEquals(array_merge($definitions, $defs), $builder->getDefinitions(), '->addDefinitions() adds the service definitions');
|
||||||
@ -189,7 +189,7 @@ class ContainerBuilderTest extends TestCase
|
|||||||
$this->assertFalse($builder->hasAlias('foobar'), '->hasAlias() returns false if the alias does not exist');
|
$this->assertFalse($builder->hasAlias('foobar'), '->hasAlias() returns false if the alias does not exist');
|
||||||
$this->assertEquals('foo', (string) $builder->getAlias('bar'), '->getAlias() returns the aliased service');
|
$this->assertEquals('foo', (string) $builder->getAlias('bar'), '->getAlias() returns the aliased service');
|
||||||
$this->assertTrue($builder->has('bar'), '->setAlias() defines a new service');
|
$this->assertTrue($builder->has('bar'), '->setAlias() defines a new service');
|
||||||
$this->assertTrue($builder->get('bar') === $builder->get('foo'), '->setAlias() creates a service that is an alias to another one');
|
$this->assertSame($builder->get('bar'), $builder->get('foo'), '->setAlias() creates a service that is an alias to another one');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$builder->setAlias('foobar', 'foobar');
|
$builder->setAlias('foobar', 'foobar');
|
||||||
@ -234,8 +234,8 @@ class ContainerBuilderTest extends TestCase
|
|||||||
$builder->setAliases(array('bar' => 'foo', 'foobar' => 'foo'));
|
$builder->setAliases(array('bar' => 'foo', 'foobar' => 'foo'));
|
||||||
|
|
||||||
$aliases = $builder->getAliases();
|
$aliases = $builder->getAliases();
|
||||||
$this->assertTrue(isset($aliases['bar']));
|
$this->assertArrayHasKey('bar', $aliases);
|
||||||
$this->assertTrue(isset($aliases['foobar']));
|
$this->assertArrayHasKey('foobar', $aliases);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testAddAliases()
|
public function testAddAliases()
|
||||||
@ -245,8 +245,8 @@ class ContainerBuilderTest extends TestCase
|
|||||||
$builder->addAliases(array('foobar' => 'foo'));
|
$builder->addAliases(array('foobar' => 'foo'));
|
||||||
|
|
||||||
$aliases = $builder->getAliases();
|
$aliases = $builder->getAliases();
|
||||||
$this->assertTrue(isset($aliases['bar']));
|
$this->assertArrayHasKey('bar', $aliases);
|
||||||
$this->assertTrue(isset($aliases['foobar']));
|
$this->assertArrayHasKey('foobar', $aliases);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSetReplacesAlias()
|
public function testSetReplacesAlias()
|
||||||
@ -506,7 +506,7 @@ class ContainerBuilderTest extends TestCase
|
|||||||
$this->assertEquals(array('foo', 'bar', 'baz'), array_keys($container->getDefinitions()), '->merge() merges definitions already defined ones');
|
$this->assertEquals(array('foo', 'bar', 'baz'), array_keys($container->getDefinitions()), '->merge() merges definitions already defined ones');
|
||||||
|
|
||||||
$aliases = $container->getAliases();
|
$aliases = $container->getAliases();
|
||||||
$this->assertTrue(isset($aliases['alias_for_foo']));
|
$this->assertArrayHasKey('alias_for_foo', $aliases);
|
||||||
$this->assertEquals('foo', (string) $aliases['alias_for_foo']);
|
$this->assertEquals('foo', (string) $aliases['alias_for_foo']);
|
||||||
|
|
||||||
$container = new ContainerBuilder();
|
$container = new ContainerBuilder();
|
||||||
@ -657,7 +657,7 @@ class ContainerBuilderTest extends TestCase
|
|||||||
$container->setResourceTracking(false);
|
$container->setResourceTracking(false);
|
||||||
|
|
||||||
$container->registerExtension($extension = new \ProjectExtension());
|
$container->registerExtension($extension = new \ProjectExtension());
|
||||||
$this->assertTrue($container->getExtension('project') === $extension, '->registerExtension() registers an extension');
|
$this->assertSame($container->getExtension('project'), $extension, '->registerExtension() registers an extension');
|
||||||
|
|
||||||
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('LogicException');
|
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('LogicException');
|
||||||
$container->getExtension('no_registered');
|
$container->getExtension('no_registered');
|
||||||
|
@ -177,7 +177,7 @@ class ContainerTest extends TestCase
|
|||||||
$c->set('foo', $foo = new \stdClass(), 'foo');
|
$c->set('foo', $foo = new \stdClass(), 'foo');
|
||||||
|
|
||||||
$scoped = $this->getField($c, 'scopedServices');
|
$scoped = $this->getField($c, 'scopedServices');
|
||||||
$this->assertTrue(isset($scoped['foo']['foo']), '->set() sets a scoped service');
|
$this->assertArrayHasKey('foo', $scoped['foo'], '->set() sets a scoped service');
|
||||||
$this->assertSame($foo, $scoped['foo']['foo'], '->set() sets a scoped service');
|
$this->assertSame($foo, $scoped['foo']['foo'], '->set() sets a scoped service');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -400,14 +400,14 @@ class ContainerTest extends TestCase
|
|||||||
$container->set('a', $a, 'bar');
|
$container->set('a', $a, 'bar');
|
||||||
|
|
||||||
$scoped = $this->getField($container, 'scopedServices');
|
$scoped = $this->getField($container, 'scopedServices');
|
||||||
$this->assertTrue(isset($scoped['bar']['a']));
|
$this->assertArrayHasKey('a', $scoped['bar']);
|
||||||
$this->assertSame($a, $scoped['bar']['a']);
|
$this->assertSame($a, $scoped['bar']['a']);
|
||||||
$this->assertTrue($container->has('a'));
|
$this->assertTrue($container->has('a'));
|
||||||
|
|
||||||
$container->leaveScope('foo');
|
$container->leaveScope('foo');
|
||||||
|
|
||||||
$scoped = $this->getField($container, 'scopedServices');
|
$scoped = $this->getField($container, 'scopedServices');
|
||||||
$this->assertFalse(isset($scoped['bar']));
|
$this->assertArrayNotHasKey('bar', $scoped);
|
||||||
$this->assertFalse($container->isScopeActive('foo'));
|
$this->assertFalse($container->isScopeActive('foo'));
|
||||||
$this->assertFalse($container->has('a'));
|
$this->assertFalse($container->has('a'));
|
||||||
}
|
}
|
||||||
@ -433,14 +433,14 @@ class ContainerTest extends TestCase
|
|||||||
$container->set('a', $a, 'foo');
|
$container->set('a', $a, 'foo');
|
||||||
|
|
||||||
$scoped = $this->getField($container, 'scopedServices');
|
$scoped = $this->getField($container, 'scopedServices');
|
||||||
$this->assertTrue(isset($scoped['foo']['a']));
|
$this->assertArrayHasKey('a', $scoped['foo']);
|
||||||
$this->assertSame($a, $scoped['foo']['a']);
|
$this->assertSame($a, $scoped['foo']['a']);
|
||||||
$this->assertTrue($container->has('a'));
|
$this->assertTrue($container->has('a'));
|
||||||
|
|
||||||
$container->enterScope('foo');
|
$container->enterScope('foo');
|
||||||
|
|
||||||
$scoped = $this->getField($container, 'scopedServices');
|
$scoped = $this->getField($container, 'scopedServices');
|
||||||
$this->assertFalse(isset($scoped['a']));
|
$this->assertArrayNotHasKey('a', $scoped);
|
||||||
$this->assertTrue($container->isScopeActive('foo'));
|
$this->assertTrue($container->isScopeActive('foo'));
|
||||||
$this->assertFalse($container->isScopeActive('bar'));
|
$this->assertFalse($container->isScopeActive('bar'));
|
||||||
$this->assertFalse($container->has('a'));
|
$this->assertFalse($container->has('a'));
|
||||||
@ -475,14 +475,14 @@ class ContainerTest extends TestCase
|
|||||||
$container->set('a', $a, 'bar');
|
$container->set('a', $a, 'bar');
|
||||||
|
|
||||||
$scoped = $this->getField($container, 'scopedServices');
|
$scoped = $this->getField($container, 'scopedServices');
|
||||||
$this->assertTrue(isset($scoped['bar']['a']));
|
$this->assertArrayHasKey('a', $scoped['bar']);
|
||||||
$this->assertSame($a, $scoped['bar']['a']);
|
$this->assertSame($a, $scoped['bar']['a']);
|
||||||
$this->assertTrue($container->has('a'));
|
$this->assertTrue($container->has('a'));
|
||||||
|
|
||||||
$container->enterScope('bar');
|
$container->enterScope('bar');
|
||||||
|
|
||||||
$scoped = $this->getField($container, 'scopedServices');
|
$scoped = $this->getField($container, 'scopedServices');
|
||||||
$this->assertFalse(isset($scoped['a']));
|
$this->assertArrayNotHasKey('a', $scoped);
|
||||||
$this->assertTrue($container->isScopeActive('foo'));
|
$this->assertTrue($container->isScopeActive('foo'));
|
||||||
$this->assertTrue($container->isScopeActive('bar'));
|
$this->assertTrue($container->isScopeActive('bar'));
|
||||||
$this->assertFalse($container->has('a'));
|
$this->assertFalse($container->has('a'));
|
||||||
|
@ -94,7 +94,7 @@ class XmlFileLoaderTest extends TestCase
|
|||||||
|
|
||||||
libxml_disable_entity_loader($disableEntities);
|
libxml_disable_entity_loader($disableEntities);
|
||||||
|
|
||||||
$this->assertTrue(count($containerBuilder->getParameterBag()->all()) > 0, 'Parameters can be read from the config file.');
|
$this->assertGreaterThan(0, $containerBuilder->getParameterBag()->all(), 'Parameters can be read from the config file.');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testLoadParameters()
|
public function testLoadParameters()
|
||||||
@ -182,7 +182,7 @@ class XmlFileLoaderTest extends TestCase
|
|||||||
$args = $services['foo']->getArguments();
|
$args = $services['foo']->getArguments();
|
||||||
$this->assertCount(1, $args, '->load() references anonymous services as "normal" ones');
|
$this->assertCount(1, $args, '->load() references anonymous services as "normal" ones');
|
||||||
$this->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Reference', $args[0], '->load() converts anonymous services to references to "normal" services');
|
$this->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Reference', $args[0], '->load() converts anonymous services to references to "normal" services');
|
||||||
$this->assertTrue(isset($services[(string) $args[0]]), '->load() makes a reference to the created ones');
|
$this->assertArrayHasKey((string) $args[0], $services, '->load() makes a reference to the created ones');
|
||||||
$inner = $services[(string) $args[0]];
|
$inner = $services[(string) $args[0]];
|
||||||
$this->assertEquals('BarClass', $inner->getClass(), '->load() uses the same configuration as for the anonymous ones');
|
$this->assertEquals('BarClass', $inner->getClass(), '->load() uses the same configuration as for the anonymous ones');
|
||||||
$this->assertFalse($inner->isPublic());
|
$this->assertFalse($inner->isPublic());
|
||||||
@ -191,7 +191,7 @@ class XmlFileLoaderTest extends TestCase
|
|||||||
$args = $inner->getArguments();
|
$args = $inner->getArguments();
|
||||||
$this->assertCount(1, $args, '->load() references anonymous services as "normal" ones');
|
$this->assertCount(1, $args, '->load() references anonymous services as "normal" ones');
|
||||||
$this->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Reference', $args[0], '->load() converts anonymous services to references to "normal" services');
|
$this->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Reference', $args[0], '->load() converts anonymous services to references to "normal" services');
|
||||||
$this->assertTrue(isset($services[(string) $args[0]]), '->load() makes a reference to the created ones');
|
$this->assertArrayHasKey((string) $args[0], $services, '->load() makes a reference to the created ones');
|
||||||
$inner = $services[(string) $args[0]];
|
$inner = $services[(string) $args[0]];
|
||||||
$this->assertEquals('BazClass', $inner->getClass(), '->load() uses the same configuration as for the anonymous ones');
|
$this->assertEquals('BazClass', $inner->getClass(), '->load() uses the same configuration as for the anonymous ones');
|
||||||
$this->assertFalse($inner->isPublic());
|
$this->assertFalse($inner->isPublic());
|
||||||
@ -200,7 +200,7 @@ class XmlFileLoaderTest extends TestCase
|
|||||||
$properties = $services['foo']->getProperties();
|
$properties = $services['foo']->getProperties();
|
||||||
$property = $properties['p'];
|
$property = $properties['p'];
|
||||||
$this->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Reference', $property, '->load() converts anonymous services to references to "normal" services');
|
$this->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Reference', $property, '->load() converts anonymous services to references to "normal" services');
|
||||||
$this->assertTrue(isset($services[(string) $property]), '->load() makes a reference to the created ones');
|
$this->assertArrayHasKey((string) $property, $services, '->load() makes a reference to the created ones');
|
||||||
$inner = $services[(string) $property];
|
$inner = $services[(string) $property];
|
||||||
$this->assertEquals('BuzClass', $inner->getClass(), '->load() uses the same configuration as for the anonymous ones');
|
$this->assertEquals('BuzClass', $inner->getClass(), '->load() uses the same configuration as for the anonymous ones');
|
||||||
$this->assertFalse($inner->isPublic());
|
$this->assertFalse($inner->isPublic());
|
||||||
@ -252,7 +252,7 @@ class XmlFileLoaderTest extends TestCase
|
|||||||
$loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath.'/xml'));
|
$loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath.'/xml'));
|
||||||
$loader->load('services6.xml');
|
$loader->load('services6.xml');
|
||||||
$services = $container->getDefinitions();
|
$services = $container->getDefinitions();
|
||||||
$this->assertTrue(isset($services['foo']), '->load() parses <service> elements');
|
$this->assertArrayHasKey('foo', $services, '->load() parses <service> elements');
|
||||||
$this->assertFalse($services['not_shared']->isShared(), '->load() parses shared flag');
|
$this->assertFalse($services['not_shared']->isShared(), '->load() parses shared flag');
|
||||||
$this->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Definition', $services['foo'], '->load() converts <service> element to Definition instances');
|
$this->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Definition', $services['foo'], '->load() converts <service> element to Definition instances');
|
||||||
$this->assertEquals('FooClass', $services['foo']->getClass(), '->load() parses the class attribute');
|
$this->assertEquals('FooClass', $services['foo']->getClass(), '->load() parses the class attribute');
|
||||||
@ -268,10 +268,10 @@ class XmlFileLoaderTest extends TestCase
|
|||||||
$this->assertEquals(array('BazClass', 'getInstance'), $services['new_factory3']->getFactory(), '->load() parses the factory tag');
|
$this->assertEquals(array('BazClass', 'getInstance'), $services['new_factory3']->getFactory(), '->load() parses the factory tag');
|
||||||
|
|
||||||
$aliases = $container->getAliases();
|
$aliases = $container->getAliases();
|
||||||
$this->assertTrue(isset($aliases['alias_for_foo']), '->load() parses <service> elements');
|
$this->assertArrayHasKey('alias_for_foo', $aliases, '->load() parses <service> elements');
|
||||||
$this->assertEquals('foo', (string) $aliases['alias_for_foo'], '->load() parses aliases');
|
$this->assertEquals('foo', (string) $aliases['alias_for_foo'], '->load() parses aliases');
|
||||||
$this->assertTrue($aliases['alias_for_foo']->isPublic());
|
$this->assertTrue($aliases['alias_for_foo']->isPublic());
|
||||||
$this->assertTrue(isset($aliases['another_alias_for_foo']));
|
$this->assertArrayHasKey('another_alias_for_foo', $aliases);
|
||||||
$this->assertEquals('foo', (string) $aliases['another_alias_for_foo']);
|
$this->assertEquals('foo', (string) $aliases['another_alias_for_foo']);
|
||||||
$this->assertFalse($aliases['another_alias_for_foo']->isPublic());
|
$this->assertFalse($aliases['another_alias_for_foo']->isPublic());
|
||||||
|
|
||||||
@ -383,8 +383,8 @@ class XmlFileLoaderTest extends TestCase
|
|||||||
$services = $container->getDefinitions();
|
$services = $container->getDefinitions();
|
||||||
$parameters = $container->getParameterBag()->all();
|
$parameters = $container->getParameterBag()->all();
|
||||||
|
|
||||||
$this->assertTrue(isset($services['project.service.bar']), '->load() parses extension elements');
|
$this->assertArrayHasKey('project.service.bar', $services, '->load() parses extension elements');
|
||||||
$this->assertTrue(isset($parameters['project.parameter.bar']), '->load() parses extension elements');
|
$this->assertArrayHasKey('project.parameter.bar', $parameters, '->load() parses extension elements');
|
||||||
|
|
||||||
$this->assertEquals('BAR', $services['project.service.foo']->getClass(), '->load() parses extension elements');
|
$this->assertEquals('BAR', $services['project.service.foo']->getClass(), '->load() parses extension elements');
|
||||||
$this->assertEquals('BAR', $parameters['project.parameter.foo'], '->load() parses extension elements');
|
$this->assertEquals('BAR', $parameters['project.parameter.foo'], '->load() parses extension elements');
|
||||||
@ -399,8 +399,8 @@ class XmlFileLoaderTest extends TestCase
|
|||||||
$services = $container->getDefinitions();
|
$services = $container->getDefinitions();
|
||||||
$parameters = $container->getParameterBag()->all();
|
$parameters = $container->getParameterBag()->all();
|
||||||
|
|
||||||
$this->assertTrue(isset($services['project.service.bar']), '->load() parses extension elements');
|
$this->assertArrayHasKey('project.service.bar', $services, '->load() parses extension elements');
|
||||||
$this->assertTrue(isset($parameters['project.parameter.bar']), '->load() parses extension elements');
|
$this->assertArrayHasKey('project.parameter.bar', $parameters, '->load() parses extension elements');
|
||||||
|
|
||||||
$this->assertEquals('BAR', $services['project.service.foo']->getClass(), '->load() parses extension elements');
|
$this->assertEquals('BAR', $services['project.service.foo']->getClass(), '->load() parses extension elements');
|
||||||
$this->assertEquals('BAR', $parameters['project.parameter.foo'], '->load() parses extension elements');
|
$this->assertEquals('BAR', $parameters['project.parameter.foo'], '->load() parses extension elements');
|
||||||
@ -521,8 +521,8 @@ class XmlFileLoaderTest extends TestCase
|
|||||||
$loader->load('namespaces.xml');
|
$loader->load('namespaces.xml');
|
||||||
$services = $container->getDefinitions();
|
$services = $container->getDefinitions();
|
||||||
|
|
||||||
$this->assertTrue(isset($services['foo']), '->load() parses <srv:service> elements');
|
$this->assertArrayHasKey('foo', $services, '->load() parses <srv:service> elements');
|
||||||
$this->assertEquals(1, count($services['foo']->getTag('foo.tag')), '->load parses <srv:tag> elements');
|
$this->assertCount(1, $services['foo']->getTag('foo.tag'), '->load parses <srv:tag> elements');
|
||||||
$this->assertEquals(array(array('setBar', array('foo'))), $services['foo']->getMethodCalls(), '->load() parses the <srv:call> tag');
|
$this->assertEquals(array(array('setBar', array('foo'))), $services['foo']->getMethodCalls(), '->load() parses the <srv:call> tag');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,7 +145,7 @@ class YamlFileLoaderTest extends TestCase
|
|||||||
$loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath.'/yaml'));
|
$loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath.'/yaml'));
|
||||||
$loader->load('services6.yml');
|
$loader->load('services6.yml');
|
||||||
$services = $container->getDefinitions();
|
$services = $container->getDefinitions();
|
||||||
$this->assertTrue(isset($services['foo']), '->load() parses service elements');
|
$this->assertArrayHasKey('foo', $services, '->load() parses service elements');
|
||||||
$this->assertFalse($services['not_shared']->isShared(), '->load() parses the shared flag');
|
$this->assertFalse($services['not_shared']->isShared(), '->load() parses the shared flag');
|
||||||
$this->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Definition', $services['foo'], '->load() converts service element to Definition instances');
|
$this->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Definition', $services['foo'], '->load() converts service element to Definition instances');
|
||||||
$this->assertEquals('FooClass', $services['foo']->getClass(), '->load() parses the class attribute');
|
$this->assertEquals('FooClass', $services['foo']->getClass(), '->load() parses the class attribute');
|
||||||
@ -161,10 +161,10 @@ class YamlFileLoaderTest extends TestCase
|
|||||||
$this->assertEquals(array('BazClass', 'getInstance'), $services['new_factory3']->getFactory(), '->load() parses the factory tag');
|
$this->assertEquals(array('BazClass', 'getInstance'), $services['new_factory3']->getFactory(), '->load() parses the factory tag');
|
||||||
|
|
||||||
$aliases = $container->getAliases();
|
$aliases = $container->getAliases();
|
||||||
$this->assertTrue(isset($aliases['alias_for_foo']), '->load() parses aliases');
|
$this->assertArrayHasKey('alias_for_foo', $aliases, '->load() parses aliases');
|
||||||
$this->assertEquals('foo', (string) $aliases['alias_for_foo'], '->load() parses aliases');
|
$this->assertEquals('foo', (string) $aliases['alias_for_foo'], '->load() parses aliases');
|
||||||
$this->assertTrue($aliases['alias_for_foo']->isPublic());
|
$this->assertTrue($aliases['alias_for_foo']->isPublic());
|
||||||
$this->assertTrue(isset($aliases['another_alias_for_foo']));
|
$this->assertArrayHasKey('another_alias_for_foo', $aliases);
|
||||||
$this->assertEquals('foo', (string) $aliases['another_alias_for_foo']);
|
$this->assertEquals('foo', (string) $aliases['another_alias_for_foo']);
|
||||||
$this->assertFalse($aliases['another_alias_for_foo']->isPublic());
|
$this->assertFalse($aliases['another_alias_for_foo']->isPublic());
|
||||||
|
|
||||||
@ -194,8 +194,8 @@ class YamlFileLoaderTest extends TestCase
|
|||||||
$services = $container->getDefinitions();
|
$services = $container->getDefinitions();
|
||||||
$parameters = $container->getParameterBag()->all();
|
$parameters = $container->getParameterBag()->all();
|
||||||
|
|
||||||
$this->assertTrue(isset($services['project.service.bar']), '->load() parses extension elements');
|
$this->assertArrayHasKey('project.service.bar', $services, '->load() parses extension elements');
|
||||||
$this->assertTrue(isset($parameters['project.parameter.bar']), '->load() parses extension elements');
|
$this->assertArrayHasKey('project.parameter.bar', $parameters, '->load() parses extension elements');
|
||||||
|
|
||||||
$this->assertEquals('BAR', $services['project.service.foo']->getClass(), '->load() parses extension elements');
|
$this->assertEquals('BAR', $services['project.service.foo']->getClass(), '->load() parses extension elements');
|
||||||
$this->assertEquals('BAR', $parameters['project.parameter.foo'], '->load() parses extension elements');
|
$this->assertEquals('BAR', $parameters['project.parameter.foo'], '->load() parses extension elements');
|
||||||
|
@ -180,7 +180,7 @@ EOF
|
|||||||
EOF
|
EOF
|
||||||
, 'UTF-8');
|
, 'UTF-8');
|
||||||
|
|
||||||
$this->assertTrue(count(libxml_get_errors()) > 1);
|
$this->assertGreaterThan(1, libxml_get_errors());
|
||||||
|
|
||||||
libxml_clear_errors();
|
libxml_clear_errors();
|
||||||
libxml_use_internal_errors($internalErrors);
|
libxml_use_internal_errors($internalErrors);
|
||||||
|
@ -370,15 +370,15 @@ class FormTest extends TestCase
|
|||||||
{
|
{
|
||||||
$form = $this->createForm('<form><input type="text" name="foo" value="foo" /><input type="submit" /></form>');
|
$form = $this->createForm('<form><input type="text" name="foo" value="foo" /><input type="submit" /></form>');
|
||||||
unset($form['foo']);
|
unset($form['foo']);
|
||||||
$this->assertFalse(isset($form['foo']), '->offsetUnset() removes a field');
|
$this->assertArrayNotHasKey('foo', $form, '->offsetUnset() removes a field');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testOffsetExists()
|
public function testOffsetExists()
|
||||||
{
|
{
|
||||||
$form = $this->createForm('<form><input type="text" name="foo" value="foo" /><input type="submit" /></form>');
|
$form = $this->createForm('<form><input type="text" name="foo" value="foo" /><input type="submit" /></form>');
|
||||||
|
|
||||||
$this->assertTrue(isset($form['foo']), '->offsetExists() return true if the field exists');
|
$this->assertArrayHasKey('foo', $form, '->offsetExists() return true if the field exists');
|
||||||
$this->assertFalse(isset($form['bar']), '->offsetExists() return false if the field does not exist');
|
$this->assertArrayNotHasKey('bar', $form, '->offsetExists() return false if the field does not exist');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetValues()
|
public function testGetValues()
|
||||||
|
@ -210,7 +210,7 @@ class ContainerAwareEventDispatcherTest extends AbstractEventDispatcherTest
|
|||||||
|
|
||||||
$listeners = $dispatcher->getListeners();
|
$listeners = $dispatcher->getListeners();
|
||||||
|
|
||||||
$this->assertTrue(isset($listeners['onEvent']));
|
$this->assertArrayHasKey('onEvent', $listeners);
|
||||||
|
|
||||||
$this->assertCount(1, $dispatcher->getListeners('onEvent'));
|
$this->assertCount(1, $dispatcher->getListeners('onEvent'));
|
||||||
}
|
}
|
||||||
|
@ -114,8 +114,8 @@ class GenericEventTest extends TestCase
|
|||||||
|
|
||||||
public function testOffsetIsset()
|
public function testOffsetIsset()
|
||||||
{
|
{
|
||||||
$this->assertTrue(isset($this->event['name']));
|
$this->assertArrayHasKey('name', $this->event);
|
||||||
$this->assertFalse(isset($this->event['nameNotExist']));
|
$this->assertArrayNotHasKey('nameNotExist', $this->event);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testHasArgument()
|
public function testHasArgument()
|
||||||
|
@ -26,7 +26,7 @@ class FilesystemTest extends FilesystemTestCase
|
|||||||
$this->filesystem->copy($sourceFilePath, $targetFilePath);
|
$this->filesystem->copy($sourceFilePath, $targetFilePath);
|
||||||
|
|
||||||
$this->assertFileExists($targetFilePath);
|
$this->assertFileExists($targetFilePath);
|
||||||
$this->assertEquals('SOURCE FILE', file_get_contents($targetFilePath));
|
$this->assertStringEqualsFile($targetFilePath, 'SOURCE FILE');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -73,7 +73,7 @@ class FilesystemTest extends FilesystemTestCase
|
|||||||
$this->filesystem->copy($sourceFilePath, $targetFilePath);
|
$this->filesystem->copy($sourceFilePath, $targetFilePath);
|
||||||
|
|
||||||
$this->assertFileExists($targetFilePath);
|
$this->assertFileExists($targetFilePath);
|
||||||
$this->assertEquals('SOURCE FILE', file_get_contents($targetFilePath));
|
$this->assertStringEqualsFile($targetFilePath, 'SOURCE FILE');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testCopyDoesNotOverrideExistingFileByDefault()
|
public function testCopyDoesNotOverrideExistingFileByDefault()
|
||||||
@ -92,7 +92,7 @@ class FilesystemTest extends FilesystemTestCase
|
|||||||
$this->filesystem->copy($sourceFilePath, $targetFilePath);
|
$this->filesystem->copy($sourceFilePath, $targetFilePath);
|
||||||
|
|
||||||
$this->assertFileExists($targetFilePath);
|
$this->assertFileExists($targetFilePath);
|
||||||
$this->assertEquals('TARGET FILE', file_get_contents($targetFilePath));
|
$this->assertStringEqualsFile($targetFilePath, 'TARGET FILE');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testCopyOverridesExistingFileIfForced()
|
public function testCopyOverridesExistingFileIfForced()
|
||||||
@ -111,7 +111,7 @@ class FilesystemTest extends FilesystemTestCase
|
|||||||
$this->filesystem->copy($sourceFilePath, $targetFilePath, true);
|
$this->filesystem->copy($sourceFilePath, $targetFilePath, true);
|
||||||
|
|
||||||
$this->assertFileExists($targetFilePath);
|
$this->assertFileExists($targetFilePath);
|
||||||
$this->assertEquals('SOURCE FILE', file_get_contents($targetFilePath));
|
$this->assertStringEqualsFile($targetFilePath, 'SOURCE FILE');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -153,7 +153,7 @@ class FilesystemTest extends FilesystemTestCase
|
|||||||
|
|
||||||
$this->assertTrue(is_dir($targetFileDirectory));
|
$this->assertTrue(is_dir($targetFileDirectory));
|
||||||
$this->assertFileExists($targetFilePath);
|
$this->assertFileExists($targetFilePath);
|
||||||
$this->assertEquals('SOURCE FILE', file_get_contents($targetFilePath));
|
$this->assertStringEqualsFile($targetFilePath, 'SOURCE FILE');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -772,9 +772,9 @@ class FilesystemTest extends FilesystemTestCase
|
|||||||
|
|
||||||
$this->filesystem->remove($link);
|
$this->filesystem->remove($link);
|
||||||
|
|
||||||
$this->assertTrue(!is_link($link));
|
$this->assertFalse(is_link($link));
|
||||||
$this->assertTrue(!is_file($link));
|
$this->assertFalse(is_file($link));
|
||||||
$this->assertTrue(!is_dir($link));
|
$this->assertFalse(is_dir($link));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSymlinkIsOverwrittenIfPointsToDifferentTarget()
|
public function testSymlinkIsOverwrittenIfPointsToDifferentTarget()
|
||||||
@ -1198,7 +1198,7 @@ class FilesystemTest extends FilesystemTestCase
|
|||||||
$this->filesystem->dumpFile($filename, 'bar');
|
$this->filesystem->dumpFile($filename, 'bar');
|
||||||
|
|
||||||
$this->assertFileExists($filename);
|
$this->assertFileExists($filename);
|
||||||
$this->assertSame('bar', file_get_contents($filename));
|
$this->assertStringEqualsFile($filename, 'bar');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1211,7 +1211,7 @@ class FilesystemTest extends FilesystemTestCase
|
|||||||
$this->filesystem->dumpFile($filename, 'bar', 0753);
|
$this->filesystem->dumpFile($filename, 'bar', 0753);
|
||||||
|
|
||||||
$this->assertFileExists($filename);
|
$this->assertFileExists($filename);
|
||||||
$this->assertSame('bar', file_get_contents($filename));
|
$this->assertStringEqualsFile($filename, 'bar');
|
||||||
|
|
||||||
// skip mode check on Windows
|
// skip mode check on Windows
|
||||||
if ('\\' !== DIRECTORY_SEPARATOR) {
|
if ('\\' !== DIRECTORY_SEPARATOR) {
|
||||||
@ -1226,7 +1226,7 @@ class FilesystemTest extends FilesystemTestCase
|
|||||||
$this->filesystem->dumpFile($filename, 'bar', null);
|
$this->filesystem->dumpFile($filename, 'bar', null);
|
||||||
|
|
||||||
$this->assertFileExists($filename);
|
$this->assertFileExists($filename);
|
||||||
$this->assertSame('bar', file_get_contents($filename));
|
$this->assertStringEqualsFile($filename, 'bar');
|
||||||
|
|
||||||
// skip mode check on Windows
|
// skip mode check on Windows
|
||||||
if ('\\' !== DIRECTORY_SEPARATOR) {
|
if ('\\' !== DIRECTORY_SEPARATOR) {
|
||||||
@ -1242,7 +1242,7 @@ class FilesystemTest extends FilesystemTestCase
|
|||||||
$this->filesystem->dumpFile($filename, 'bar');
|
$this->filesystem->dumpFile($filename, 'bar');
|
||||||
|
|
||||||
$this->assertFileExists($filename);
|
$this->assertFileExists($filename);
|
||||||
$this->assertSame('bar', file_get_contents($filename));
|
$this->assertStringEqualsFile($filename, 'bar');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testDumpFileWithFileScheme()
|
public function testDumpFileWithFileScheme()
|
||||||
|
@ -309,12 +309,12 @@ class CompoundFormTest extends AbstractFormTest
|
|||||||
|
|
||||||
$this->form[] = $child;
|
$this->form[] = $child;
|
||||||
|
|
||||||
$this->assertTrue(isset($this->form['foo']));
|
$this->assertArrayHasKey('foo', $this->form);
|
||||||
$this->assertSame($child, $this->form['foo']);
|
$this->assertSame($child, $this->form['foo']);
|
||||||
|
|
||||||
unset($this->form['foo']);
|
unset($this->form['foo']);
|
||||||
|
|
||||||
$this->assertFalse(isset($this->form['foo']));
|
$this->assertArrayNotHasKey('foo', $this->form);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testCountable()
|
public function testCountable()
|
||||||
|
@ -252,7 +252,7 @@ class ChoiceTypeTest extends BaseTypeTest
|
|||||||
'choices_as_values' => true,
|
'choices_as_values' => true,
|
||||||
));
|
));
|
||||||
|
|
||||||
$this->assertTrue(isset($form['placeholder']));
|
$this->assertArrayHasKey('placeholder', $form);
|
||||||
$this->assertCount(count($this->choices) + 1, $form, 'Each choice should become a new field');
|
$this->assertCount(count($this->choices) + 1, $form, 'Each choice should become a new field');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -266,7 +266,7 @@ class ChoiceTypeTest extends BaseTypeTest
|
|||||||
'choices_as_values' => true,
|
'choices_as_values' => true,
|
||||||
));
|
));
|
||||||
|
|
||||||
$this->assertFalse(isset($form['placeholder']));
|
$this->assertArrayNotHasKey('placeholder', $form);
|
||||||
$this->assertCount(count($this->choices), $form, 'Each choice should become a new field');
|
$this->assertCount(count($this->choices), $form, 'Each choice should become a new field');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -280,7 +280,7 @@ class ChoiceTypeTest extends BaseTypeTest
|
|||||||
'choices_as_values' => true,
|
'choices_as_values' => true,
|
||||||
));
|
));
|
||||||
|
|
||||||
$this->assertFalse(isset($form['placeholder']));
|
$this->assertArrayNotHasKey('placeholder', $form);
|
||||||
$this->assertCount(count($this->choices), $form, 'Each choice should become a new field');
|
$this->assertCount(count($this->choices), $form, 'Each choice should become a new field');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -297,7 +297,7 @@ class ChoiceTypeTest extends BaseTypeTest
|
|||||||
'choices_as_values' => true,
|
'choices_as_values' => true,
|
||||||
));
|
));
|
||||||
|
|
||||||
$this->assertFalse(isset($form['placeholder']));
|
$this->assertArrayNotHasKey('placeholder', $form);
|
||||||
$this->assertCount(2, $form, 'Each choice should become a new field');
|
$this->assertCount(2, $form, 'Each choice should become a new field');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -357,7 +357,7 @@ class ChoiceTypeTest extends BaseTypeTest
|
|||||||
'choices_as_values' => true,
|
'choices_as_values' => true,
|
||||||
));
|
));
|
||||||
|
|
||||||
$this->assertTrue(isset($form['placeholder']), 'Placeholder should be set');
|
$this->assertArrayHasKey('placeholder', $form, 'Placeholder should be set');
|
||||||
$this->assertCount(3, $form, 'Each choice should become a new field, placeholder included');
|
$this->assertCount(3, $form, 'Each choice should become a new field, placeholder included');
|
||||||
|
|
||||||
$view = $form->createView();
|
$view = $form->createView();
|
||||||
@ -382,7 +382,7 @@ class ChoiceTypeTest extends BaseTypeTest
|
|||||||
'choices_as_values' => true,
|
'choices_as_values' => true,
|
||||||
));
|
));
|
||||||
|
|
||||||
$this->assertTrue(isset($form['placeholder']), 'Placeholder should be set');
|
$this->assertArrayHasKey('placeholder', $form, 'Placeholder should be set');
|
||||||
$this->assertCount(3, $form, 'Each choice should become a new field, placeholder included');
|
$this->assertCount(3, $form, 'Each choice should become a new field, placeholder included');
|
||||||
|
|
||||||
$view = $form->createView();
|
$view = $form->createView();
|
||||||
|
@ -60,7 +60,7 @@ class CollectionTypeTest extends BaseTypeTest
|
|||||||
|
|
||||||
$form->setData(array('foo@baz.com'));
|
$form->setData(array('foo@baz.com'));
|
||||||
$this->assertInstanceOf('Symfony\Component\Form\Form', $form[0]);
|
$this->assertInstanceOf('Symfony\Component\Form\Form', $form[0]);
|
||||||
$this->assertFalse(isset($form[1]));
|
$this->assertArrayNotHasKey(1, $form);
|
||||||
$this->assertCount(1, $form);
|
$this->assertCount(1, $form);
|
||||||
$this->assertEquals('foo@baz.com', $form[0]->getData());
|
$this->assertEquals('foo@baz.com', $form[0]->getData());
|
||||||
$formAttrs0 = $form[0]->getConfig()->getOption('attr');
|
$formAttrs0 = $form[0]->getConfig()->getOption('attr');
|
||||||
@ -239,7 +239,7 @@ class CollectionTypeTest extends BaseTypeTest
|
|||||||
));
|
));
|
||||||
|
|
||||||
$data = $form->getData();
|
$data = $form->getData();
|
||||||
$this->assertFalse(isset($data['__name__']));
|
$this->assertArrayNotHasKey('__name__', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetDataDoesNotContainsPrototypeNameAfterDataAreSet()
|
public function testGetDataDoesNotContainsPrototypeNameAfterDataAreSet()
|
||||||
@ -252,7 +252,7 @@ class CollectionTypeTest extends BaseTypeTest
|
|||||||
|
|
||||||
$form->setData(array('foobar.png'));
|
$form->setData(array('foobar.png'));
|
||||||
$data = $form->getData();
|
$data = $form->getData();
|
||||||
$this->assertFalse(isset($data['__name__']));
|
$this->assertArrayNotHasKey('__name__', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testPrototypeNameOption()
|
public function testPrototypeNameOption()
|
||||||
|
@ -454,7 +454,7 @@ class DateTimeTypeTest extends BaseTypeTest
|
|||||||
))
|
))
|
||||||
->createView();
|
->createView();
|
||||||
|
|
||||||
$this->assertFalse(isset($view->vars['type']));
|
$this->assertArrayNotHasKey('type', $view->vars);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testDontPassHtml5TypeIfNotHtml5Format()
|
public function testDontPassHtml5TypeIfNotHtml5Format()
|
||||||
@ -465,7 +465,7 @@ class DateTimeTypeTest extends BaseTypeTest
|
|||||||
))
|
))
|
||||||
->createView();
|
->createView();
|
||||||
|
|
||||||
$this->assertFalse(isset($view->vars['type']));
|
$this->assertArrayNotHasKey('type', $view->vars);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testDontPassHtml5TypeIfNotSingleText()
|
public function testDontPassHtml5TypeIfNotSingleText()
|
||||||
@ -475,7 +475,7 @@ class DateTimeTypeTest extends BaseTypeTest
|
|||||||
))
|
))
|
||||||
->createView();
|
->createView();
|
||||||
|
|
||||||
$this->assertFalse(isset($view->vars['type']));
|
$this->assertArrayNotHasKey('type', $view->vars);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testDateTypeChoiceErrorsBubbleUp()
|
public function testDateTypeChoiceErrorsBubbleUp()
|
||||||
|
@ -688,7 +688,7 @@ class DateTypeTest extends BaseTypeTest
|
|||||||
))
|
))
|
||||||
->createView();
|
->createView();
|
||||||
|
|
||||||
$this->assertFalse(isset($view->vars['date_pattern']));
|
$this->assertArrayNotHasKey('date_pattern', $view->vars);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testDatePatternFormatWithQuotedStrings()
|
public function testDatePatternFormatWithQuotedStrings()
|
||||||
@ -854,7 +854,7 @@ class DateTypeTest extends BaseTypeTest
|
|||||||
))
|
))
|
||||||
->createView();
|
->createView();
|
||||||
|
|
||||||
$this->assertFalse(isset($view->vars['type']));
|
$this->assertArrayNotHasKey('type', $view->vars);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testDontPassHtml5TypeIfNotHtml5Format()
|
public function testDontPassHtml5TypeIfNotHtml5Format()
|
||||||
@ -865,7 +865,7 @@ class DateTypeTest extends BaseTypeTest
|
|||||||
))
|
))
|
||||||
->createView();
|
->createView();
|
||||||
|
|
||||||
$this->assertFalse(isset($view->vars['type']));
|
$this->assertArrayNotHasKey('type', $view->vars);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testDontPassHtml5TypeIfNotSingleText()
|
public function testDontPassHtml5TypeIfNotSingleText()
|
||||||
@ -875,7 +875,7 @@ class DateTypeTest extends BaseTypeTest
|
|||||||
))
|
))
|
||||||
->createView();
|
->createView();
|
||||||
|
|
||||||
$this->assertFalse(isset($view->vars['type']));
|
$this->assertArrayNotHasKey('type', $view->vars);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function provideCompoundWidgets()
|
public function provideCompoundWidgets()
|
||||||
|
@ -546,7 +546,7 @@ class TimeTypeTest extends BaseTypeTest
|
|||||||
));
|
));
|
||||||
|
|
||||||
$view = $form->createView();
|
$view = $form->createView();
|
||||||
$this->assertFalse(isset($view->vars['type']));
|
$this->assertArrayNotHasKey('type', $view->vars);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testPassDefaultPlaceholderToViewIfNotRequired()
|
public function testPassDefaultPlaceholderToViewIfNotRequired()
|
||||||
|
@ -72,7 +72,7 @@ class FormTypeCsrfExtensionTest extends TypeTestCase
|
|||||||
))
|
))
|
||||||
->createView();
|
->createView();
|
||||||
|
|
||||||
$this->assertTrue(isset($view['csrf']));
|
$this->assertArrayHasKey('csrf', $view);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testNoCsrfProtectionByDefaultIfCompoundButNotRoot()
|
public function testNoCsrfProtectionByDefaultIfCompoundButNotRoot()
|
||||||
@ -89,7 +89,7 @@ class FormTypeCsrfExtensionTest extends TypeTestCase
|
|||||||
->get('form')
|
->get('form')
|
||||||
->createView();
|
->createView();
|
||||||
|
|
||||||
$this->assertFalse(isset($view['csrf']));
|
$this->assertArrayNotHasKey('csrf', $view);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testNoCsrfProtectionByDefaultIfRootButNotCompound()
|
public function testNoCsrfProtectionByDefaultIfRootButNotCompound()
|
||||||
@ -101,7 +101,7 @@ class FormTypeCsrfExtensionTest extends TypeTestCase
|
|||||||
))
|
))
|
||||||
->createView();
|
->createView();
|
||||||
|
|
||||||
$this->assertFalse(isset($view['csrf']));
|
$this->assertArrayNotHasKey('csrf', $view);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testCsrfProtectionCanBeDisabled()
|
public function testCsrfProtectionCanBeDisabled()
|
||||||
@ -114,7 +114,7 @@ class FormTypeCsrfExtensionTest extends TypeTestCase
|
|||||||
))
|
))
|
||||||
->createView();
|
->createView();
|
||||||
|
|
||||||
$this->assertFalse(isset($view['csrf']));
|
$this->assertArrayNotHasKey('csrf', $view);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGenerateCsrfToken()
|
public function testGenerateCsrfToken()
|
||||||
@ -357,7 +357,7 @@ class FormTypeCsrfExtensionTest extends TypeTestCase
|
|||||||
->createView()
|
->createView()
|
||||||
->vars['prototype'];
|
->vars['prototype'];
|
||||||
|
|
||||||
$this->assertFalse(isset($prototypeView['csrf']));
|
$this->assertArrayNotHasKey('csrf', $prototypeView);
|
||||||
$this->assertCount(1, $prototypeView);
|
$this->assertCount(1, $prototypeView);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ class ViolationPathTest extends TestCase
|
|||||||
$path = new ViolationPath($string);
|
$path = new ViolationPath($string);
|
||||||
|
|
||||||
$this->assertSame($slicedPath, $path->__toString());
|
$this->assertSame($slicedPath, $path->__toString());
|
||||||
$this->assertSame(count($entries), count($path->getElements()));
|
$this->assertCount(count($entries), $path->getElements());
|
||||||
$this->assertSame(count($entries), $path->getLength());
|
$this->assertSame(count($entries), $path->getLength());
|
||||||
|
|
||||||
foreach ($entries as $index => $entry) {
|
foreach ($entries as $index => $entry) {
|
||||||
|
@ -91,14 +91,14 @@ class OrderedHashMapTest extends TestCase
|
|||||||
$map = new OrderedHashMap();
|
$map = new OrderedHashMap();
|
||||||
$map['first'] = 1;
|
$map['first'] = 1;
|
||||||
|
|
||||||
$this->assertTrue(isset($map['first']));
|
$this->assertArrayHasKey('first', $map);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testIssetReturnsFalseForNonExisting()
|
public function testIssetReturnsFalseForNonExisting()
|
||||||
{
|
{
|
||||||
$map = new OrderedHashMap();
|
$map = new OrderedHashMap();
|
||||||
|
|
||||||
$this->assertFalse(isset($map['first']));
|
$this->assertArrayNotHasKey('first', $map);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testIssetReturnsFalseForNull()
|
public function testIssetReturnsFalseForNull()
|
||||||
@ -106,7 +106,7 @@ class OrderedHashMapTest extends TestCase
|
|||||||
$map = new OrderedHashMap();
|
$map = new OrderedHashMap();
|
||||||
$map['first'] = null;
|
$map['first'] = null;
|
||||||
|
|
||||||
$this->assertFalse(isset($map['first']));
|
$this->assertArrayNotHasKey('first', $map);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testUnset()
|
public function testUnset()
|
||||||
|
@ -191,6 +191,6 @@ class HeaderBagTest extends TestCase
|
|||||||
$headers = array('foo' => 'bar', 'HELLO' => 'WORLD');
|
$headers = array('foo' => 'bar', 'HELLO' => 'WORLD');
|
||||||
$headerBag = new HeaderBag($headers);
|
$headerBag = new HeaderBag($headers);
|
||||||
|
|
||||||
$this->assertEquals(count($headers), count($headerBag));
|
$this->assertCount(count($headers), $headerBag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -214,7 +214,7 @@ class ParameterBagTest extends TestCase
|
|||||||
$parameters = array('foo' => 'bar', 'hello' => 'world');
|
$parameters = array('foo' => 'bar', 'hello' => 'world');
|
||||||
$bag = new ParameterBag($parameters);
|
$bag = new ParameterBag($parameters);
|
||||||
|
|
||||||
$this->assertEquals(count($parameters), count($bag));
|
$this->assertCount(count($parameters), $bag);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetBoolean()
|
public function testGetBoolean()
|
||||||
|
@ -183,10 +183,10 @@ class ResponseHeaderBagTest extends TestCase
|
|||||||
$this->assertSetCookieHeader('foo=bar; path=/; httponly', $bag);
|
$this->assertSetCookieHeader('foo=bar; path=/; httponly', $bag);
|
||||||
|
|
||||||
$cookies = $bag->getCookies(ResponseHeaderBag::COOKIES_ARRAY);
|
$cookies = $bag->getCookies(ResponseHeaderBag::COOKIES_ARRAY);
|
||||||
$this->assertTrue(isset($cookies['foo.bar']['/path/foo']['foo']));
|
$this->assertArrayHasKey('foo', $cookies['foo.bar']['/path/foo']);
|
||||||
$this->assertTrue(isset($cookies['foo.bar']['/path/bar']['foo']));
|
$this->assertArrayHasKey('foo', $cookies['foo.bar']['/path/bar']);
|
||||||
$this->assertTrue(isset($cookies['bar.foo']['/path/bar']['foo']));
|
$this->assertArrayHasKey('foo', $cookies['bar.foo']['/path/bar']);
|
||||||
$this->assertTrue(isset($cookies['']['/']['foo']));
|
$this->assertArrayHasKey('foo', $cookies['']['/']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testRemoveCookie()
|
public function testRemoveCookie()
|
||||||
@ -196,17 +196,17 @@ class ResponseHeaderBagTest extends TestCase
|
|||||||
$bag->setCookie(new Cookie('bar', 'foo', 0, '/path/bar', 'foo.bar'));
|
$bag->setCookie(new Cookie('bar', 'foo', 0, '/path/bar', 'foo.bar'));
|
||||||
|
|
||||||
$cookies = $bag->getCookies(ResponseHeaderBag::COOKIES_ARRAY);
|
$cookies = $bag->getCookies(ResponseHeaderBag::COOKIES_ARRAY);
|
||||||
$this->assertTrue(isset($cookies['foo.bar']['/path/foo']));
|
$this->assertArrayHasKey('/path/foo', $cookies['foo.bar']);
|
||||||
|
|
||||||
$bag->removeCookie('foo', '/path/foo', 'foo.bar');
|
$bag->removeCookie('foo', '/path/foo', 'foo.bar');
|
||||||
|
|
||||||
$cookies = $bag->getCookies(ResponseHeaderBag::COOKIES_ARRAY);
|
$cookies = $bag->getCookies(ResponseHeaderBag::COOKIES_ARRAY);
|
||||||
$this->assertFalse(isset($cookies['foo.bar']['/path/foo']));
|
$this->assertArrayNotHasKey('/path/foo', $cookies['foo.bar']);
|
||||||
|
|
||||||
$bag->removeCookie('bar', '/path/bar', 'foo.bar');
|
$bag->removeCookie('bar', '/path/bar', 'foo.bar');
|
||||||
|
|
||||||
$cookies = $bag->getCookies(ResponseHeaderBag::COOKIES_ARRAY);
|
$cookies = $bag->getCookies(ResponseHeaderBag::COOKIES_ARRAY);
|
||||||
$this->assertFalse(isset($cookies['foo.bar']));
|
$this->assertArrayNotHasKey('foo.bar', $cookies);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testRemoveCookieWithNullRemove()
|
public function testRemoveCookieWithNullRemove()
|
||||||
@ -216,11 +216,11 @@ class ResponseHeaderBagTest extends TestCase
|
|||||||
$bag->setCookie(new Cookie('bar', 'foo', 0));
|
$bag->setCookie(new Cookie('bar', 'foo', 0));
|
||||||
|
|
||||||
$cookies = $bag->getCookies(ResponseHeaderBag::COOKIES_ARRAY);
|
$cookies = $bag->getCookies(ResponseHeaderBag::COOKIES_ARRAY);
|
||||||
$this->assertTrue(isset($cookies['']['/']));
|
$this->assertArrayHasKey('/', $cookies['']);
|
||||||
|
|
||||||
$bag->removeCookie('foo', null);
|
$bag->removeCookie('foo', null);
|
||||||
$cookies = $bag->getCookies(ResponseHeaderBag::COOKIES_ARRAY);
|
$cookies = $bag->getCookies(ResponseHeaderBag::COOKIES_ARRAY);
|
||||||
$this->assertFalse(isset($cookies['']['/']['foo']));
|
$this->assertArrayNotHasKey('foo', $cookies['']['/']);
|
||||||
|
|
||||||
$bag->removeCookie('bar', null);
|
$bag->removeCookie('bar', null);
|
||||||
$cookies = $bag->getCookies(ResponseHeaderBag::COOKIES_ARRAY);
|
$cookies = $bag->getCookies(ResponseHeaderBag::COOKIES_ARRAY);
|
||||||
|
@ -74,8 +74,8 @@ class ServerBagTest extends TestCase
|
|||||||
|
|
||||||
// Username and passwords should not be set as the header is bogus
|
// Username and passwords should not be set as the header is bogus
|
||||||
$headers = $bag->getHeaders();
|
$headers = $bag->getHeaders();
|
||||||
$this->assertFalse(isset($headers['PHP_AUTH_USER']));
|
$this->assertArrayNotHasKey('PHP_AUTH_USER', $headers);
|
||||||
$this->assertFalse(isset($headers['PHP_AUTH_PW']));
|
$this->assertArrayNotHasKey('PHP_AUTH_PW', $headers);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testHttpBasicAuthWithPhpCgiRedirect()
|
public function testHttpBasicAuthWithPhpCgiRedirect()
|
||||||
@ -118,8 +118,8 @@ class ServerBagTest extends TestCase
|
|||||||
|
|
||||||
// Username and passwords should not be set as the header is bogus
|
// Username and passwords should not be set as the header is bogus
|
||||||
$headers = $bag->getHeaders();
|
$headers = $bag->getHeaders();
|
||||||
$this->assertFalse(isset($headers['PHP_AUTH_USER']));
|
$this->assertArrayNotHasKey('PHP_AUTH_USER', $headers);
|
||||||
$this->assertFalse(isset($headers['PHP_AUTH_PW']));
|
$this->assertArrayNotHasKey('PHP_AUTH_PW', $headers);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testHttpDigestAuthWithPhpCgiRedirect()
|
public function testHttpDigestAuthWithPhpCgiRedirect()
|
||||||
|
@ -181,6 +181,6 @@ class AttributeBagTest extends TestCase
|
|||||||
|
|
||||||
public function testCount()
|
public function testCount()
|
||||||
{
|
{
|
||||||
$this->assertEquals(count($this->array), count($this->bag));
|
$this->assertCount(count($this->array), $this->bag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -255,7 +255,7 @@ class NativeSessionStorageTest extends TestCase
|
|||||||
$this->assertFalse($storage->isStarted());
|
$this->assertFalse($storage->isStarted());
|
||||||
|
|
||||||
$key = $storage->getMetadataBag()->getStorageKey();
|
$key = $storage->getMetadataBag()->getStorageKey();
|
||||||
$this->assertFalse(isset($_SESSION[$key]));
|
$this->assertArrayNotHasKey($key, $_SESSION);
|
||||||
$storage->start();
|
$storage->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,9 +79,9 @@ class PhpBridgeSessionStorageTest extends TestCase
|
|||||||
$this->assertFalse($storage->isStarted());
|
$this->assertFalse($storage->isStarted());
|
||||||
|
|
||||||
$key = $storage->getMetadataBag()->getStorageKey();
|
$key = $storage->getMetadataBag()->getStorageKey();
|
||||||
$this->assertFalse(isset($_SESSION[$key]));
|
$this->assertArrayNotHasKey($key, $_SESSION);
|
||||||
$storage->start();
|
$storage->start();
|
||||||
$this->assertTrue(isset($_SESSION[$key]));
|
$this->assertArrayHasKey($key, $_SESSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -102,9 +102,9 @@ class PhpBridgeSessionStorageTest extends TestCase
|
|||||||
$this->assertFalse($storage->isStarted());
|
$this->assertFalse($storage->isStarted());
|
||||||
|
|
||||||
$key = $storage->getMetadataBag()->getStorageKey();
|
$key = $storage->getMetadataBag()->getStorageKey();
|
||||||
$this->assertFalse(isset($_SESSION[$key]));
|
$this->assertArrayNotHasKey($key, $_SESSION);
|
||||||
$storage->start();
|
$storage->start();
|
||||||
$this->assertTrue(isset($_SESSION[$key]));
|
$this->assertArrayHasKey($key, $_SESSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testClear()
|
public function testClear()
|
||||||
|
@ -35,7 +35,7 @@ class DumpDataCollectorTest extends TestCase
|
|||||||
$this->assertSame(1, $collector->getDumpsCount());
|
$this->assertSame(1, $collector->getDumpsCount());
|
||||||
|
|
||||||
$dump = $collector->getDumps('html');
|
$dump = $collector->getDumps('html');
|
||||||
$this->assertTrue(isset($dump[0]['data']));
|
$this->assertArrayHasKey('data', $dump[0]);
|
||||||
$dump[0]['data'] = preg_replace('/^.*?<pre/', '<pre', $dump[0]['data']);
|
$dump[0]['data'] = preg_replace('/^.*?<pre/', '<pre', $dump[0]['data']);
|
||||||
$dump[0]['data'] = preg_replace('/sf-dump-\d+/', 'sf-dump', $dump[0]['data']);
|
$dump[0]['data'] = preg_replace('/sf-dump-\d+/', 'sf-dump', $dump[0]['data']);
|
||||||
|
|
||||||
|
@ -530,8 +530,8 @@ class HttpCacheTest extends HttpCacheTestCase
|
|||||||
$this->request('GET', '/');
|
$this->request('GET', '/');
|
||||||
$this->assertHttpKernelIsNotCalled();
|
$this->assertHttpKernelIsNotCalled();
|
||||||
$this->assertEquals(200, $this->response->getStatusCode());
|
$this->assertEquals(200, $this->response->getStatusCode());
|
||||||
$this->assertTrue(strtotime($this->responses[0]->headers->get('Date')) - strtotime($this->response->headers->get('Date')) < 2);
|
$this->assertLessThan(2, strtotime($this->responses[0]->headers->get('Date')) - strtotime($this->response->headers->get('Date')));
|
||||||
$this->assertTrue($this->response->headers->get('Age') > 0);
|
$this->assertGreaterThan(0, $this->response->headers->get('Age'));
|
||||||
$this->assertNotNull($this->response->headers->get('X-Content-Digest'));
|
$this->assertNotNull($this->response->headers->get('X-Content-Digest'));
|
||||||
$this->assertTraceContains('fresh');
|
$this->assertTraceContains('fresh');
|
||||||
$this->assertTraceNotContains('store');
|
$this->assertTraceNotContains('store');
|
||||||
@ -554,8 +554,8 @@ class HttpCacheTest extends HttpCacheTestCase
|
|||||||
$this->request('GET', '/');
|
$this->request('GET', '/');
|
||||||
$this->assertHttpKernelIsNotCalled();
|
$this->assertHttpKernelIsNotCalled();
|
||||||
$this->assertEquals(200, $this->response->getStatusCode());
|
$this->assertEquals(200, $this->response->getStatusCode());
|
||||||
$this->assertTrue(strtotime($this->responses[0]->headers->get('Date')) - strtotime($this->response->headers->get('Date')) < 2);
|
$this->assertLessThan(2, strtotime($this->responses[0]->headers->get('Date')) - strtotime($this->response->headers->get('Date')));
|
||||||
$this->assertTrue($this->response->headers->get('Age') > 0);
|
$this->assertGreaterThan(0, $this->response->headers->get('Age'));
|
||||||
$this->assertNotNull($this->response->headers->get('X-Content-Digest'));
|
$this->assertNotNull($this->response->headers->get('X-Content-Digest'));
|
||||||
$this->assertTraceContains('fresh');
|
$this->assertTraceContains('fresh');
|
||||||
$this->assertTraceNotContains('store');
|
$this->assertTraceNotContains('store');
|
||||||
@ -578,8 +578,8 @@ class HttpCacheTest extends HttpCacheTestCase
|
|||||||
$this->request('GET', '/');
|
$this->request('GET', '/');
|
||||||
$this->assertHttpKernelIsNotCalled();
|
$this->assertHttpKernelIsNotCalled();
|
||||||
$this->assertEquals(200, $this->response->getStatusCode());
|
$this->assertEquals(200, $this->response->getStatusCode());
|
||||||
$this->assertTrue(strtotime($this->responses[0]->headers->get('Date')) - strtotime($this->response->headers->get('Date')) < 2);
|
$this->assertLessThan(2, strtotime($this->responses[0]->headers->get('Date')) - strtotime($this->response->headers->get('Date')));
|
||||||
$this->assertTrue($this->response->headers->get('Age') > 0);
|
$this->assertGreaterThan(0, $this->response->headers->get('Age'));
|
||||||
$this->assertNotNull($this->response->headers->get('X-Content-Digest'));
|
$this->assertNotNull($this->response->headers->get('X-Content-Digest'));
|
||||||
$this->assertTraceContains('fresh');
|
$this->assertTraceContains('fresh');
|
||||||
$this->assertTraceNotContains('store');
|
$this->assertTraceNotContains('store');
|
||||||
@ -753,7 +753,7 @@ class HttpCacheTest extends HttpCacheTestCase
|
|||||||
$this->request('GET', '/');
|
$this->request('GET', '/');
|
||||||
$this->assertHttpKernelIsCalled();
|
$this->assertHttpKernelIsCalled();
|
||||||
$this->assertEquals(200, $this->response->getStatusCode());
|
$this->assertEquals(200, $this->response->getStatusCode());
|
||||||
$this->assertTrue($this->response->headers->get('Age') <= 1);
|
$this->assertLessThanOrEqual(1, $this->response->headers->get('Age'));
|
||||||
$this->assertNotNull($this->response->headers->get('X-Content-Digest'));
|
$this->assertNotNull($this->response->headers->get('X-Content-Digest'));
|
||||||
$this->assertTraceContains('stale');
|
$this->assertTraceContains('stale');
|
||||||
$this->assertTraceNotContains('fresh');
|
$this->assertTraceNotContains('fresh');
|
||||||
@ -791,7 +791,7 @@ class HttpCacheTest extends HttpCacheTestCase
|
|||||||
$this->assertEquals(200, $this->response->getStatusCode());
|
$this->assertEquals(200, $this->response->getStatusCode());
|
||||||
$this->assertNotNull($this->response->headers->get('Last-Modified'));
|
$this->assertNotNull($this->response->headers->get('Last-Modified'));
|
||||||
$this->assertNotNull($this->response->headers->get('X-Content-Digest'));
|
$this->assertNotNull($this->response->headers->get('X-Content-Digest'));
|
||||||
$this->assertTrue($this->response->headers->get('Age') <= 1);
|
$this->assertLessThanOrEqual(1, $this->response->headers->get('Age'));
|
||||||
$this->assertEquals('Hello World', $this->response->getContent());
|
$this->assertEquals('Hello World', $this->response->getContent());
|
||||||
$this->assertTraceContains('stale');
|
$this->assertTraceContains('stale');
|
||||||
$this->assertTraceContains('valid');
|
$this->assertTraceContains('valid');
|
||||||
@ -841,7 +841,7 @@ class HttpCacheTest extends HttpCacheTestCase
|
|||||||
$this->assertEquals(200, $this->response->getStatusCode());
|
$this->assertEquals(200, $this->response->getStatusCode());
|
||||||
$this->assertNotNull($this->response->headers->get('ETag'));
|
$this->assertNotNull($this->response->headers->get('ETag'));
|
||||||
$this->assertNotNull($this->response->headers->get('X-Content-Digest'));
|
$this->assertNotNull($this->response->headers->get('X-Content-Digest'));
|
||||||
$this->assertTrue($this->response->headers->get('Age') <= 1);
|
$this->assertLessThanOrEqual(1, $this->response->headers->get('Age'));
|
||||||
$this->assertEquals('Hello World', $this->response->getContent());
|
$this->assertEquals('Hello World', $this->response->getContent());
|
||||||
$this->assertTraceContains('stale');
|
$this->assertTraceContains('stale');
|
||||||
$this->assertTraceContains('valid');
|
$this->assertTraceContains('valid');
|
||||||
|
@ -64,22 +64,22 @@ abstract class AbstractProfilerStorageTest extends TestCase
|
|||||||
$profile = new Profile('simple_quote');
|
$profile = new Profile('simple_quote');
|
||||||
$profile->setUrl('http://foo.bar/\'');
|
$profile->setUrl('http://foo.bar/\'');
|
||||||
$this->getStorage()->write($profile);
|
$this->getStorage()->write($profile);
|
||||||
$this->assertTrue(false !== $this->getStorage()->read('simple_quote'), '->write() accepts single quotes in URL');
|
$this->assertNotFalse($this->getStorage()->read('simple_quote'), '->write() accepts single quotes in URL');
|
||||||
|
|
||||||
$profile = new Profile('double_quote');
|
$profile = new Profile('double_quote');
|
||||||
$profile->setUrl('http://foo.bar/"');
|
$profile->setUrl('http://foo.bar/"');
|
||||||
$this->getStorage()->write($profile);
|
$this->getStorage()->write($profile);
|
||||||
$this->assertTrue(false !== $this->getStorage()->read('double_quote'), '->write() accepts double quotes in URL');
|
$this->assertNotFalse($this->getStorage()->read('double_quote'), '->write() accepts double quotes in URL');
|
||||||
|
|
||||||
$profile = new Profile('backslash');
|
$profile = new Profile('backslash');
|
||||||
$profile->setUrl('http://foo.bar/\\');
|
$profile->setUrl('http://foo.bar/\\');
|
||||||
$this->getStorage()->write($profile);
|
$this->getStorage()->write($profile);
|
||||||
$this->assertTrue(false !== $this->getStorage()->read('backslash'), '->write() accepts backslash in URL');
|
$this->assertNotFalse($this->getStorage()->read('backslash'), '->write() accepts backslash in URL');
|
||||||
|
|
||||||
$profile = new Profile('comma');
|
$profile = new Profile('comma');
|
||||||
$profile->setUrl('http://foo.bar/,');
|
$profile->setUrl('http://foo.bar/,');
|
||||||
$this->getStorage()->write($profile);
|
$this->getStorage()->write($profile);
|
||||||
$this->assertTrue(false !== $this->getStorage()->read('comma'), '->write() accepts comma in URL');
|
$this->assertNotFalse($this->getStorage()->read('comma'), '->write() accepts comma in URL');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testStoreDuplicateToken()
|
public function testStoreDuplicateToken()
|
||||||
@ -214,7 +214,7 @@ abstract class AbstractProfilerStorageTest extends TestCase
|
|||||||
$profile->setMethod('GET');
|
$profile->setMethod('GET');
|
||||||
$this->getStorage()->write($profile);
|
$this->getStorage()->write($profile);
|
||||||
|
|
||||||
$this->assertTrue(false !== $this->getStorage()->read('token1'));
|
$this->assertNotFalse($this->getStorage()->read('token1'));
|
||||||
$this->assertCount(1, $this->getStorage()->find('127.0.0.1', '', 10, 'GET'));
|
$this->assertCount(1, $this->getStorage()->find('127.0.0.1', '', 10, 'GET'));
|
||||||
|
|
||||||
$profile = new Profile('token2');
|
$profile = new Profile('token2');
|
||||||
@ -223,7 +223,7 @@ abstract class AbstractProfilerStorageTest extends TestCase
|
|||||||
$profile->setMethod('GET');
|
$profile->setMethod('GET');
|
||||||
$this->getStorage()->write($profile);
|
$this->getStorage()->write($profile);
|
||||||
|
|
||||||
$this->assertTrue(false !== $this->getStorage()->read('token2'));
|
$this->assertNotFalse($this->getStorage()->read('token2'));
|
||||||
$this->assertCount(2, $this->getStorage()->find('127.0.0.1', '', 10, 'GET'));
|
$this->assertCount(2, $this->getStorage()->find('127.0.0.1', '', 10, 'GET'));
|
||||||
|
|
||||||
$this->getStorage()->purge();
|
$this->getStorage()->purge();
|
||||||
|
@ -36,7 +36,7 @@ class UriSignerTest extends TestCase
|
|||||||
$this->assertTrue($signer->check($signer->sign('http://example.com/foo?foo=bar')));
|
$this->assertTrue($signer->check($signer->sign('http://example.com/foo?foo=bar')));
|
||||||
$this->assertTrue($signer->check($signer->sign('http://example.com/foo?foo=bar&0=integer')));
|
$this->assertTrue($signer->check($signer->sign('http://example.com/foo?foo=bar&0=integer')));
|
||||||
|
|
||||||
$this->assertTrue($signer->sign('http://example.com/foo?foo=bar&bar=foo') === $signer->sign('http://example.com/foo?bar=foo&foo=bar'));
|
$this->assertSame($signer->sign('http://example.com/foo?foo=bar&bar=foo'), $signer->sign('http://example.com/foo?bar=foo&foo=bar'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testCheckWithDifferentArgSeparator()
|
public function testCheckWithDifferentArgSeparator()
|
||||||
|
@ -36,7 +36,7 @@ class IntlBundleReaderTest extends TestCase
|
|||||||
|
|
||||||
$this->assertInstanceOf('\ArrayAccess', $data);
|
$this->assertInstanceOf('\ArrayAccess', $data);
|
||||||
$this->assertSame('Bar', $data['Foo']);
|
$this->assertSame('Bar', $data['Foo']);
|
||||||
$this->assertFalse(isset($data['ExistsNot']));
|
$this->assertArrayNotHasKey('ExistsNot', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testReadFollowsAlias()
|
public function testReadFollowsAlias()
|
||||||
@ -46,7 +46,7 @@ class IntlBundleReaderTest extends TestCase
|
|||||||
|
|
||||||
$this->assertInstanceOf('\ArrayAccess', $data);
|
$this->assertInstanceOf('\ArrayAccess', $data);
|
||||||
$this->assertSame('Bar', $data['Foo']);
|
$this->assertSame('Bar', $data['Foo']);
|
||||||
$this->assertFalse(isset($data['ExistsNot']));
|
$this->assertArrayNotHasKey('ExistsNot', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testReadDoesNotFollowFallback()
|
public function testReadDoesNotFollowFallback()
|
||||||
@ -64,9 +64,9 @@ class IntlBundleReaderTest extends TestCase
|
|||||||
|
|
||||||
$this->assertInstanceOf('\ArrayAccess', $data);
|
$this->assertInstanceOf('\ArrayAccess', $data);
|
||||||
$this->assertSame('Bam', $data['Baz']);
|
$this->assertSame('Bam', $data['Baz']);
|
||||||
$this->assertFalse(isset($data['Foo']));
|
$this->assertArrayNotHasKey('Foo', $data);
|
||||||
$this->assertNull($data['Foo']);
|
$this->assertNull($data['Foo']);
|
||||||
$this->assertFalse(isset($data['ExistsNot']));
|
$this->assertArrayNotHasKey('ExistsNot', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testReadDoesNotFollowFallbackAlias()
|
public function testReadDoesNotFollowFallbackAlias()
|
||||||
@ -84,9 +84,9 @@ class IntlBundleReaderTest extends TestCase
|
|||||||
|
|
||||||
$this->assertInstanceOf('\ArrayAccess', $data);
|
$this->assertInstanceOf('\ArrayAccess', $data);
|
||||||
$this->assertSame('Bam', $data['Baz'], 'data from the aliased locale can be accessed');
|
$this->assertSame('Bam', $data['Baz'], 'data from the aliased locale can be accessed');
|
||||||
$this->assertFalse(isset($data['Foo']));
|
$this->assertArrayNotHasKey('Foo', $data);
|
||||||
$this->assertNull($data['Foo']);
|
$this->assertNull($data['Foo']);
|
||||||
$this->assertFalse(isset($data['ExistsNot']));
|
$this->assertArrayNotHasKey('ExistsNot', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -35,7 +35,7 @@ class JsonBundleReaderTest extends TestCase
|
|||||||
|
|
||||||
$this->assertInternalType('array', $data);
|
$this->assertInternalType('array', $data);
|
||||||
$this->assertSame('Bar', $data['Foo']);
|
$this->assertSame('Bar', $data['Foo']);
|
||||||
$this->assertFalse(isset($data['ExistsNot']));
|
$this->assertArrayNotHasKey('ExistsNot', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -35,7 +35,7 @@ class PhpBundleReaderTest extends TestCase
|
|||||||
|
|
||||||
$this->assertInternalType('array', $data);
|
$this->assertInternalType('array', $data);
|
||||||
$this->assertSame('Bar', $data['Foo']);
|
$this->assertSame('Bar', $data['Foo']);
|
||||||
$this->assertFalse(isset($data['ExistsNot']));
|
$this->assertArrayNotHasKey('ExistsNot', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -34,8 +34,8 @@ class RingBufferTest extends TestCase
|
|||||||
$this->buffer[0] = 'foo';
|
$this->buffer[0] = 'foo';
|
||||||
$this->buffer['bar'] = 'baz';
|
$this->buffer['bar'] = 'baz';
|
||||||
|
|
||||||
$this->assertTrue(isset($this->buffer[0]));
|
$this->assertArrayHasKey(0, $this->buffer);
|
||||||
$this->assertTrue(isset($this->buffer['bar']));
|
$this->assertArrayHasKey('bar', $this->buffer);
|
||||||
$this->assertSame('foo', $this->buffer[0]);
|
$this->assertSame('foo', $this->buffer[0]);
|
||||||
$this->assertSame('baz', $this->buffer['bar']);
|
$this->assertSame('baz', $this->buffer['bar']);
|
||||||
}
|
}
|
||||||
@ -46,8 +46,8 @@ class RingBufferTest extends TestCase
|
|||||||
$this->buffer['bar'] = 'baz';
|
$this->buffer['bar'] = 'baz';
|
||||||
$this->buffer[2] = 'bam';
|
$this->buffer[2] = 'bam';
|
||||||
|
|
||||||
$this->assertTrue(isset($this->buffer['bar']));
|
$this->assertArrayHasKey('bar', $this->buffer);
|
||||||
$this->assertTrue(isset($this->buffer[2]));
|
$this->assertArrayHasKey(2, $this->buffer);
|
||||||
$this->assertSame('baz', $this->buffer['bar']);
|
$this->assertSame('baz', $this->buffer['bar']);
|
||||||
$this->assertSame('bam', $this->buffer[2]);
|
$this->assertSame('bam', $this->buffer[2]);
|
||||||
}
|
}
|
||||||
@ -62,14 +62,14 @@ class RingBufferTest extends TestCase
|
|||||||
|
|
||||||
public function testQueryNonExisting()
|
public function testQueryNonExisting()
|
||||||
{
|
{
|
||||||
$this->assertFalse(isset($this->buffer['foo']));
|
$this->assertArrayNotHasKey('foo', $this->buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testUnsetNonExistingSucceeds()
|
public function testUnsetNonExistingSucceeds()
|
||||||
{
|
{
|
||||||
unset($this->buffer['foo']);
|
unset($this->buffer['foo']);
|
||||||
|
|
||||||
$this->assertFalse(isset($this->buffer['foo']));
|
$this->assertArrayNotHasKey('foo', $this->buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -86,7 +86,7 @@ class RingBufferTest extends TestCase
|
|||||||
|
|
||||||
public function testQueryOverwritten()
|
public function testQueryOverwritten()
|
||||||
{
|
{
|
||||||
$this->assertFalse(isset($this->buffer[0]));
|
$this->assertArrayNotHasKey(0, $this->buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testUnsetOverwrittenSucceeds()
|
public function testUnsetOverwrittenSucceeds()
|
||||||
@ -97,6 +97,6 @@ class RingBufferTest extends TestCase
|
|||||||
|
|
||||||
unset($this->buffer[0]);
|
unset($this->buffer[0]);
|
||||||
|
|
||||||
$this->assertFalse(isset($this->buffer[0]));
|
$this->assertArrayNotHasKey(0, $this->buffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,6 +43,6 @@ class StubLocaleTest extends TestCase
|
|||||||
public function testGetCurrencies()
|
public function testGetCurrencies()
|
||||||
{
|
{
|
||||||
$currencies = StubLocale::getCurrencies();
|
$currencies = StubLocale::getCurrencies();
|
||||||
$this->assertTrue(in_array('BRL', $currencies));
|
$this->assertContains('BRL', $currencies);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -124,7 +124,7 @@ class LegacyOptionsResolverTest extends TestCase
|
|||||||
$this->resolver->setDefaults(array(
|
$this->resolver->setDefaults(array(
|
||||||
'two' => function (Options $options) use ($test) {
|
'two' => function (Options $options) use ($test) {
|
||||||
/* @var TestCase $test */
|
/* @var TestCase $test */
|
||||||
$test->assertFalse(isset($options['one']));
|
$test->assertArrayNotHasKey('one', $options);
|
||||||
|
|
||||||
return '2';
|
return '2';
|
||||||
},
|
},
|
||||||
@ -148,7 +148,7 @@ class LegacyOptionsResolverTest extends TestCase
|
|||||||
$this->resolver->setDefaults(array(
|
$this->resolver->setDefaults(array(
|
||||||
'two' => function (Options $options) use ($test) {
|
'two' => function (Options $options) use ($test) {
|
||||||
/* @var TestCase $test */
|
/* @var TestCase $test */
|
||||||
$test->assertTrue(isset($options['one']));
|
$test->assertArrayHasKey('one', $options);
|
||||||
|
|
||||||
return $options['one'].'2';
|
return $options['one'].'2';
|
||||||
},
|
},
|
||||||
|
@ -1419,12 +1419,12 @@ class OptionsResolver2Dot6Test extends TestCase
|
|||||||
});
|
});
|
||||||
|
|
||||||
$this->resolver->setDefault('lazy2', function (Options $options) {
|
$this->resolver->setDefault('lazy2', function (Options $options) {
|
||||||
Assert::assertTrue(isset($options['default1']));
|
Assert::assertArrayHasKey('default1', $options);
|
||||||
Assert::assertTrue(isset($options['default2']));
|
Assert::assertArrayHasKey('default2', $options);
|
||||||
Assert::assertTrue(isset($options['required']));
|
Assert::assertArrayHasKey('required', $options);
|
||||||
Assert::assertTrue(isset($options['lazy1']));
|
Assert::assertArrayHasKey('lazy1', $options);
|
||||||
Assert::assertTrue(isset($options['lazy2']));
|
Assert::assertArrayHasKey('lazy2', $options);
|
||||||
Assert::assertFalse(isset($options['defined']));
|
Assert::assertArrayNotHasKey('defined', $options);
|
||||||
|
|
||||||
Assert::assertSame(0, $options['default1']);
|
Assert::assertSame(0, $options['default1']);
|
||||||
Assert::assertSame(42, $options['default2']);
|
Assert::assertSame(42, $options['default2']);
|
||||||
|
@ -567,7 +567,7 @@ class ProcessTest extends TestCase
|
|||||||
{
|
{
|
||||||
$process = $this->getProcess('echo foo');
|
$process = $this->getProcess('echo foo');
|
||||||
$process->run();
|
$process->run();
|
||||||
$this->assertTrue(strlen($process->getOutput()) > 0);
|
$this->assertGreaterThan(0, strlen($process->getOutput()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetExitCodeIsNullOnStart()
|
public function testGetExitCodeIsNullOnStart()
|
||||||
|
@ -61,9 +61,9 @@ class AuthorizationCheckerTest extends TestCase
|
|||||||
->will($this->returnValue(true));
|
->will($this->returnValue(true));
|
||||||
|
|
||||||
// first run the token has not been re-authenticated yet, after isGranted is called, it should be equal
|
// first run the token has not been re-authenticated yet, after isGranted is called, it should be equal
|
||||||
$this->assertFalse($newToken === $this->tokenStorage->getToken());
|
$this->assertNotSame($newToken, $this->tokenStorage->getToken());
|
||||||
$this->assertTrue($this->authorizationChecker->isGranted('foo'));
|
$this->assertTrue($this->authorizationChecker->isGranted('foo'));
|
||||||
$this->assertTrue($newToken === $this->tokenStorage->getToken());
|
$this->assertSame($newToken, $this->tokenStorage->getToken());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -90,7 +90,7 @@ class AuthorizationCheckerTest extends TestCase
|
|||||||
->method('decide')
|
->method('decide')
|
||||||
->will($this->returnValue($decide));
|
->will($this->returnValue($decide));
|
||||||
$this->tokenStorage->setToken($token);
|
$this->tokenStorage->setToken($token);
|
||||||
$this->assertTrue($decide === $this->authorizationChecker->isGranted('ROLE_FOO'));
|
$this->assertSame($decide, $this->authorizationChecker->isGranted('ROLE_FOO'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isGrantedProvider()
|
public function isGrantedProvider()
|
||||||
|
@ -41,7 +41,7 @@ class LegacySecurityContextTest extends TestCase
|
|||||||
->method('getToken')
|
->method('getToken')
|
||||||
->will($this->returnValue($token));
|
->will($this->returnValue($token));
|
||||||
|
|
||||||
$this->assertTrue($token === $this->securityContext->getToken());
|
$this->assertSame($token, $this->securityContext->getToken());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSetTokenDelegation()
|
public function testSetTokenDelegation()
|
||||||
|
@ -20,7 +20,7 @@ class HelperTest extends TestCase
|
|||||||
{
|
{
|
||||||
$helper = new ProjectTemplateHelper();
|
$helper = new ProjectTemplateHelper();
|
||||||
$helper->setCharset('ISO-8859-1');
|
$helper->setCharset('ISO-8859-1');
|
||||||
$this->assertTrue('ISO-8859-1' === $helper->getCharset(), '->setCharset() sets the charset set related to this helper');
|
$this->assertSame('ISO-8859-1', $helper->getCharset(), '->setCharset() sets the charset set related to this helper');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ class CacheLoaderTest extends TestCase
|
|||||||
public function testConstructor()
|
public function testConstructor()
|
||||||
{
|
{
|
||||||
$loader = new ProjectTemplateLoader($varLoader = new ProjectTemplateLoaderVar(), sys_get_temp_dir());
|
$loader = new ProjectTemplateLoader($varLoader = new ProjectTemplateLoaderVar(), sys_get_temp_dir());
|
||||||
$this->assertTrue($loader->getLoader() === $varLoader, '__construct() takes a template loader as its first argument');
|
$this->assertSame($loader->getLoader(), $varLoader, '__construct() takes a template loader as its first argument');
|
||||||
$this->assertEquals(sys_get_temp_dir(), $loader->getDir(), '__construct() takes a directory where to store the cache as its second argument');
|
$this->assertEquals(sys_get_temp_dir(), $loader->getDir(), '__construct() takes a directory where to store the cache as its second argument');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ class PhpEngineTest extends TestCase
|
|||||||
$engine[$foo] = 'bar';
|
$engine[$foo] = 'bar';
|
||||||
$this->assertEquals($foo, $engine->get('bar'), '->set() takes an alias as a second argument');
|
$this->assertEquals($foo, $engine->get('bar'), '->set() takes an alias as a second argument');
|
||||||
|
|
||||||
$this->assertTrue(isset($engine['bar']));
|
$this->assertArrayHasKey('bar', $engine);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$engine->get('foobar');
|
$engine->get('foobar');
|
||||||
@ -75,7 +75,7 @@ class PhpEngineTest extends TestCase
|
|||||||
$this->assertEquals('The helper "foobar" is not defined.', $e->getMessage(), '->get() throws an InvalidArgumentException if the helper is not defined');
|
$this->assertEquals('The helper "foobar" is not defined.', $e->getMessage(), '->get() throws an InvalidArgumentException if the helper is not defined');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->assertTrue(isset($engine['bar']));
|
$this->assertArrayHasKey('bar', $engine);
|
||||||
$this->assertTrue($engine->has('foo'), '->has() returns true if the helper exists');
|
$this->assertTrue($engine->has('foo'), '->has() returns true if the helper exists');
|
||||||
$this->assertFalse($engine->has('foobar'), '->has() returns false if the helper does not exist');
|
$this->assertFalse($engine->has('foobar'), '->has() returns false if the helper does not exist');
|
||||||
}
|
}
|
||||||
|
@ -89,16 +89,16 @@ class ConstraintViolationListTest extends TestCase
|
|||||||
$this->list[] = $violation;
|
$this->list[] = $violation;
|
||||||
|
|
||||||
$this->assertSame($violation, $this->list[0]);
|
$this->assertSame($violation, $this->list[0]);
|
||||||
$this->assertTrue(isset($this->list[0]));
|
$this->assertArrayHasKey(0, $this->list);
|
||||||
|
|
||||||
unset($this->list[0]);
|
unset($this->list[0]);
|
||||||
|
|
||||||
$this->assertFalse(isset($this->list[0]));
|
$this->assertArrayNotHasKey(0, $this->list);
|
||||||
|
|
||||||
$this->list[10] = $violation;
|
$this->list[10] = $violation;
|
||||||
|
|
||||||
$this->assertSame($violation, $this->list[10]);
|
$this->assertSame($violation, $this->list[10]);
|
||||||
$this->assertTrue(isset($this->list[10]));
|
$this->assertArrayHasKey(10, $this->list);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testToString()
|
public function testToString()
|
||||||
|
@ -62,15 +62,15 @@ class GroupSequenceTest extends TestCase
|
|||||||
|
|
||||||
$this->assertSame('Group 1', $sequence[0]);
|
$this->assertSame('Group 1', $sequence[0]);
|
||||||
$this->assertSame('Group 2', $sequence[1]);
|
$this->assertSame('Group 2', $sequence[1]);
|
||||||
$this->assertTrue(isset($sequence[0]));
|
$this->assertArrayHasKey(0, $sequence);
|
||||||
$this->assertFalse(isset($sequence[2]));
|
$this->assertArrayNotHasKey(2, $sequence);
|
||||||
unset($sequence[0]);
|
unset($sequence[0]);
|
||||||
$this->assertFalse(isset($sequence[0]));
|
$this->assertArrayNotHasKey(0, $sequence);
|
||||||
$sequence[] = 'Group 3';
|
$sequence[] = 'Group 3';
|
||||||
$this->assertTrue(isset($sequence[2]));
|
$this->assertArrayHasKey(2, $sequence);
|
||||||
$this->assertSame('Group 3', $sequence[2]);
|
$this->assertSame('Group 3', $sequence[2]);
|
||||||
$sequence[0] = 'Group 1';
|
$sequence[0] = 'Group 1';
|
||||||
$this->assertTrue(isset($sequence[0]));
|
$this->assertArrayHasKey(0, $sequence);
|
||||||
$this->assertSame('Group 1', $sequence[0]);
|
$this->assertSame('Group 1', $sequence[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user