[CS] Fix usage of assertCount

Bug fix: no
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: -
Todo: -
This commit is contained in:
Dariusz Górecki 2012-01-18 14:42:47 +01:00
parent f842739d58
commit 3cfaade8f7
31 changed files with 95 additions and 95 deletions

View File

@ -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'));
}
}

View File

@ -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
}
}

View File

@ -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]);
}

View File

@ -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');
}

View File

@ -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()

View File

@ -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)

View File

@ -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()

View File

@ -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');
}
/**

View File

@ -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');

View File

@ -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));
}

View File

@ -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'));
}

View File

@ -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'));
}
/**

View File

@ -28,7 +28,7 @@ class FormTypeCsrfExtensionTest extends TypeTestCase
'csrf_protection' => false,
));
$this->assertEquals(0, count($form));
$this->assertCount(0, $form);
}
public function testCsrfTokenIsOnlyIncludedInRootView()

View File

@ -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()

View File

@ -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);

View File

@ -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];

View File

@ -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()

View File

@ -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'));
}
}

View File

@ -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()

View File

@ -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);

View File

@ -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())

View File

@ -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]);

View File

@ -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()));
}

View File

@ -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());

View File

@ -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());

View File

@ -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);

View File

@ -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);

View File

@ -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());

View File

@ -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()

View File

@ -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());

View File

@ -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()