From 3cfaade8f79a46970032c462207e3ab95b23f654 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dariusz=20G=C3=B3recki?= Date: Wed, 18 Jan 2012 14:42:47 +0100 Subject: [PATCH] [CS] Fix usage of assertCount Bug fix: no Feature addition: no Backwards compatibility break: no Symfony2 tests pass: yes Fixes the following tickets: - Todo: - --- .../ContainerAwareEventDispatcherTest.php | 2 +- .../Compiler/ProfilerPassTest.php | 2 +- .../FrameworkExtensionTest.php | 4 +-- .../Tests/Translation/PhpExtractorTest.php | 2 +- .../Functional/LocalizedRoutesAsPathTest.php | 2 +- .../AnalyzeServiceReferencesPassTest.php | 6 ++--- .../ResolveInvalidReferencesPassTest.php | 2 +- .../ContainerBuilderTest.php | 2 +- .../Component/DomCrawler/CrawlerTest.php | 26 +++++++++---------- .../EventDispatcher/EventDispatcherTest.php | 12 ++++----- .../Core/Type/CollectionTypeTest.php | 6 ++--- .../Extension/Core/Type/FieldTypeTest.php | 2 +- .../Csrf/Type/FormTypeCsrfExtensionTest.php | 2 +- .../Symfony/Tests/Component/Form/FormTest.php | 2 +- .../HttpFoundation/ResponseHeaderBagTest.php | 2 +- .../Tests/Component/HttpKernel/ClientTest.php | 4 +-- .../HttpKernel/Debug/StopwatchEventTest.php | 6 ++--- .../HttpKernel/Debug/StopwatchTest.php | 6 ++--- .../EventListener/ExceptionListenerTest.php | 2 +- .../HttpKernel/HttpCache/HttpCacheTest.php | 8 +++--- .../HttpKernel/HttpCache/StoreTest.php | 4 +-- .../Security/Acl/Dbal/AclProviderTest.php | 10 +++---- .../Acl/Dbal/MutableAclProviderTest.php | 12 ++++----- .../Component/Security/Acl/Domain/AclTest.php | 18 ++++++------- .../CookieClearingLogoutHandlerTest.php | 4 +-- ...istentTokenBasedRememberMeServicesTest.php | 2 +- .../TokenBasedRememberMeServicesTest.php | 6 ++--- .../Validator/ExecutionContextTest.php | 6 ++--- .../Component/Validator/GraphWalkerTest.php | 18 ++++++------- .../Validator/Mapping/ClassMetadataTest.php | 4 +-- .../Component/Validator/ValidatorTest.php | 6 ++--- 31 files changed, 95 insertions(+), 95 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/ContainerAwareEventDispatcherTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/ContainerAwareEventDispatcherTest.php index 78396ac082..65d3d3ec8f 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/ContainerAwareEventDispatcherTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/ContainerAwareEventDispatcherTest.php @@ -189,7 +189,7 @@ class ContainerAwareEventDispatcherTest extends \PHPUnit_Framework_TestCase $this->assertTrue(isset($listeners['onEvent'])); - $this->assertEquals(1, count($dispatcher->getListeners('onEvent'))); + $this->assertCount(1, $dispatcher->getListeners('onEvent')); } } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/ProfilerPassTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/ProfilerPassTest.php index 02cb33bcf5..05c3ec1862 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/ProfilerPassTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/ProfilerPassTest.php @@ -70,7 +70,7 @@ class ProfilerPassTest extends \PHPUnit_Framework_TestCase // grab the method calls off of the "profiler" definition $methodCalls = $definition->getMethodCalls(); - $this->assertEquals(1, count($methodCalls)); + $this->assertCount(1, $methodCalls); $this->assertEquals('add', $methodCalls[0][0]); // grab the method part of the first call } } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php index 90f5738737..3da5483944 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php @@ -226,11 +226,11 @@ abstract class FrameworkExtensionTest extends TestCase )); $yamlArgs = $container->getParameter('validator.mapping.loader.yaml_files_loader.mapping_files'); - $this->assertEquals(1, count($yamlArgs)); + $this->assertCount(1, $yamlArgs); $this->assertStringEndsWith('TestBundle'.DIRECTORY_SEPARATOR.'Resources'.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'validation.yml', $yamlArgs[0]); $xmlArgs = $container->getParameter('validator.mapping.loader.xml_files_loader.mapping_files'); - $this->assertEquals(2, count($xmlArgs)); + $this->assertCount(2, $xmlArgs); $this->assertStringEndsWith('Component/Form/Resources/config/validation.xml', $xmlArgs[0]); $this->assertStringEndsWith('TestBundle'.DIRECTORY_SEPARATOR.'Resources'.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'validation.xml', $xmlArgs[1]); } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Translation/PhpExtractorTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Translation/PhpExtractorTest.php index c9b1b689c3..4305f0e69c 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Translation/PhpExtractorTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Translation/PhpExtractorTest.php @@ -28,7 +28,7 @@ class PhpExtractorTest extends TestCase $extractor->extract(__DIR__.'/../Fixtures/Resources/views/', $catalogue); // Assert - $this->assertEquals(1, count($catalogue->all('messages')), '->extract() should find 1 translation'); + $this->assertCount(1, $catalogue->all('messages'), '->extract() should find 1 translation'); $this->assertTrue($catalogue->has('new key'), '->extract() should find at leat "new key" message'); $this->assertEquals('prefixnew key', $catalogue->get('new key'), '->extract() should apply "prefix" as prefix'); } diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/LocalizedRoutesAsPathTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/LocalizedRoutesAsPathTest.php index fd314d3fda..744d76976a 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/LocalizedRoutesAsPathTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/LocalizedRoutesAsPathTest.php @@ -64,7 +64,7 @@ class LocalizedRoutesAsPathTest extends WebTestCase $client->insulate(); $crawler = $client->request('GET', '/'.$locale.'/secure/'); - $this->assertEquals(1, count($crawler->selectButton('login')), (string) $client->getResponse()); + $this->assertCount(1, $crawler->selectButton('login'), (string) $client->getResponse()); } public function getLocales() diff --git a/tests/Symfony/Tests/Component/DependencyInjection/Compiler/AnalyzeServiceReferencesPassTest.php b/tests/Symfony/Tests/Component/DependencyInjection/Compiler/AnalyzeServiceReferencesPassTest.php index 40ed58f38d..c342a04c51 100644 --- a/tests/Symfony/Tests/Component/DependencyInjection/Compiler/AnalyzeServiceReferencesPassTest.php +++ b/tests/Symfony/Tests/Component/DependencyInjection/Compiler/AnalyzeServiceReferencesPassTest.php @@ -47,7 +47,7 @@ class AnalyzeServiceReferencesPassTest extends \PHPUnit_Framework_TestCase $graph = $this->process($container); - $this->assertEquals(3, count($edges = $graph->getNode('b')->getInEdges())); + $this->assertCount(3, $edges = $graph->getNode('b')->getInEdges()); $this->assertSame($ref1, $edges[0]->getValue()); $this->assertSame($ref4, $edges[1]->getValue()); $this->assertSame($ref5, $edges[2]->getValue()); @@ -68,7 +68,7 @@ class AnalyzeServiceReferencesPassTest extends \PHPUnit_Framework_TestCase $graph = $this->process($container); - $this->assertEquals(1, count($refs = $graph->getNode('a')->getInEdges())); + $this->assertCount(1, $refs = $graph->getNode('a')->getInEdges()); $this->assertSame($ref, $refs[0]->getValue()); } @@ -87,7 +87,7 @@ class AnalyzeServiceReferencesPassTest extends \PHPUnit_Framework_TestCase $graph = $this->process($container); - $this->assertEquals(2, count($graph->getNode('a')->getInEdges())); + $this->assertCount(2, $graph->getNode('a')->getInEdges()); } protected function process(ContainerBuilder $container) diff --git a/tests/Symfony/Tests/Component/DependencyInjection/Compiler/ResolveInvalidReferencesPassTest.php b/tests/Symfony/Tests/Component/DependencyInjection/Compiler/ResolveInvalidReferencesPassTest.php index 6c8f312495..7cbf5e6ada 100644 --- a/tests/Symfony/Tests/Component/DependencyInjection/Compiler/ResolveInvalidReferencesPassTest.php +++ b/tests/Symfony/Tests/Component/DependencyInjection/Compiler/ResolveInvalidReferencesPassTest.php @@ -31,7 +31,7 @@ class ResolveInvalidReferencesPassTest extends \PHPUnit_Framework_TestCase $arguments = $def->getArguments(); $this->assertNull($arguments[0]); - $this->assertEquals(0, count($def->getMethodCalls())); + $this->assertCount(0, $def->getMethodCalls()); } public function testProcessIgnoreNonExistentServices() diff --git a/tests/Symfony/Tests/Component/DependencyInjection/ContainerBuilderTest.php b/tests/Symfony/Tests/Component/DependencyInjection/ContainerBuilderTest.php index 49c3d4ac5c..b026bcec82 100644 --- a/tests/Symfony/Tests/Component/DependencyInjection/ContainerBuilderTest.php +++ b/tests/Symfony/Tests/Component/DependencyInjection/ContainerBuilderTest.php @@ -174,7 +174,7 @@ class ContainerBuilderTest extends \PHPUnit_Framework_TestCase $builder->set('foobar', 'stdClass'); $builder->set('moo', 'stdClass'); - $this->assertEquals(0, count($builder->getAliases()), '->getAliases() does not return aliased services that have been overridden'); + $this->assertCount(0, $builder->getAliases(), '->getAliases() does not return aliased services that have been overridden'); } /** diff --git a/tests/Symfony/Tests/Component/DomCrawler/CrawlerTest.php b/tests/Symfony/Tests/Component/DomCrawler/CrawlerTest.php index 78bb9c38ed..124d28407e 100644 --- a/tests/Symfony/Tests/Component/DomCrawler/CrawlerTest.php +++ b/tests/Symfony/Tests/Component/DomCrawler/CrawlerTest.php @@ -90,7 +90,7 @@ EOF , 'UTF-8'); $errors = libxml_get_errors(); - $this->assertEquals(1, count($errors)); + $this->assertCount(1, $errors); $this->assertEquals("Tag nav invalid\n", $errors[0]->message); libxml_clear_errors(); @@ -226,7 +226,7 @@ EOF $this->assertInstanceOf('Symfony\\Component\\DomCrawler\\Crawler', $crawler, '->eq() returns a new instance of a crawler'); $this->assertEquals('Two', $crawler->eq(1)->text(), '->eq() returns the nth node of the list'); - $this->assertEquals(0, count($crawler->eq(100)), '->eq() returns an empty crawler if the nth node does not exist'); + $this->assertCount(0, $crawler->eq(100), '->eq() returns an empty crawler if the nth node does not exist'); } public function testEach() @@ -297,7 +297,7 @@ EOF $crawler = $this->createTestCrawler()->filter('ul'); - $this->assertEquals(6, count($crawler->filterXPath('//li')), '->filterXPath() filters the node list with the XPath expression'); + $this->assertCount(6, $crawler->filterXPath('//li'), '->filterXPath() filters the node list with the XPath expression'); } /** @@ -311,7 +311,7 @@ EOF $crawler = $this->createTestCrawler()->filter('ul'); - $this->assertEquals(6, count($crawler->filter('li')), '->filter() filters the node list with the CSS selector'); + $this->assertCount(6, $crawler->filter('li'), '->filter() filters the node list with the CSS selector'); } public function testSelectLink() @@ -320,17 +320,17 @@ EOF $this->assertNotSame($crawler, $crawler->selectLink('Foo'), '->selectLink() returns a new instance of a crawler'); $this->assertInstanceOf('Symfony\\Component\\DomCrawler\\Crawler', $crawler, '->selectLink() returns a new instance of a crawler'); - $this->assertEquals(1, count($crawler->selectLink('Fabien\'s Foo')), '->selectLink() selects links by the node values'); - $this->assertEquals(1, count($crawler->selectLink('Fabien\'s Bar')), '->selectLink() selects links by the alt attribute of a clickable image'); + $this->assertCount(1, $crawler->selectLink('Fabien\'s Foo'), '->selectLink() selects links by the node values'); + $this->assertCount(1, $crawler->selectLink('Fabien\'s Bar'), '->selectLink() selects links by the alt attribute of a clickable image'); - $this->assertEquals(2, count($crawler->selectLink('Fabien"s Foo')), '->selectLink() selects links by the node values'); - $this->assertEquals(2, count($crawler->selectLink('Fabien"s Bar')), '->selectLink() selects links by the alt attribute of a clickable image'); + $this->assertCount(2, $crawler->selectLink('Fabien"s Foo'), '->selectLink() selects links by the node values'); + $this->assertCount(2, $crawler->selectLink('Fabien"s Bar'), '->selectLink() selects links by the alt attribute of a clickable image'); - $this->assertEquals(1, count($crawler->selectLink('\' Fabien"s Foo')), '->selectLink() selects links by the node values'); - $this->assertEquals(1, count($crawler->selectLink('\' Fabien"s Bar')), '->selectLink() selects links by the alt attribute of a clickable image'); + $this->assertCount(1, $crawler->selectLink('\' Fabien"s Foo'), '->selectLink() selects links by the node values'); + $this->assertCount(1, $crawler->selectLink('\' Fabien"s Bar'), '->selectLink() selects links by the alt attribute of a clickable image'); - $this->assertEquals(4, count($crawler->selectLink('Foo')), '->selectLink() selects links by the node values'); - $this->assertEquals(4, count($crawler->selectLink('Bar')), '->selectLink() selects links by the node values'); + $this->assertCount(4, $crawler->selectLink('Foo'), '->selectLink() selects links by the node values'); + $this->assertCount(4, $crawler->selectLink('Bar'), '->selectLink() selects links by the node values'); } public function testSelectButton() @@ -371,7 +371,7 @@ EOF $crawler = $this->createTestCrawler('http://example.com/bar/')->selectLink('Foo'); $this->assertInternalType('array', $crawler->links(), '->links() returns an array'); - $this->assertEquals(4, count($crawler->links()), '->links() returns an array'); + $this->assertCount(4, $crawler->links(), '->links() returns an array'); $links = $crawler->links(); $this->assertInstanceOf('Symfony\\Component\\DomCrawler\\Link', $links[0], '->links() returns an array of Link instances'); diff --git a/tests/Symfony/Tests/Component/EventDispatcher/EventDispatcherTest.php b/tests/Symfony/Tests/Component/EventDispatcher/EventDispatcherTest.php index f776a232ce..befa9efec5 100644 --- a/tests/Symfony/Tests/Component/EventDispatcher/EventDispatcherTest.php +++ b/tests/Symfony/Tests/Component/EventDispatcher/EventDispatcherTest.php @@ -52,9 +52,9 @@ class EventDispatcherTest extends \PHPUnit_Framework_TestCase $this->dispatcher->addListener('post.foo', array($this->listener, 'postFoo')); $this->assertTrue($this->dispatcher->hasListeners(self::preFoo)); $this->assertTrue($this->dispatcher->hasListeners(self::postFoo)); - $this->assertEquals(1, count($this->dispatcher->getListeners(self::preFoo))); - $this->assertEquals(1, count($this->dispatcher->getListeners(self::postFoo))); - $this->assertEquals(2, count($this->dispatcher->getListeners())); + $this->assertCount(1, $this->dispatcher->getListeners(self::preFoo)); + $this->assertCount(1, $this->dispatcher->getListeners(self::postFoo)); + $this->assertCount(2, $this->dispatcher->getListeners()); } public function testGetListenersSortsByPriority() @@ -187,7 +187,7 @@ class EventDispatcherTest extends \PHPUnit_Framework_TestCase $listeners = $this->dispatcher->getListeners('pre.foo'); $this->assertTrue($this->dispatcher->hasListeners(self::preFoo)); - $this->assertEquals(2, count($listeners)); + $this->assertCount(2, $listeners); $this->assertInstanceOf('Symfony\Tests\Component\EventDispatcher\TestEventSubscriberWithPriorities', $listeners[0][0]); } @@ -198,7 +198,7 @@ class EventDispatcherTest extends \PHPUnit_Framework_TestCase $listeners = $this->dispatcher->getListeners('pre.foo'); $this->assertTrue($this->dispatcher->hasListeners(self::preFoo)); - $this->assertEquals(2, count($listeners)); + $this->assertCount(2, $listeners); $this->assertEquals('preFoo2', $listeners[0][1]); } @@ -227,7 +227,7 @@ class EventDispatcherTest extends \PHPUnit_Framework_TestCase $eventSubscriber = new TestEventSubscriberWithMultipleListeners(); $this->dispatcher->addSubscriber($eventSubscriber); $this->assertTrue($this->dispatcher->hasListeners(self::preFoo)); - $this->assertEquals(2, count($this->dispatcher->getListeners(self::preFoo))); + $this->assertCount(2, $this->dispatcher->getListeners(self::preFoo)); $this->dispatcher->removeSubscriber($eventSubscriber); $this->assertFalse($this->dispatcher->hasListeners(self::preFoo)); } diff --git a/tests/Symfony/Tests/Component/Form/Extension/Core/Type/CollectionTypeTest.php b/tests/Symfony/Tests/Component/Form/Extension/Core/Type/CollectionTypeTest.php index f50a9a5c91..8253ba04fd 100644 --- a/tests/Symfony/Tests/Component/Form/Extension/Core/Type/CollectionTypeTest.php +++ b/tests/Symfony/Tests/Component/Form/Extension/Core/Type/CollectionTypeTest.php @@ -21,7 +21,7 @@ class CollectionFormTest extends TypeTestCase 'type' => 'field', )); - $this->assertEquals(0, count($form)); + $this->assertCount(0, $form); } public function testSetDataAdjustsSize() @@ -36,7 +36,7 @@ class CollectionFormTest extends TypeTestCase $this->assertInstanceOf('Symfony\Component\Form\Form', $form[0]); $this->assertInstanceOf('Symfony\Component\Form\Form', $form[1]); - $this->assertEquals(2, count($form)); + $this->assertCount(2, $form); $this->assertEquals('foo@foo.com', $form[0]->getData()); $this->assertEquals('foo@bar.com', $form[1]->getData()); $this->assertEquals(20, $form[0]->getAttribute('max_length')); @@ -45,7 +45,7 @@ class CollectionFormTest extends TypeTestCase $form->setData(array('foo@baz.com')); $this->assertInstanceOf('Symfony\Component\Form\Form', $form[0]); $this->assertFalse(isset($form[1])); - $this->assertEquals(1, count($form)); + $this->assertCount(1, $form); $this->assertEquals('foo@baz.com', $form[0]->getData()); $this->assertEquals(20, $form[0]->getAttribute('max_length')); } diff --git a/tests/Symfony/Tests/Component/Form/Extension/Core/Type/FieldTypeTest.php b/tests/Symfony/Tests/Component/Form/Extension/Core/Type/FieldTypeTest.php index da66c4bc05..a308215e15 100644 --- a/tests/Symfony/Tests/Component/Form/Extension/Core/Type/FieldTypeTest.php +++ b/tests/Symfony/Tests/Component/Form/Extension/Core/Type/FieldTypeTest.php @@ -213,7 +213,7 @@ class FieldTypeTest extends TypeTestCase { $form = $this->factory->create('field', null, array('attr' => array())); - $this->assertEquals(0, count($form->getAttribute('attr'))); + $this->assertCount(0, $form->getAttribute('attr')); } /** diff --git a/tests/Symfony/Tests/Component/Form/Extension/Csrf/Type/FormTypeCsrfExtensionTest.php b/tests/Symfony/Tests/Component/Form/Extension/Csrf/Type/FormTypeCsrfExtensionTest.php index b0d6f20cb4..e2ca02eb5a 100644 --- a/tests/Symfony/Tests/Component/Form/Extension/Csrf/Type/FormTypeCsrfExtensionTest.php +++ b/tests/Symfony/Tests/Component/Form/Extension/Csrf/Type/FormTypeCsrfExtensionTest.php @@ -28,7 +28,7 @@ class FormTypeCsrfExtensionTest extends TypeTestCase 'csrf_protection' => false, )); - $this->assertEquals(0, count($form)); + $this->assertCount(0, $form); } public function testCsrfTokenIsOnlyIncludedInRootView() diff --git a/tests/Symfony/Tests/Component/Form/FormTest.php b/tests/Symfony/Tests/Component/Form/FormTest.php index 6ebcc7594f..8368b4a04c 100644 --- a/tests/Symfony/Tests/Component/Form/FormTest.php +++ b/tests/Symfony/Tests/Component/Form/FormTest.php @@ -425,7 +425,7 @@ class FormTest extends \PHPUnit_Framework_TestCase $this->form->add($this->getBuilder('foo')->getForm()); $this->form->add($this->getBuilder('bar')->getForm()); - $this->assertEquals(2, count($this->form)); + $this->assertCount(2, $this->form); } public function testIterator() diff --git a/tests/Symfony/Tests/Component/HttpFoundation/ResponseHeaderBagTest.php b/tests/Symfony/Tests/Component/HttpFoundation/ResponseHeaderBagTest.php index df83634b7a..f9950afff1 100644 --- a/tests/Symfony/Tests/Component/HttpFoundation/ResponseHeaderBagTest.php +++ b/tests/Symfony/Tests/Component/HttpFoundation/ResponseHeaderBagTest.php @@ -84,7 +84,7 @@ class ResponseHeaderBagTest extends \PHPUnit_Framework_TestCase $bag->setCookie(new Cookie('foo', 'bar', 0, '/path/bar', 'bar.foo')); $bag->setCookie(new Cookie('foo', 'bar')); - $this->assertEquals(4, count($bag->getCookies())); + $this->assertCount(4, $bag->getCookies()); $headers = explode("\r\n", $bag->__toString()); $this->assertContains("Set-Cookie: foo=bar; path=/path/foo; domain=foo.bar; httponly", $headers); diff --git a/tests/Symfony/Tests/Component/HttpKernel/ClientTest.php b/tests/Symfony/Tests/Component/HttpKernel/ClientTest.php index 38b5425b67..23bc7e6ab3 100644 --- a/tests/Symfony/Tests/Component/HttpKernel/ClientTest.php +++ b/tests/Symfony/Tests/Component/HttpKernel/ClientTest.php @@ -103,7 +103,7 @@ class ClientTest extends \PHPUnit_Framework_TestCase $files = $client->getRequest()->files->all(); - $this->assertEquals(1, count($files)); + $this->assertCount(1, $files); $file = $files['foo']; @@ -142,7 +142,7 @@ class ClientTest extends \PHPUnit_Framework_TestCase $files = $client->getRequest()->files->all(); - $this->assertEquals(1, count($files)); + $this->assertCount(1, $files); $file = $files[0]; diff --git a/tests/Symfony/Tests/Component/HttpKernel/Debug/StopwatchEventTest.php b/tests/Symfony/Tests/Component/HttpKernel/Debug/StopwatchEventTest.php index 73c49bb8e4..82da5dad92 100644 --- a/tests/Symfony/Tests/Component/HttpKernel/Debug/StopwatchEventTest.php +++ b/tests/Symfony/Tests/Component/HttpKernel/Debug/StopwatchEventTest.php @@ -43,14 +43,14 @@ class StopwatchEventTest extends \PHPUnit_Framework_TestCase $event = new StopwatchEvent(microtime(true) * 1000); $event->start(); $event->stop(); - $this->assertEquals(1, count($event->getPeriods())); + $this->assertCount(1, $event->getPeriods()); $event = new StopwatchEvent(microtime(true) * 1000); $event->start(); $event->stop(); $event->start(); $event->stop(); - $this->assertEquals(2, count($event->getPeriods())); + $this->assertCount(2, $event->getPeriods()); } public function testLap() @@ -59,7 +59,7 @@ class StopwatchEventTest extends \PHPUnit_Framework_TestCase $event->start(); $event->lap(); $event->stop(); - $this->assertEquals(2, count($event->getPeriods())); + $this->assertCount(2, $event->getPeriods()); } public function testTotalTime() diff --git a/tests/Symfony/Tests/Component/HttpKernel/Debug/StopwatchTest.php b/tests/Symfony/Tests/Component/HttpKernel/Debug/StopwatchTest.php index 486af75714..5675363eee 100644 --- a/tests/Symfony/Tests/Component/HttpKernel/Debug/StopwatchTest.php +++ b/tests/Symfony/Tests/Component/HttpKernel/Debug/StopwatchTest.php @@ -87,8 +87,8 @@ class StopwatchTest extends \PHPUnit_Framework_TestCase // the section is an event by itself - $this->assertEquals(3, count($stopwatch->getSectionEvents('1'))); - $this->assertEquals(2, count($stopwatch->getSectionEvents('2'))); - $this->assertEquals(2, count($stopwatch->getSectionEvents('0'))); + $this->assertCount(3, $stopwatch->getSectionEvents('1')); + $this->assertCount(2, $stopwatch->getSectionEvents('2')); + $this->assertCount(2, $stopwatch->getSectionEvents('0')); } } diff --git a/tests/Symfony/Tests/Component/HttpKernel/EventListener/ExceptionListenerTest.php b/tests/Symfony/Tests/Component/HttpKernel/EventListener/ExceptionListenerTest.php index 7945867c4b..63617d9da0 100644 --- a/tests/Symfony/Tests/Component/HttpKernel/EventListener/ExceptionListenerTest.php +++ b/tests/Symfony/Tests/Component/HttpKernel/EventListener/ExceptionListenerTest.php @@ -82,7 +82,7 @@ class ExceptionListenerTest extends \PHPUnit_Framework_TestCase } $this->assertEquals(3, $logger->countErrors()); - $this->assertEquals(3, count($logger->getLogs('crit'))); + $this->assertCount(3, $logger->getLogs('crit')); } public function provider() diff --git a/tests/Symfony/Tests/Component/HttpKernel/HttpCache/HttpCacheTest.php b/tests/Symfony/Tests/Component/HttpKernel/HttpCache/HttpCacheTest.php index 01246664ab..b2d1c50715 100644 --- a/tests/Symfony/Tests/Component/HttpKernel/HttpCache/HttpCacheTest.php +++ b/tests/Symfony/Tests/Component/HttpKernel/HttpCache/HttpCacheTest.php @@ -440,7 +440,7 @@ class HttpCacheTest extends HttpCacheTestCase $this->assertTraceContains('store'); $values = $this->getMetaStorageValues(); - $this->assertEquals(1, count($values)); + $this->assertCount(1, $values); } public function testCachesResponsesWithAMaxAgeDirective() @@ -456,7 +456,7 @@ class HttpCacheTest extends HttpCacheTestCase $this->assertTraceContains('store'); $values = $this->getMetaStorageValues(); - $this->assertEquals(1, count($values)); + $this->assertCount(1, $values); } public function testCachesResponsesWithASMaxAgeDirective() @@ -472,7 +472,7 @@ class HttpCacheTest extends HttpCacheTestCase $this->assertTraceContains('store'); $values = $this->getMetaStorageValues(); - $this->assertEquals(1, count($values)); + $this->assertCount(1, $values); } public function testCachesResponsesWithALastModifiedValidatorButNoFreshnessInformation() @@ -624,7 +624,7 @@ class HttpCacheTest extends HttpCacheTestCase # go in and play around with the cached metadata directly ... $values = $this->getMetaStorageValues(); - $this->assertEquals(1, count($values)); + $this->assertCount(1, $values); $tmp = unserialize($values[0]); $time = \DateTime::createFromFormat('U', time()); $tmp[0][1]['expires'] = $time->format(DATE_RFC2822); diff --git a/tests/Symfony/Tests/Component/HttpKernel/HttpCache/StoreTest.php b/tests/Symfony/Tests/Component/HttpKernel/HttpCache/StoreTest.php index 4e266af04a..20bd744c2f 100644 --- a/tests/Symfony/Tests/Component/HttpKernel/HttpCache/StoreTest.php +++ b/tests/Symfony/Tests/Component/HttpKernel/HttpCache/StoreTest.php @@ -169,7 +169,7 @@ class StoreTest extends \PHPUnit_Framework_TestCase $this->assertEquals($this->getStorePath('en'.sha1('test 2')), $this->store->lookup($req2)->getContent()); $this->assertEquals($this->getStorePath('en'.sha1('test 1')), $this->store->lookup($req1)->getContent()); - $this->assertEquals(3, count($this->getStoreMetadata($key))); + $this->assertCount(3, $this->getStoreMetadata($key)); } public function testOverwritesNonVaryingResponseWithStore() @@ -189,7 +189,7 @@ class StoreTest extends \PHPUnit_Framework_TestCase $key = $this->store->write($req3, $res3); $this->assertEquals($this->getStorePath('en'.sha1('test 3')), $this->store->lookup($req3)->getContent()); - $this->assertEquals(2, count($this->getStoreMetadata($key))); + $this->assertCount(2, $this->getStoreMetadata($key)); } protected function storeSimpleEntry($path = null, $headers = array()) diff --git a/tests/Symfony/Tests/Component/Security/Acl/Dbal/AclProviderTest.php b/tests/Symfony/Tests/Component/Security/Acl/Dbal/AclProviderTest.php index ab62bb4ca2..31c253dafa 100644 --- a/tests/Symfony/Tests/Component/Security/Acl/Dbal/AclProviderTest.php +++ b/tests/Symfony/Tests/Component/Security/Acl/Dbal/AclProviderTest.php @@ -65,7 +65,7 @@ class AclProviderTest extends \PHPUnit_Framework_TestCase $acls = $provider->findAcls($oids); $this->assertInstanceOf('SplObjectStorage', $acls); - $this->assertEquals(2, count($acls)); + $this->assertCount(2, $acls); $this->assertInstanceOf('Symfony\Component\Security\Acl\Domain\Acl', $acl0 = $acls->offsetGet($oids[0])); $this->assertInstanceOf('Symfony\Component\Security\Acl\Domain\Acl', $acl1 = $acls->offsetGet($oids[1])); $this->assertTrue($oids[0]->equals($acl0->getObjectIdentity())); @@ -96,10 +96,10 @@ class AclProviderTest extends \PHPUnit_Framework_TestCase $this->assertInstanceOf('Symfony\Component\Security\Acl\Domain\Acl', $acl); $this->assertTrue($oid->equals($acl->getObjectIdentity())); $this->assertEquals(4, $acl->getId()); - $this->assertEquals(0, count($acl->getClassAces())); - $this->assertEquals(0, count($this->getField($acl, 'classFieldAces'))); - $this->assertEquals(3, count($acl->getObjectAces())); - $this->assertEquals(0, count($this->getField($acl, 'objectFieldAces'))); + $this->assertCount(0, $acl->getClassAces()); + $this->assertCount(0, $this->getField($acl, 'classFieldAces')); + $this->assertCount(3, $acl->getObjectAces()); + $this->assertCount(0, $this->getField($acl, 'objectFieldAces')); $aces = $acl->getObjectAces(); $this->assertInstanceOf('Symfony\Component\Security\Acl\Domain\Entry', $aces[0]); diff --git a/tests/Symfony/Tests/Component/Security/Acl/Dbal/MutableAclProviderTest.php b/tests/Symfony/Tests/Component/Security/Acl/Dbal/MutableAclProviderTest.php index e96e3fabb3..abececed53 100644 --- a/tests/Symfony/Tests/Component/Security/Acl/Dbal/MutableAclProviderTest.php +++ b/tests/Symfony/Tests/Component/Security/Acl/Dbal/MutableAclProviderTest.php @@ -83,7 +83,7 @@ class MutableAclProviderTest extends \PHPUnit_Framework_TestCase $provider->deleteAcl($oid); $loadedAcls = $this->getField($provider, 'loadedAcls'); - $this->assertEquals(0, count($loadedAcls['Foo'])); + $this->assertCount(0, $loadedAcls['Foo']); try { $provider->findAcl($oid); @@ -112,7 +112,7 @@ class MutableAclProviderTest extends \PHPUnit_Framework_TestCase $acl = $provider->createAcl(new ObjectIdentity(1, 'Foo')); $propertyChanges = $this->getField($provider, 'propertyChanges'); - $this->assertEquals(1, count($propertyChanges)); + $this->assertCount(1, $propertyChanges); $this->assertTrue($propertyChanges->contains($acl)); $this->assertEquals(array(), $propertyChanges->offsetGet($acl)); @@ -127,12 +127,12 @@ class MutableAclProviderTest extends \PHPUnit_Framework_TestCase $acl = $provider->findAcl(new ObjectIdentity(1, 'Foo')); $propertyChanges = $this->getField($provider, 'propertyChanges'); - $this->assertEquals(1, count($propertyChanges)); + $this->assertCount(1, $propertyChanges); $this->assertTrue($propertyChanges->contains($acl)); $this->assertEquals(array(), $propertyChanges->offsetGet($acl)); $listeners = $this->getField($acl, 'listeners'); - $this->assertEquals(1, count($listeners)); + $this->assertCount(1, $listeners); $this->assertSame($provider, $listeners[0]); } @@ -152,10 +152,10 @@ class MutableAclProviderTest extends \PHPUnit_Framework_TestCase )); $propertyChanges = $this->getField($provider, 'propertyChanges'); - $this->assertEquals(0, count($propertyChanges)); + $this->assertCount(0, $propertyChanges); $acl = $provider->findAcl(new ObjectIdentity('1', 'foo')); - $this->assertEquals(2, count($propertyChanges)); + $this->assertCount(2, $propertyChanges); $this->assertTrue($propertyChanges->contains($acl)); $this->assertTrue($propertyChanges->contains($acl->getParentAcl())); } diff --git a/tests/Symfony/Tests/Component/Security/Acl/Domain/AclTest.php b/tests/Symfony/Tests/Component/Security/Acl/Domain/AclTest.php index a53810d4fe..762ce7693d 100644 --- a/tests/Symfony/Tests/Component/Security/Acl/Domain/AclTest.php +++ b/tests/Symfony/Tests/Component/Security/Acl/Domain/AclTest.php @@ -55,15 +55,15 @@ class AclTest extends \PHPUnit_Framework_TestCase )); $acl->addPropertyChangedListener($listener); - $this->assertEquals(3, count($acl->{'get'.$type.'Aces'}())); + $this->assertCount(3, $acl->{'get'.$type.'Aces'}()); $acl->{'delete'.$type.'Ace'}(0); - $this->assertEquals(2, count($aces = $acl->{'get'.$type.'Aces'}())); + $this->assertCount(2, $aces = $acl->{'get'.$type.'Aces'}()); $this->assertEquals(2, $aces[0]->getMask()); $this->assertEquals(3, $aces[1]->getMask()); $acl->{'delete'.$type.'Ace'}(1); - $this->assertEquals(1, count($aces = $acl->{'get'.$type.'Aces'}())); + $this->assertCount(1, $aces = $acl->{'get'.$type.'Aces'}()); $this->assertEquals(2, $aces[0]->getMask()); } @@ -100,15 +100,15 @@ class AclTest extends \PHPUnit_Framework_TestCase )); $acl->addPropertyChangedListener($listener); - $this->assertEquals(3, count($acl->{'get'.$type.'Aces'}('foo'))); + $this->assertCount(3, $acl->{'get'.$type.'Aces'}('foo')); $acl->{'delete'.$type.'Ace'}(0, 'foo'); - $this->assertEquals(2, count($aces = $acl->{'get'.$type.'Aces'}('foo'))); + $this->assertCount(2, $aces = $acl->{'get'.$type.'Aces'}('foo')); $this->assertEquals(2, $aces[0]->getMask()); $this->assertEquals(3, $aces[1]->getMask()); $acl->{'delete'.$type.'Ace'}(1, 'foo'); - $this->assertEquals(1, count($aces = $acl->{'get'.$type.'Aces'}('foo'))); + $this->assertCount(1, $aces = $acl->{'get'.$type.'Aces'}('foo')); $this->assertEquals(2, $aces[0]->getMask()); } @@ -137,7 +137,7 @@ class AclTest extends \PHPUnit_Framework_TestCase $acl->$method($sid, 2); $acl->$method($sid, 3, 1, false); - $this->assertEquals(3, count($aces = $acl->{'get'.$property}())); + $this->assertCount(3, $aces = $acl->{'get'.$property}()); $this->assertEquals(2, $aces[0]->getMask()); $this->assertEquals(3, $aces[1]->getMask()); $this->assertEquals(1, $aces[2]->getMask()); @@ -180,8 +180,8 @@ class AclTest extends \PHPUnit_Framework_TestCase $acl->$method('foo', $sid, 3); $acl->$method('foo', $sid, 2); - $this->assertEquals(3, count($aces = $acl->{'get'.$property}('foo'))); - $this->assertEquals(1, count($acl->{'get'.$property}('foo2'))); + $this->assertCount(3, $aces = $acl->{'get'.$property}('foo')); + $this->assertCount(1, $acl->{'get'.$property}('foo2')); $this->assertEquals(2, $aces[0]->getMask()); $this->assertEquals(3, $aces[1]->getMask()); $this->assertEquals(1, $aces[2]->getMask()); diff --git a/tests/Symfony/Tests/Component/Security/Http/Logout/CookieClearingLogoutHandlerTest.php b/tests/Symfony/Tests/Component/Security/Http/Logout/CookieClearingLogoutHandlerTest.php index 4a55f7949b..587ce8923e 100644 --- a/tests/Symfony/Tests/Component/Security/Http/Logout/CookieClearingLogoutHandlerTest.php +++ b/tests/Symfony/Tests/Component/Security/Http/Logout/CookieClearingLogoutHandlerTest.php @@ -27,12 +27,12 @@ class CookieClearingLogoutHandlerTest extends \PHPUnit_Framework_TestCase $handler = new CookieClearingLogoutHandler(array('foo' => array('path' => '/foo', 'domain' => 'foo.foo'), 'foo2' => array('path' => null, 'domain' => null))); $cookies = $response->headers->getCookies(); - $this->assertEquals(0, count($cookies)); + $this->assertCount(0, $cookies); $handler->logout($request, $response, $token); $cookies = $response->headers->getCookies(ResponseHeaderBag::COOKIES_ARRAY); - $this->assertEquals(2, count($cookies)); + $this->assertCount(2, $cookies); $cookie = $cookies['foo.foo']['/foo']['foo']; $this->assertEquals('foo', $cookie->getName()); diff --git a/tests/Symfony/Tests/Component/Security/Http/RememberMe/PersistentTokenBasedRememberMeServicesTest.php b/tests/Symfony/Tests/Component/Security/Http/RememberMe/PersistentTokenBasedRememberMeServicesTest.php index ae22898437..a2ffdb8451 100644 --- a/tests/Symfony/Tests/Component/Security/Http/RememberMe/PersistentTokenBasedRememberMeServicesTest.php +++ b/tests/Symfony/Tests/Component/Security/Http/RememberMe/PersistentTokenBasedRememberMeServicesTest.php @@ -282,7 +282,7 @@ class PersistentTokenBasedRememberMeServicesTest extends \PHPUnit_Framework_Test $service->setTokenProvider($tokenProvider); $cookies = $response->headers->getCookies(); - $this->assertEquals(0, count($cookies)); + $this->assertCount(0, $cookies); $service->loginSuccess($request, $response, $token); diff --git a/tests/Symfony/Tests/Component/Security/Http/RememberMe/TokenBasedRememberMeServicesTest.php b/tests/Symfony/Tests/Component/Security/Http/RememberMe/TokenBasedRememberMeServicesTest.php index cdc5364c0d..de3cd1dd53 100644 --- a/tests/Symfony/Tests/Component/Security/Http/RememberMe/TokenBasedRememberMeServicesTest.php +++ b/tests/Symfony/Tests/Component/Security/Http/RememberMe/TokenBasedRememberMeServicesTest.php @@ -183,12 +183,12 @@ class TokenBasedRememberMeServicesTest extends \PHPUnit_Framework_TestCase ; $cookies = $response->headers->getCookies(); - $this->assertEquals(0, count($cookies)); + $this->assertCount(0, $cookies); $service->loginSuccess($request, $response, $token); $cookies = $response->headers->getCookies(); - $this->assertEquals(0, count($cookies)); + $this->assertCount(0, $cookies); } public function testLoginSuccess() @@ -216,7 +216,7 @@ class TokenBasedRememberMeServicesTest extends \PHPUnit_Framework_TestCase ; $cookies = $response->headers->getCookies(); - $this->assertEquals(0, count($cookies)); + $this->assertCount(0, $cookies); $service->loginSuccess($request, $response, $token); diff --git a/tests/Symfony/Tests/Component/Validator/ExecutionContextTest.php b/tests/Symfony/Tests/Component/Validator/ExecutionContextTest.php index 87db0fac47..1b47bdf268 100644 --- a/tests/Symfony/Tests/Component/Validator/ExecutionContextTest.php +++ b/tests/Symfony/Tests/Component/Validator/ExecutionContextTest.php @@ -42,10 +42,10 @@ class ExecutionContextTest extends \PHPUnit_Framework_TestCase public function testAddViolation() { - $this->assertEquals(0, count($this->context->getViolations())); + $this->assertCount(0, $this->context->getViolations()); $this->context->addViolation('', array(), ''); - $this->assertEquals(1, count($this->context->getViolations())); + $this->assertCount(1, $this->context->getViolations()); } public function testGetViolations() @@ -54,7 +54,7 @@ class ExecutionContextTest extends \PHPUnit_Framework_TestCase $violations = $this->context->getViolations(); - $this->assertEquals(1, count($violations)); + $this->assertCount(1, $violations); $this->assertInstanceOf('Symfony\Component\Validator\ConstraintViolationList', $violations); $this->assertInstanceOf('ArrayIterator', $violations->getIterator()); diff --git a/tests/Symfony/Tests/Component/Validator/GraphWalkerTest.php b/tests/Symfony/Tests/Component/Validator/GraphWalkerTest.php index 790d09e8f1..46354c8b32 100644 --- a/tests/Symfony/Tests/Component/Validator/GraphWalkerTest.php +++ b/tests/Symfony/Tests/Component/Validator/GraphWalkerTest.php @@ -69,7 +69,7 @@ class GraphWalkerTest extends \PHPUnit_Framework_TestCase $this->walker->walkObject($this->metadata, new Entity(), 'Default', ''); - $this->assertEquals(1, count($this->walker->getViolations())); + $this->assertCount(1, $this->walker->getViolations()); } public function testWalkObjectTwiceValidatesConstraintsOnce() @@ -81,7 +81,7 @@ class GraphWalkerTest extends \PHPUnit_Framework_TestCase $this->walker->walkObject($this->metadata, $entity, 'Default', ''); $this->walker->walkObject($this->metadata, $entity, 'Default', ''); - $this->assertEquals(1, count($this->walker->getViolations())); + $this->assertCount(1, $this->walker->getViolations()); } public function testWalkDifferentObjectsValidatesTwice() @@ -91,7 +91,7 @@ class GraphWalkerTest extends \PHPUnit_Framework_TestCase $this->walker->walkObject($this->metadata, new Entity(), 'Default', ''); $this->walker->walkObject($this->metadata, new Entity(), 'Default', ''); - $this->assertEquals(2, count($this->walker->getViolations())); + $this->assertCount(2, $this->walker->getViolations()); } public function testWalkObjectTwiceInDifferentGroupsValidatesTwice() @@ -104,7 +104,7 @@ class GraphWalkerTest extends \PHPUnit_Framework_TestCase $this->walker->walkObject($this->metadata, $entity, 'Default', ''); $this->walker->walkObject($this->metadata, $entity, 'Custom', ''); - $this->assertEquals(2, count($this->walker->getViolations())); + $this->assertCount(2, $this->walker->getViolations()); } public function testWalkObjectValidatesPropertyConstraints() @@ -113,7 +113,7 @@ class GraphWalkerTest extends \PHPUnit_Framework_TestCase $this->walker->walkObject($this->metadata, new Entity(), 'Default', ''); - $this->assertEquals(1, count($this->walker->getViolations())); + $this->assertCount(1, $this->walker->getViolations()); } public function testWalkObjectValidatesGetterConstraints() @@ -122,7 +122,7 @@ class GraphWalkerTest extends \PHPUnit_Framework_TestCase $this->walker->walkObject($this->metadata, new Entity(), 'Default', ''); - $this->assertEquals(1, count($this->walker->getViolations())); + $this->assertCount(1, $this->walker->getViolations()); } public function testWalkObjectInDefaultGroupTraversesGroupSequence() @@ -228,7 +228,7 @@ class GraphWalkerTest extends \PHPUnit_Framework_TestCase $this->walker->walkPropertyValue($this->metadata, 'firstName', 'value', 'Default', ''); - $this->assertEquals(1, count($this->walker->getViolations())); + $this->assertCount(1, $this->walker->getViolations()); } public function testWalkCascadedPropertyValidatesReferences() @@ -387,7 +387,7 @@ class GraphWalkerTest extends \PHPUnit_Framework_TestCase '' ); - $this->assertEquals(0, count($this->walker->getViolations())); + $this->assertCount(0, $this->walker->getViolations()); } public function testWalkCascadedPropertyRequiresObjectOrArray() @@ -429,7 +429,7 @@ class GraphWalkerTest extends \PHPUnit_Framework_TestCase $this->walker->walkConstraint($constraint, 'VALID', 'Default', 'firstName.path'); - $this->assertEquals(0, count($this->walker->getViolations())); + $this->assertCount(0, $this->walker->getViolations()); } public function testWalkObjectUsesCorrectPropertyPathInViolationsWhenUsingCollections() diff --git a/tests/Symfony/Tests/Component/Validator/Mapping/ClassMetadataTest.php b/tests/Symfony/Tests/Component/Validator/Mapping/ClassMetadataTest.php index 31f7e2ec08..5ec7abff8b 100644 --- a/tests/Symfony/Tests/Component/Validator/Mapping/ClassMetadataTest.php +++ b/tests/Symfony/Tests/Component/Validator/Mapping/ClassMetadataTest.php @@ -108,7 +108,7 @@ class ClassMetadataTest extends \PHPUnit_Framework_TestCase $members = $this->metadata->getMemberMetadatas('firstName'); - $this->assertEquals(1, count($members)); + $this->assertCount(1, $members); $this->assertEquals(self::PARENTCLASS, $members[0]->getClassName()); $this->assertEquals($constraints, $members[0]->getConstraints()); } @@ -145,7 +145,7 @@ class ClassMetadataTest extends \PHPUnit_Framework_TestCase $members = $this->metadata->getMemberMetadatas('internal'); - $this->assertEquals(2, count($members)); + $this->assertCount(2, $members); $this->assertEquals(self::PARENTCLASS, $members[0]->getClassName()); $this->assertEquals($parentConstraints, $members[0]->getConstraints()); $this->assertEquals(self::CLASSNAME, $members[1]->getClassName()); diff --git a/tests/Symfony/Tests/Component/Validator/ValidatorTest.php b/tests/Symfony/Tests/Component/Validator/ValidatorTest.php index 78b0386bfa..86c8ee98a6 100644 --- a/tests/Symfony/Tests/Component/Validator/ValidatorTest.php +++ b/tests/Symfony/Tests/Component/Validator/ValidatorTest.php @@ -131,7 +131,7 @@ class ValidatorTest extends \PHPUnit_Framework_TestCase $result = $this->validator->validateProperty($entity, 'firstName'); - $this->assertEquals(1, count($result)); + $this->assertCount(1, $result); } public function testValidatePropertyValue() @@ -143,14 +143,14 @@ class ValidatorTest extends \PHPUnit_Framework_TestCase $result = $this->validator->validatePropertyValue(get_class($entity), 'firstName', 'Bernhard'); - $this->assertEquals(1, count($result)); + $this->assertCount(1, $result); } public function testValidateValue() { $result = $this->validator->validateValue('Bernhard', new FailingConstraint()); - $this->assertEquals(1, count($result)); + $this->assertCount(1, $result); } public function testGetMetadataFactory()