Skip to content

Commit c4dd555

Browse files
committed
Merge pull request #12590 from lucasmichot/feature/5.2/assert-count
[5.2] Use assertCount
2 parents c858d54 + bd8f836 commit c4dd555

File tree

8 files changed

+15
-15
lines changed

8 files changed

+15
-15
lines changed

tests/Container/ContainerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ public function testContainerTags()
506506

507507
$container = new Container;
508508
$container->tag(['ContainerImplementationStub', 'ContainerImplementationStubTwo'], ['foo']);
509-
$this->assertEquals(2, count($container->tagged('foo')));
509+
$this->assertCount(2, $container->tagged('foo'));
510510
$this->assertInstanceOf('ContainerImplementationStub', $container->tagged('foo')[0]);
511511
$this->assertInstanceOf('ContainerImplementationStubTwo', $container->tagged('foo')[1]);
512512

tests/Cookie/Middleware/EncryptCookiesTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function testSetCookieEncryption()
4545
$response = $this->router->dispatch(Request::create($this->setCookiePath, 'GET'));
4646

4747
$cookies = $response->headers->getCookies();
48-
$this->assertEquals(2, count($cookies));
48+
$this->assertCount(2, $cookies);
4949
$this->assertEquals('encrypted_cookie', $cookies[0]->getName());
5050
$this->assertNotEquals('value', $cookies[0]->getValue());
5151
$this->assertEquals('unencrypted_cookie', $cookies[1]->getName());
@@ -62,7 +62,7 @@ public function testQueuedCookieEncryption()
6262
$response = $this->router->dispatch(Request::create($this->queueCookiePath, 'GET'));
6363

6464
$cookies = $response->headers->getCookies();
65-
$this->assertEquals(2, count($cookies));
65+
$this->assertCount(2, $cookies);
6666
$this->assertEquals('encrypted_cookie', $cookies[0]->getName());
6767
$this->assertNotEquals('value', $cookies[0]->getValue());
6868
$this->assertEquals('unencrypted_cookie', $cookies[1]->getName());

tests/Http/HttpRedirectResponseTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ public function testWithOnRedirect()
3535
public function testWithCookieOnRedirect()
3636
{
3737
$response = new RedirectResponse('foo.bar');
38-
$this->assertEquals(0, count($response->headers->getCookies()));
38+
$this->assertCount(0, $response->headers->getCookies());
3939
$this->assertEquals($response, $response->withCookie(new Symfony\Component\HttpFoundation\Cookie('foo', 'bar')));
4040
$cookies = $response->headers->getCookies();
41-
$this->assertEquals(1, count($cookies));
41+
$this->assertCount(1, $cookies);
4242
$this->assertEquals('foo', $cookies[0]->getName());
4343
$this->assertEquals('bar', $cookies[0]->getValue());
4444
}

tests/Http/HttpResponseTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@ public function testHeader()
5151
public function testWithCookie()
5252
{
5353
$response = new Illuminate\Http\Response();
54-
$this->assertEquals(0, count($response->headers->getCookies()));
54+
$this->assertCount(0, $response->headers->getCookies());
5555
$this->assertEquals($response, $response->withCookie(new Symfony\Component\HttpFoundation\Cookie('foo', 'bar')));
5656
$cookies = $response->headers->getCookies();
57-
$this->assertEquals(1, count($cookies));
57+
$this->assertCount(1, $cookies);
5858
$this->assertEquals('foo', $cookies[0]->getName());
5959
$this->assertEquals('bar', $cookies[0]->getValue());
6060
}

tests/Redis/RedisConnectionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public function testRedisClusterNotCreateClusterAndOptionsServer()
1818
$redis = $this->getRedis(true);
1919
$client = $redis->connection();
2020

21-
$this->assertEquals(1, $client->getConnection()->count());
21+
$this->assertCount(1, $client->getConnection());
2222
}
2323

2424
protected function getRedis($cluster = false)

tests/Routing/RouteCollectionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function testRouteCollectionAddRouteChangesCount()
4747
'uses' => 'FooController@index',
4848
'as' => 'foo_index',
4949
]));
50-
$this->assertSame(1, $this->routeCollection->count());
50+
$this->assertCount(1, $this->routeCollection);
5151
}
5252

5353
public function testRouteCollectionIsCountable()

tests/Support/SupportCollectionTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ public function testChunk()
535535

536536
$this->assertInstanceOf('Illuminate\Support\Collection', $data);
537537
$this->assertInstanceOf('Illuminate\Support\Collection', $data[0]);
538-
$this->assertEquals(4, $data->count());
538+
$this->assertCount(4, $data);
539539
$this->assertEquals([1, 2, 3], $data[0]->toArray());
540540
$this->assertEquals([9 => 10], $data[3]->toArray());
541541
}
@@ -1077,21 +1077,21 @@ public function testZip()
10771077
$this->assertInstanceOf('Illuminate\Support\Collection', $c[0]);
10781078
$this->assertInstanceOf('Illuminate\Support\Collection', $c[1]);
10791079
$this->assertInstanceOf('Illuminate\Support\Collection', $c[2]);
1080-
$this->assertEquals(3, $c->count());
1080+
$this->assertCount(3, $c);
10811081
$this->assertEquals([1, 4], $c[0]->all());
10821082
$this->assertEquals([2, 5], $c[1]->all());
10831083
$this->assertEquals([3, 6], $c[2]->all());
10841084

10851085
$c = new Collection([1, 2, 3]);
10861086
$c = $c->zip([4, 5, 6], [7, 8, 9]);
1087-
$this->assertEquals(3, $c->count());
1087+
$this->assertCount(3, $c);
10881088
$this->assertEquals([1, 4, 7], $c[0]->all());
10891089
$this->assertEquals([2, 5, 8], $c[1]->all());
10901090
$this->assertEquals([3, 6, 9], $c[2]->all());
10911091

10921092
$c = new Collection([1, 2, 3]);
10931093
$c = $c->zip([4, 5, 6], [7]);
1094-
$this->assertEquals(3, $c->count());
1094+
$this->assertCount(3, $c);
10951095
$this->assertEquals([1, 4, 7], $c[0]->all());
10961096
$this->assertEquals([2, 5, null], $c[1]->all());
10971097
$this->assertEquals([3, 6, null], $c[2]->all());

tests/Support/SupportMessageBagTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,13 +123,13 @@ public function testMessageBagReturnsExpectedJson()
123123
public function testCountReturnsCorrectValue()
124124
{
125125
$container = new MessageBag;
126-
$this->assertEquals(0, $container->count());
126+
$this->assertCount(0, $container);
127127

128128
$container->add('foo', 'bar');
129129
$container->add('foo', 'baz');
130130
$container->add('boom', 'baz');
131131

132-
$this->assertEquals(3, $container->count());
132+
$this->assertCount(3, $container);
133133
}
134134

135135
public function testCountable()

0 commit comments

Comments
 (0)