changed some PHPUnit assertions to more specific ones
This commit is contained in:
parent
a4f0f0cc98
commit
4927d0c8a3
@ -35,7 +35,7 @@ class CollectionToArrayTransformerTest extends Propel1TestCase
|
|||||||
$result = $this->transformer->transform(new PropelObjectCollection());
|
$result = $this->transformer->transform(new PropelObjectCollection());
|
||||||
|
|
||||||
$this->assertTrue(is_array($result));
|
$this->assertTrue(is_array($result));
|
||||||
$this->assertEquals(0, count($result));
|
$this->assertCount(0, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testTransformWithNull()
|
public function testTransformWithNull()
|
||||||
@ -43,7 +43,7 @@ class CollectionToArrayTransformerTest extends Propel1TestCase
|
|||||||
$result = $this->transformer->transform(null);
|
$result = $this->transformer->transform(null);
|
||||||
|
|
||||||
$this->assertTrue(is_array($result));
|
$this->assertTrue(is_array($result));
|
||||||
$this->assertEquals(0, count($result));
|
$this->assertCount(0, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -62,7 +62,7 @@ class CollectionToArrayTransformerTest extends Propel1TestCase
|
|||||||
$result = $this->transformer->transform($coll);
|
$result = $this->transformer->transform($coll);
|
||||||
|
|
||||||
$this->assertTrue(is_array($result));
|
$this->assertTrue(is_array($result));
|
||||||
$this->assertEquals(2, count($result));
|
$this->assertCount(2, $result);
|
||||||
$this->assertEquals('foo', $result[0]);
|
$this->assertEquals('foo', $result[0]);
|
||||||
$this->assertEquals('bar', $result[1]);
|
$this->assertEquals('bar', $result[1]);
|
||||||
}
|
}
|
||||||
@ -72,7 +72,7 @@ class CollectionToArrayTransformerTest extends Propel1TestCase
|
|||||||
$result = $this->transformer->reverseTransform(null);
|
$result = $this->transformer->reverseTransform(null);
|
||||||
|
|
||||||
$this->assertInstanceOf('\PropelObjectCollection', $result);
|
$this->assertInstanceOf('\PropelObjectCollection', $result);
|
||||||
$this->assertEquals(0, count($result->getData()));
|
$this->assertCount(0, $result->getData());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testReverseTransformWithEmptyString()
|
public function testReverseTransformWithEmptyString()
|
||||||
@ -80,7 +80,7 @@ class CollectionToArrayTransformerTest extends Propel1TestCase
|
|||||||
$result = $this->transformer->reverseTransform('');
|
$result = $this->transformer->reverseTransform('');
|
||||||
|
|
||||||
$this->assertInstanceOf('\PropelObjectCollection', $result);
|
$this->assertInstanceOf('\PropelObjectCollection', $result);
|
||||||
$this->assertEquals(0, count($result->getData()));
|
$this->assertCount(0, $result->getData());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -101,7 +101,7 @@ class CollectionToArrayTransformerTest extends Propel1TestCase
|
|||||||
$this->assertInstanceOf('\PropelObjectCollection', $result);
|
$this->assertInstanceOf('\PropelObjectCollection', $result);
|
||||||
|
|
||||||
$this->assertTrue(is_array($data));
|
$this->assertTrue(is_array($data));
|
||||||
$this->assertEquals(2, count($data));
|
$this->assertCount(2, $data);
|
||||||
$this->assertEquals('foo', $data[0]);
|
$this->assertEquals('foo', $data[0]);
|
||||||
$this->assertEquals('bar', $data[1]);
|
$this->assertEquals('bar', $data[1]);
|
||||||
$this->assertsame($inputData, $data);
|
$this->assertsame($inputData, $data);
|
||||||
|
@ -46,7 +46,7 @@ class TemplateFinderTest extends TestCase
|
|||||||
$finder->findAllTemplates()
|
$finder->findAllTemplates()
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertEquals(6, count($templates), '->findAllTemplates() find all templates in the bundles and global folders');
|
$this->assertCount(6, $templates, '->findAllTemplates() find all templates in the bundles and global folders');
|
||||||
$this->assertContains('BaseBundle::base.format.engine', $templates);
|
$this->assertContains('BaseBundle::base.format.engine', $templates);
|
||||||
$this->assertContains('BaseBundle::this.is.a.template.format.engine', $templates);
|
$this->assertContains('BaseBundle::this.is.a.template.format.engine', $templates);
|
||||||
$this->assertContains('BaseBundle:controller:base.format.engine', $templates);
|
$this->assertContains('BaseBundle:controller:base.format.engine', $templates);
|
||||||
|
@ -73,7 +73,7 @@ class TwigLoaderPassTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
$this->pass->process($this->builder);
|
$this->pass->process($this->builder);
|
||||||
$calls = $this->chainLoader->getMethodCalls();
|
$calls = $this->chainLoader->getMethodCalls();
|
||||||
$this->assertEquals(2, count($calls));
|
$this->assertCount(2, $calls);
|
||||||
$this->assertEquals('addLoader', $calls[0][0]);
|
$this->assertEquals('addLoader', $calls[0][0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ class NodeBuilderTest extends \PHPUnit_Framework_TestCase
|
|||||||
->setNodeClass('newtype', $class)
|
->setNodeClass('newtype', $class)
|
||||||
->node('', 'newtype');
|
->node('', 'newtype');
|
||||||
|
|
||||||
$this->assertEquals(get_class($node), $class);
|
$this->assertInstanceOf($class, $node);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testOverridingAnExistingNodeType()
|
public function testOverridingAnExistingNodeType()
|
||||||
@ -57,7 +57,7 @@ class NodeBuilderTest extends \PHPUnit_Framework_TestCase
|
|||||||
->setNodeClass('variable', $class)
|
->setNodeClass('variable', $class)
|
||||||
->node('', 'variable');
|
->node('', 'variable');
|
||||||
|
|
||||||
$this->assertEquals(get_class($node), $class);
|
$this->assertInstanceOf($class, $node);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testNodeTypesAreNotCaseSensitive()
|
public function testNodeTypesAreNotCaseSensitive()
|
||||||
@ -67,14 +67,14 @@ class NodeBuilderTest extends \PHPUnit_Framework_TestCase
|
|||||||
$node1 = $builder->node('', 'VaRiAbLe');
|
$node1 = $builder->node('', 'VaRiAbLe');
|
||||||
$node2 = $builder->node('', 'variable');
|
$node2 = $builder->node('', 'variable');
|
||||||
|
|
||||||
$this->assertEquals(get_class($node1), get_class($node2));
|
$this->assertInstanceOf(get_class($node1), $node2);
|
||||||
|
|
||||||
$builder->setNodeClass('CuStOm', __NAMESPACE__.'\\SomeNodeDefinition');
|
$builder->setNodeClass('CuStOm', __NAMESPACE__.'\\SomeNodeDefinition');
|
||||||
|
|
||||||
$node1 = $builder->node('', 'CUSTOM');
|
$node1 = $builder->node('', 'CUSTOM');
|
||||||
$node2 = $builder->node('', 'custom');
|
$node2 = $builder->node('', 'custom');
|
||||||
|
|
||||||
$this->assertEquals(get_class($node1), get_class($node2));
|
$this->assertInstanceOf(get_class($node1), $node2);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testNumericNodeCreation()
|
public function testNumericNodeCreation()
|
||||||
@ -82,10 +82,10 @@ class NodeBuilderTest extends \PHPUnit_Framework_TestCase
|
|||||||
$builder = new NodeBuilder();
|
$builder = new NodeBuilder();
|
||||||
|
|
||||||
$node = $builder->integerNode('foo')->min(3)->max(5);
|
$node = $builder->integerNode('foo')->min(3)->max(5);
|
||||||
$this->assertEquals('Symfony\Component\Config\Definition\Builder\IntegerNodeDefinition', get_class($node));
|
$this->assertInstanceOf('Symfony\Component\Config\Definition\Builder\IntegerNodeDefinition', $node);
|
||||||
|
|
||||||
$node = $builder->floatNode('bar')->min(3.0)->max(5.0);
|
$node = $builder->floatNode('bar')->min(3.0)->max(5.0);
|
||||||
$this->assertEquals('Symfony\Component\Config\Definition\Builder\FloatNodeDefinition', get_class($node));
|
$this->assertInstanceOf('Symfony\Component\Config\Definition\Builder\FloatNodeDefinition', $node);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,11 +28,11 @@ class TreeBuilderTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
$nodeBuilder = $root->children();
|
$nodeBuilder = $root->children();
|
||||||
|
|
||||||
$this->assertEquals(get_class($nodeBuilder), 'Symfony\Component\Config\Tests\Definition\Builder\NodeBuilder');
|
$this->assertInstanceOf('Symfony\Component\Config\Tests\Definition\Builder\NodeBuilder', $nodeBuilder);
|
||||||
|
|
||||||
$nodeBuilder = $nodeBuilder->arrayNode('deeper')->children();
|
$nodeBuilder = $nodeBuilder->arrayNode('deeper')->children();
|
||||||
|
|
||||||
$this->assertEquals(get_class($nodeBuilder), 'Symfony\Component\Config\Tests\Definition\Builder\NodeBuilder');
|
$this->assertInstanceOf('Symfony\Component\Config\Tests\Definition\Builder\NodeBuilder', $nodeBuilder);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testOverrideABuiltInNodeType()
|
public function testOverrideABuiltInNodeType()
|
||||||
@ -42,7 +42,7 @@ class TreeBuilderTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
$definition = $root->children()->variableNode('variable');
|
$definition = $root->children()->variableNode('variable');
|
||||||
|
|
||||||
$this->assertEquals(get_class($definition), 'Symfony\Component\Config\Tests\Definition\Builder\VariableNodeDefinition');
|
$this->assertInstanceOf('Symfony\Component\Config\Tests\Definition\Builder\VariableNodeDefinition', $definition);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testAddANodeType()
|
public function testAddANodeType()
|
||||||
@ -52,7 +52,7 @@ class TreeBuilderTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
$definition = $root->children()->barNode('variable');
|
$definition = $root->children()->barNode('variable');
|
||||||
|
|
||||||
$this->assertEquals(get_class($definition), 'Symfony\Component\Config\Tests\Definition\Builder\BarNodeDefinition');
|
$this->assertInstanceOf('Symfony\Component\Config\Tests\Definition\Builder\BarNodeDefinition', $definition);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testCreateABuiltInNodeTypeWithACustomNodeBuilder()
|
public function testCreateABuiltInNodeTypeWithACustomNodeBuilder()
|
||||||
@ -62,7 +62,7 @@ class TreeBuilderTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
$definition = $root->children()->booleanNode('boolean');
|
$definition = $root->children()->booleanNode('boolean');
|
||||||
|
|
||||||
$this->assertEquals(get_class($definition), 'Symfony\Component\Config\Definition\Builder\BooleanNodeDefinition');
|
$this->assertInstanceOf('Symfony\Component\Config\Definition\Builder\BooleanNodeDefinition', $definition);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testPrototypedArrayNodeUseTheCustomNodeBuilder()
|
public function testPrototypedArrayNodeUseTheCustomNodeBuilder()
|
||||||
|
@ -97,11 +97,11 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
$application = new Application();
|
$application = new Application();
|
||||||
$commands = $application->all();
|
$commands = $application->all();
|
||||||
$this->assertEquals('Symfony\\Component\\Console\\Command\\HelpCommand', get_class($commands['help']), '->all() returns the registered commands');
|
$this->assertInstanceOf('Symfony\\Component\\Console\\Command\\HelpCommand', $commands['help'], '->all() returns the registered commands');
|
||||||
|
|
||||||
$application->add(new \FooCommand());
|
$application->add(new \FooCommand());
|
||||||
$commands = $application->all('foo');
|
$commands = $application->all('foo');
|
||||||
$this->assertEquals(1, count($commands), '->all() takes a namespace as its first argument');
|
$this->assertCount(1, $commands, '->all() takes a namespace as its first argument');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testRegister()
|
public function testRegister()
|
||||||
@ -481,8 +481,8 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase
|
|||||||
$application->run();
|
$application->run();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
|
|
||||||
$this->assertSame('Symfony\Component\Console\Input\ArgvInput', get_class($command->input), '->run() creates an ArgvInput by default if none is given');
|
$this->assertInstanceOf('Symfony\Component\Console\Input\ArgvInput', $command->input, '->run() creates an ArgvInput by default if none is given');
|
||||||
$this->assertSame('Symfony\Component\Console\Output\ConsoleOutput', get_class($command->output), '->run() creates a ConsoleOutput by default if none is given');
|
$this->assertInstanceOf('Symfony\Component\Console\Output\ConsoleOutput', $command->output, '->run() creates a ConsoleOutput by default if none is given');
|
||||||
|
|
||||||
$application = new Application();
|
$application = new Application();
|
||||||
$application->setAutoExit(false);
|
$application->setAutoExit(false);
|
||||||
|
@ -47,7 +47,7 @@ class ParserTest extends \PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
$parser = new Parser();
|
$parser = new Parser();
|
||||||
$selectors = $parser->parse($source);
|
$selectors = $parser->parse($source);
|
||||||
$this->assertEquals(1, count($selectors));
|
$this->assertCount(1, $selectors);
|
||||||
|
|
||||||
/** @var SelectorNode $selector */
|
/** @var SelectorNode $selector */
|
||||||
$selector = $selectors[0];
|
$selector = $selectors[0];
|
||||||
@ -60,7 +60,7 @@ class ParserTest extends \PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
$parser = new Parser();
|
$parser = new Parser();
|
||||||
$selectors = $parser->parse($source);
|
$selectors = $parser->parse($source);
|
||||||
$this->assertEquals(1, count($selectors));
|
$this->assertCount(1, $selectors);
|
||||||
|
|
||||||
/** @var SelectorNode $selector */
|
/** @var SelectorNode $selector */
|
||||||
$selector = $selectors[0];
|
$selector = $selectors[0];
|
||||||
@ -72,7 +72,7 @@ class ParserTest extends \PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
$parser = new Parser();
|
$parser = new Parser();
|
||||||
$selectors = $parser->parse(sprintf(':nth-child(%s)', $series));
|
$selectors = $parser->parse(sprintf(':nth-child(%s)', $series));
|
||||||
$this->assertEquals(1, count($selectors));
|
$this->assertCount(1, $selectors);
|
||||||
|
|
||||||
/** @var FunctionNode $function */
|
/** @var FunctionNode $function */
|
||||||
$function = $selectors[0]->getTree();
|
$function = $selectors[0]->getTree();
|
||||||
@ -84,7 +84,7 @@ class ParserTest extends \PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
$parser = new Parser();
|
$parser = new Parser();
|
||||||
$selectors = $parser->parse(sprintf(':nth-child(%s)', $series));
|
$selectors = $parser->parse(sprintf(':nth-child(%s)', $series));
|
||||||
$this->assertEquals(1, count($selectors));
|
$this->assertCount(1, $selectors);
|
||||||
|
|
||||||
/** @var FunctionNode $function */
|
/** @var FunctionNode $function */
|
||||||
$function = $selectors[0]->getTree();
|
$function = $selectors[0]->getTree();
|
||||||
|
@ -24,7 +24,7 @@ class ClassParserTest extends \PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
$parser = new ClassParser();
|
$parser = new ClassParser();
|
||||||
$selectors = $parser->parse($source);
|
$selectors = $parser->parse($source);
|
||||||
$this->assertEquals(1, count($selectors));
|
$this->assertCount(1, $selectors);
|
||||||
|
|
||||||
/** @var SelectorNode $selector */
|
/** @var SelectorNode $selector */
|
||||||
$selector = $selectors[0];
|
$selector = $selectors[0];
|
||||||
|
@ -24,7 +24,7 @@ class ElementParserTest extends \PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
$parser = new ElementParser();
|
$parser = new ElementParser();
|
||||||
$selectors = $parser->parse($source);
|
$selectors = $parser->parse($source);
|
||||||
$this->assertEquals(1, count($selectors));
|
$this->assertCount(1, $selectors);
|
||||||
|
|
||||||
/** @var SelectorNode $selector */
|
/** @var SelectorNode $selector */
|
||||||
$selector = $selectors[0];
|
$selector = $selectors[0];
|
||||||
|
@ -23,13 +23,13 @@ class EmptyStringParserTest extends \PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
$parser = new EmptyStringParser();
|
$parser = new EmptyStringParser();
|
||||||
$selectors = $parser->parse('');
|
$selectors = $parser->parse('');
|
||||||
$this->assertEquals(1, count($selectors));
|
$this->assertCount(1, $selectors);
|
||||||
|
|
||||||
/** @var SelectorNode $selector */
|
/** @var SelectorNode $selector */
|
||||||
$selector = $selectors[0];
|
$selector = $selectors[0];
|
||||||
$this->assertEquals('Element[*]', (string) $selector->getTree());
|
$this->assertEquals('Element[*]', (string) $selector->getTree());
|
||||||
|
|
||||||
$selectors = $parser->parse('this will produce an empty array');
|
$selectors = $parser->parse('this will produce an empty array');
|
||||||
$this->assertEquals(0, count($selectors));
|
$this->assertCount(0, $selectors);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ class HashParserTest extends \PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
$parser = new HashParser();
|
$parser = new HashParser();
|
||||||
$selectors = $parser->parse($source);
|
$selectors = $parser->parse($source);
|
||||||
$this->assertEquals(1, count($selectors));
|
$this->assertCount(1, $selectors);
|
||||||
|
|
||||||
/** @var SelectorNode $selector */
|
/** @var SelectorNode $selector */
|
||||||
$selector = $selectors[0];
|
$selector = $selectors[0];
|
||||||
|
@ -113,7 +113,7 @@ class FlattenExceptionTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
$this->assertEquals($exception->getMessage(), $flattened->getMessage(), 'The message is copied from the original exception.');
|
$this->assertEquals($exception->getMessage(), $flattened->getMessage(), 'The message is copied from the original exception.');
|
||||||
$this->assertEquals($exception->getCode(), $flattened->getCode(), 'The code is copied from the original exception.');
|
$this->assertEquals($exception->getCode(), $flattened->getCode(), 'The code is copied from the original exception.');
|
||||||
$this->assertEquals(get_class($exception), $flattened->getClass(), 'The class is set to the class of the original exception');
|
$this->assertInstanceOf($flattened->getClass(), $exception, 'The class is set to the class of the original exception');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ class XmlFileLoaderTest extends \PHPUnit_Framework_TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
$xml = $m->invoke($loader, self::$fixturesPath.'/xml/services1.xml');
|
$xml = $m->invoke($loader, self::$fixturesPath.'/xml/services1.xml');
|
||||||
$this->assertEquals('Symfony\\Component\\DependencyInjection\\SimpleXMLElement', get_class($xml), '->parseFile() returns an SimpleXMLElement object');
|
$this->assertInstanceOf('Symfony\\Component\\DependencyInjection\\SimpleXMLElement', $xml, '->parseFile() returns an SimpleXMLElement object');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testLoadParameters()
|
public function testLoadParameters()
|
||||||
@ -134,20 +134,20 @@ class XmlFileLoaderTest extends \PHPUnit_Framework_TestCase
|
|||||||
$loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath.'/xml'));
|
$loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath.'/xml'));
|
||||||
$loader->load('services5.xml');
|
$loader->load('services5.xml');
|
||||||
$services = $container->getDefinitions();
|
$services = $container->getDefinitions();
|
||||||
$this->assertEquals(4, count($services), '->load() attributes unique ids to anonymous services');
|
$this->assertCount(4, $services, '->load() attributes unique ids to anonymous services');
|
||||||
|
|
||||||
// anonymous service as an argument
|
// anonymous service as an argument
|
||||||
$args = $services['foo']->getArguments();
|
$args = $services['foo']->getArguments();
|
||||||
$this->assertEquals(1, count($args), '->load() references anonymous services as "normal" ones');
|
$this->assertCount(1, $args, '->load() references anonymous services as "normal" ones');
|
||||||
$this->assertEquals('Symfony\\Component\\DependencyInjection\\Reference', get_class($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->assertTrue(isset($services[(string) $args[0]]), '->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');
|
||||||
|
|
||||||
// inner anonymous services
|
// inner anonymous services
|
||||||
$args = $inner->getArguments();
|
$args = $inner->getArguments();
|
||||||
$this->assertEquals(1, count($args), '->load() references anonymous services as "normal" ones');
|
$this->assertCount(1, $args, '->load() references anonymous services as "normal" ones');
|
||||||
$this->assertEquals('Symfony\\Component\\DependencyInjection\\Reference', get_class($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->assertTrue(isset($services[(string) $args[0]]), '->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');
|
||||||
@ -155,7 +155,7 @@ class XmlFileLoaderTest extends \PHPUnit_Framework_TestCase
|
|||||||
// anonymous service as a property
|
// anonymous service as a property
|
||||||
$properties = $services['foo']->getProperties();
|
$properties = $services['foo']->getProperties();
|
||||||
$property = $properties['p'];
|
$property = $properties['p'];
|
||||||
$this->assertEquals('Symfony\\Component\\DependencyInjection\\Reference', get_class($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->assertTrue(isset($services[(string) $property]), '->load() makes a reference to the created ones');
|
||||||
$inner = $services[(string) $property];
|
$inner = $services[(string) $property];
|
||||||
$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');
|
||||||
@ -168,7 +168,7 @@ class XmlFileLoaderTest extends \PHPUnit_Framework_TestCase
|
|||||||
$loader->load('services6.xml');
|
$loader->load('services6.xml');
|
||||||
$services = $container->getDefinitions();
|
$services = $container->getDefinitions();
|
||||||
$this->assertTrue(isset($services['foo']), '->load() parses <service> elements');
|
$this->assertTrue(isset($services['foo']), '->load() parses <service> elements');
|
||||||
$this->assertEquals('Symfony\\Component\\DependencyInjection\\Definition', get_class($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');
|
||||||
$this->assertEquals('container', $services['scope.container']->getScope());
|
$this->assertEquals('container', $services['scope.container']->getScope());
|
||||||
$this->assertEquals('custom', $services['scope.custom']->getScope());
|
$this->assertEquals('custom', $services['scope.custom']->getScope());
|
||||||
@ -361,11 +361,11 @@ class XmlFileLoaderTest extends \PHPUnit_Framework_TestCase
|
|||||||
$loader1 = new XmlFileLoader($container, new FileLocator(self::$fixturesPath.'/xml/extension1'));
|
$loader1 = new XmlFileLoader($container, new FileLocator(self::$fixturesPath.'/xml/extension1'));
|
||||||
$loader1->load('services.xml');
|
$loader1->load('services.xml');
|
||||||
$services = $container->getDefinitions();
|
$services = $container->getDefinitions();
|
||||||
$this->assertEquals(2, count($services), '->load() attributes unique ids to anonymous services');
|
$this->assertCount(2, $services, '->load() attributes unique ids to anonymous services');
|
||||||
$loader2 = new XmlFileLoader($container, new FileLocator(self::$fixturesPath.'/xml/extension2'));
|
$loader2 = new XmlFileLoader($container, new FileLocator(self::$fixturesPath.'/xml/extension2'));
|
||||||
$loader2->load('services.xml');
|
$loader2->load('services.xml');
|
||||||
$services = $container->getDefinitions();
|
$services = $container->getDefinitions();
|
||||||
$this->assertEquals(4, count($services), '->load() attributes unique ids to anonymous services');
|
$this->assertCount(4, $services, '->load() attributes unique ids to anonymous services');
|
||||||
|
|
||||||
$services = $container->getDefinitions();
|
$services = $container->getDefinitions();
|
||||||
$args1 = $services['extension1.foo']->getArguments();
|
$args1 = $services['extension1.foo']->getArguments();
|
||||||
|
@ -113,7 +113,7 @@ class YamlFileLoaderTest extends \PHPUnit_Framework_TestCase
|
|||||||
$loader->load('services6.yml');
|
$loader->load('services6.yml');
|
||||||
$services = $container->getDefinitions();
|
$services = $container->getDefinitions();
|
||||||
$this->assertTrue(isset($services['foo']), '->load() parses service elements');
|
$this->assertTrue(isset($services['foo']), '->load() parses service elements');
|
||||||
$this->assertEquals('Symfony\\Component\\DependencyInjection\\Definition', get_class($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');
|
||||||
$this->assertEquals('container', $services['scope.container']->getScope());
|
$this->assertEquals('container', $services['scope.container']->getScope());
|
||||||
$this->assertEquals('custom', $services['scope.custom']->getScope());
|
$this->assertEquals('custom', $services['scope.custom']->getScope());
|
||||||
|
@ -584,7 +584,7 @@ class FormTest extends \PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
$form = $this->createForm('<form method="post"><input type="text" name="bar" value="bar" /><input type="submit" /></form>');
|
$form = $this->createForm('<form method="post"><input type="text" name="bar" value="bar" /><input type="submit" /></form>');
|
||||||
|
|
||||||
$this->assertEquals('Symfony\\Component\\DomCrawler\\Field\\InputFormField', get_class($form->get('bar')), '->get() returns the field object associated with the given name');
|
$this->assertInstanceOf('Symfony\\Component\\DomCrawler\\Field\\InputFormField', $form->get('bar'), '->get() returns the field object associated with the given name');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$form->get('foo');
|
$form->get('foo');
|
||||||
@ -599,8 +599,8 @@ class FormTest extends \PHPUnit_Framework_TestCase
|
|||||||
$form = $this->createForm('<form method="post"><input type="text" name="bar" value="bar" /><input type="submit" /></form>');
|
$form = $this->createForm('<form method="post"><input type="text" name="bar" value="bar" /><input type="submit" /></form>');
|
||||||
|
|
||||||
$fields = $form->all();
|
$fields = $form->all();
|
||||||
$this->assertEquals(1, count($fields), '->all() return an array of form field objects');
|
$this->assertCount(1, $fields, '->all() return an array of form field objects');
|
||||||
$this->assertEquals('Symfony\\Component\\DomCrawler\\Field\\InputFormField', get_class($fields['bar']), '->all() return an array of form field objects');
|
$this->assertInstanceOf('Symfony\\Component\\DomCrawler\\Field\\InputFormField', $fields['bar'], '->all() return an array of form field objects');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSubmitWithoutAFormButton()
|
public function testSubmitWithoutAFormButton()
|
||||||
|
@ -554,7 +554,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
|||||||
$finder = $this->buildFinder($adapter);
|
$finder = $this->buildFinder($adapter);
|
||||||
$finder->in($locations)->depth('< 1')->name('test.php');
|
$finder->in($locations)->depth('< 1')->name('test.php');
|
||||||
|
|
||||||
$this->assertEquals(1, count($finder));
|
$this->assertCount(1, $finder);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -735,7 +735,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
|||||||
$this->assertIterator($this->toAbsolute(array('foo bar', 'test.php', 'test.py')), $finder->getIterator());
|
$this->assertIterator($this->toAbsolute(array('foo bar', 'test.php', 'test.py')), $finder->getIterator());
|
||||||
$this->fail('Finder should throw an exception when opening a non-readable directory.');
|
$this->fail('Finder should throw an exception when opening a non-readable directory.');
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->assertEquals('Symfony\\Component\\Finder\\Exception\\AccessDeniedException', get_class($e));
|
$this->assertInstanceOf('Symfony\\Component\\Finder\\Exception\\AccessDeniedException', $e);
|
||||||
}
|
}
|
||||||
|
|
||||||
// restore original permissions
|
// restore original permissions
|
||||||
|
@ -150,6 +150,6 @@ class FlashBagTest extends \PHPUnit_Framework_TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->assertEquals(count($flashes), $i);
|
$this->assertEquals(count($flashes), $i);
|
||||||
$this->assertEquals(0, count($this->bag->all()));
|
$this->assertCount(0, $this->bag->all());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -217,7 +217,7 @@ class SessionTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->session->set('hello', 'world');
|
$this->session->set('hello', 'world');
|
||||||
$this->session->set('symfony2', 'rocks');
|
$this->session->set('symfony2', 'rocks');
|
||||||
|
|
||||||
$this->assertEquals(2, count($this->session));
|
$this->assertCount(2, $this->session);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetMeta()
|
public function testGetMeta()
|
||||||
|
@ -79,11 +79,11 @@ class PdoSessionHandlerTest extends \PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
$storage = new PdoSessionHandler($this->pdo, array('db_table' => 'sessions'), array());
|
$storage = new PdoSessionHandler($this->pdo, array('db_table' => 'sessions'), array());
|
||||||
$storage->write('foo', 'bar');
|
$storage->write('foo', 'bar');
|
||||||
$this->assertEquals(1, count($this->pdo->query('SELECT * FROM sessions')->fetchAll()));
|
$this->assertCount(1, $this->pdo->query('SELECT * FROM sessions')->fetchAll());
|
||||||
|
|
||||||
$storage->destroy('foo');
|
$storage->destroy('foo');
|
||||||
|
|
||||||
$this->assertEquals(0, count($this->pdo->query('SELECT * FROM sessions')->fetchAll()));
|
$this->assertCount(0, $this->pdo->query('SELECT * FROM sessions')->fetchAll());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSessionGC()
|
public function testSessionGC()
|
||||||
@ -93,9 +93,9 @@ class PdoSessionHandlerTest extends \PHPUnit_Framework_TestCase
|
|||||||
$storage->write('foo', 'bar');
|
$storage->write('foo', 'bar');
|
||||||
$storage->write('baz', 'bar');
|
$storage->write('baz', 'bar');
|
||||||
|
|
||||||
$this->assertEquals(2, count($this->pdo->query('SELECT * FROM sessions')->fetchAll()));
|
$this->assertCount(2, $this->pdo->query('SELECT * FROM sessions')->fetchAll());
|
||||||
|
|
||||||
$storage->gc(-1);
|
$storage->gc(-1);
|
||||||
$this->assertEquals(0, count($this->pdo->query('SELECT * FROM sessions')->fetchAll()));
|
$this->assertCount(0, $this->pdo->query('SELECT * FROM sessions')->fetchAll());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user