Skip to content

Commit c4f877e

Browse files
Merge branch '6.x' into 7.x
2 parents 7801e2a + 9f73d29 commit c4f877e

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

CHANGELOG-6.x.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
- Filtering null's in `hasMorph()` ([#32614](https://github.com/laravel/framework/pull/32614))
1313
- Fixed `Illuminate\Console\Scheduling\Schedule::compileParameters()` ([cfc3ac9](https://github.com/laravel/framework/commit/cfc3ac9c8b0a593d264ae722ab90601fa4882d0e), [36e215d](https://github.com/laravel/framework/commit/36e215dd39cd757a8ffc6b17794de60476b2289d))
1414
- Fixed bug with model name in `Illuminate\Database\Eloquent\RelationNotFoundException::make()` ([f72a166](https://github.com/laravel/framework/commit/f72a1662ab64cc543c532941b1ab1279001af8e9))
15+
- Fixed `Illuminate\Foundation\Testing\TestResponse::assertJsonCount()` not accepting falsey keys ([#32655](https://github.com/laravel/framework/pull/32655))
1516

1617
### Changed
1718
- Changed `Illuminate/Database/Eloquent/Relations/Concerns/AsPivot::fromRawAttributes()` ([6c502c1](https://github.com/laravel/framework/commit/6c502c1135082e8b25f2720931b19d36eeec8f41))

src/Illuminate/Testing/TestResponse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,7 @@ public function assertJsonStructure(array $structure = null, $responseData = nul
697697
*/
698698
public function assertJsonCount(int $count, $key = null)
699699
{
700-
if ($key) {
700+
if (! is_null($key)) {
701701
PHPUnit::assertCount(
702702
$count, data_get($this->json(), $key),
703703
"Failed to assert that the response count matched the expected {$count}"

tests/Testing/TestResponseTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,9 @@ public function testAssertJsonCount()
493493
{
494494
$response = TestResponse::fromBaseResponse(new Response(new JsonSerializableMixedResourcesStub));
495495

496+
// With falsey key
497+
$response->assertJsonCount(1, '0');
498+
496499
// With simple key
497500
$response->assertJsonCount(3, 'bars');
498501

@@ -927,6 +930,7 @@ public function jsonSerialize()
927930
'foobar_foo' => 'foo',
928931
'foobar_bar' => 'bar',
929932
],
933+
'0' => ['foo'],
930934
'bars' => [
931935
['bar' => 'foo 0', 'foo' => 'bar 0'],
932936
['bar' => 'foo 1', 'foo' => 'bar 1'],

0 commit comments

Comments
 (0)