Skip to content

Commit

Permalink
Check if the trait is used in PHPUnits TestCase
Browse files Browse the repository at this point in the history
  • Loading branch information
pionl committed Sep 25, 2020
1 parent 149ea6d commit 482db43
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/AssertRequestAgainstSchema.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use ByJG\ApiTools\Exception\NotMatchedException;
use ByJG\ApiTools\Exception\PathNotFoundException;
use ByJG\ApiTools\Exception\StatusCodeNotMatchedException;
use PHPUnit\Framework\TestCase;

trait AssertRequestAgainstSchema
{
Expand Down Expand Up @@ -56,6 +57,8 @@ protected function makeRequest(
$requestBody = null,
$requestHeader = []
) {
assert($this instanceof TestCase);

$this->checkSchema();
$requester = new ApiRequester();
$body = $requester
Expand Down Expand Up @@ -91,6 +94,8 @@ protected function makeRequest(
*/
public function assertRequest(AbstractRequester $request)
{
assert($this instanceof TestCase);

// Add own schema if nothing is passed.
if (!$request->hasSchema()) {
$this->checkSchema();
Expand Down

0 comments on commit 482db43

Please sign in to comment.