Skip to content
This repository was archived by the owner on Jan 30, 2020. It is now read-only.

Commit 46ba18a

Browse files
committed
Use better assertion in tests
1 parent 8faaf2a commit 46ba18a

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

test/AutoloaderFactoryTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function testRegisteringValidMapFilePopulatesAutoloader()
6060
$loader = AutoloaderFactory::getRegisteredAutoloader('Zend\Loader\ClassMapAutoloader');
6161
$map = $loader->getAutoloadMap();
6262
$this->assertInternalType('array', $map);
63-
$this->assertEquals(2, count($map));
63+
$this->assertCount(2, $map);
6464
}
6565

6666
/**
@@ -85,15 +85,15 @@ public function testFactoryDoesNotRegisterDuplicateAutoloaders()
8585
],
8686
],
8787
]);
88-
$this->assertEquals(1, count(AutoloaderFactory::getRegisteredAutoloaders()));
88+
$this->assertCount(1, AutoloaderFactory::getRegisteredAutoloaders());
8989
AutoloaderFactory::factory([
9090
'Zend\Loader\StandardAutoloader' => [
9191
'namespaces' => [
9292
'ZendTest\Loader\TestAsset\TestPlugins' => __DIR__ . '/TestAsset/TestPlugins',
9393
],
9494
],
9595
]);
96-
$this->assertEquals(1, count(AutoloaderFactory::getRegisteredAutoloaders()));
96+
$this->assertCount(1, AutoloaderFactory::getRegisteredAutoloaders());
9797
$this->assertTrue(class_exists('TestNamespace\NoDuplicateAutoloadersCase'));
9898
$this->assertTrue(class_exists('ZendTest\Loader\TestAsset\TestPlugins\Foo'));
9999
}
@@ -108,7 +108,7 @@ public function testCanUnregisterAutoloaders()
108108
],
109109
]);
110110
AutoloaderFactory::unregisterAutoloaders();
111-
$this->assertEquals(0, count(AutoloaderFactory::getRegisteredAutoloaders()));
111+
$this->assertCount(0, AutoloaderFactory::getRegisteredAutoloaders());
112112
}
113113

114114
public function testCanUnregisterAutoloadersByClassName()
@@ -121,7 +121,7 @@ public function testCanUnregisterAutoloadersByClassName()
121121
],
122122
]);
123123
AutoloaderFactory::unregisterAutoloader('Zend\Loader\StandardAutoloader');
124-
$this->assertEquals(0, count(AutoloaderFactory::getRegisteredAutoloaders()));
124+
$this->assertCount(0, AutoloaderFactory::getRegisteredAutoloaders());
125125
}
126126

127127
public function testCanGetValidRegisteredAutoloader()
@@ -142,7 +142,7 @@ public function testDefaultAutoloader()
142142
AutoloaderFactory::factory();
143143
$autoloader = AutoloaderFactory::getRegisteredAutoloader('Zend\Loader\StandardAutoloader');
144144
$this->assertInstanceOf('Zend\Loader\StandardAutoloader', $autoloader);
145-
$this->assertEquals(1, count(AutoloaderFactory::getRegisteredAutoloaders()));
145+
$this->assertCount(1, AutoloaderFactory::getRegisteredAutoloaders());
146146
}
147147

148148
public function testGetInvalidAutoloaderThrowsException()
@@ -174,7 +174,7 @@ public function testPassingNoArgumentsToFactoryInstantiatesAndRegistersStandardA
174174
{
175175
AutoloaderFactory::factory();
176176
$loaders = AutoloaderFactory::getRegisteredAutoloaders();
177-
$this->assertEquals(1, count($loaders));
177+
$this->assertCount(1, $loaders);
178178
$loader = array_shift($loaders);
179179
$this->assertInstanceOf('Zend\Loader\StandardAutoloader', $loader);
180180

test/ClassMapAutoloaderTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,13 @@ public function testRegisteringValidMapFilePopulatesAutoloader()
9292
$this->loader->registerAutoloadMap(__DIR__ . '/_files/goodmap.php');
9393
$map = $this->loader->getAutoloadMap();
9494
$this->assertInternalType('array', $map);
95-
$this->assertEquals(2, count($map));
95+
$this->assertCount(2, $map);
9696
// Just to make sure nothing changes after loading the same map again
9797
// (loadMapFromFile should just return)
9898
$this->loader->registerAutoloadMap(__DIR__ . '/_files/goodmap.php');
9999
$map = $this->loader->getAutoloadMap();
100100
$this->assertInternalType('array', $map);
101-
$this->assertEquals(2, count($map));
101+
$this->assertCount(2, $map);
102102
}
103103

104104
public function testRegisteringMultipleMapsMergesThem()
@@ -114,7 +114,7 @@ public function testRegisteringMultipleMapsMergesThem()
114114

115115
$test = $this->loader->getAutoloadMap();
116116
$this->assertInternalType('array', $test);
117-
$this->assertEquals(3, count($test));
117+
$this->assertCount(3, $test);
118118
$this->assertNotEquals(
119119
$map['ZendTest\Loader\StandardAutoloaderTest'],
120120
$test['ZendTest\Loader\StandardAutoloaderTest']
@@ -133,7 +133,7 @@ public function testCanRegisterMultipleMapsAtOnce()
133133
$this->loader->registerAutoloadMaps($maps);
134134
$test = $this->loader->getAutoloadMap();
135135
$this->assertInternalType('array', $test);
136-
$this->assertEquals(3, count($test));
136+
$this->assertCount(3, $test);
137137
}
138138

139139
public function testRegisterMapsThrowsExceptionForNonTraversableArguments()
@@ -191,6 +191,6 @@ public function testCanLoadClassMapFromPhar()
191191
// @codingStandardsIgnoreEnd
192192
$this->loader->registerAutoloadMap($map);
193193
$test = $this->loader->getAutoloadMap();
194-
$this->assertEquals(1, count($test));
194+
$this->assertCount(1, $test);
195195
}
196196
}

0 commit comments

Comments
 (0)