Skip to content

Commit

Permalink
Merge pull request #160 from laravel/fix-see-json
Browse files Browse the repository at this point in the history
Fix seeJson with null data
  • Loading branch information
taylorotwell authored Nov 29, 2021
2 parents 2dfb9c0 + 721e1e8 commit b8abb69
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/Concerns/MakesHttpRequests.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
use Illuminate\Http\Request;
use Illuminate\Http\UploadedFile;
use Illuminate\Support\Str;
use Illuminate\Testing\Assert as PHPUnit;
use Laravel\BrowserKitTesting\TestResponse;
use PHPUnit\Framework\ExpectationFailedException;
use Symfony\Component\HttpFoundation\File\UploadedFile as SymfonyUploadedFile;
Expand Down Expand Up @@ -420,11 +419,12 @@ public function seeJson(array $data = null, $negate = false)
if (is_null($data)) {
$decodedResponse = json_decode($this->response->getContent(), true);

if (is_null($decodedResponse) || $decodedResponse === false) {
PHPUnit::fail(
"JSON was not returned from [{$this->currentUri}]."
);
}
$this->assertTrue(
! is_null($decodedResponse) && $decodedResponse !== false,
"JSON was not returned from [{$this->currentUri}]."
);

return $this;
}

try {
Expand Down

0 comments on commit b8abb69

Please sign in to comment.