Skip to content

Commit

Permalink
Test server support additional asserts #8244
Browse files Browse the repository at this point in the history
This allow to assert more than the API response. Typically
useful to assert that a mutation did indeed update the DB
as expected, even when the API response does not reflect that.
  • Loading branch information
PowerKiKi committed Jun 18, 2021
1 parent abdc417 commit 059b686
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Testing/Api/AbstractServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function testSchemaIsValid(): void
/**
* @dataProvider providerQuery
*/
public function testQuery(?string $user, ServerRequest $request, array $expected, ?callable $dataPreparator = null): void
public function testQuery(?string $user, ServerRequest $request, array $expected, ?callable $dataPreparator = null, ?callable $additionalAsserts = null): void
{
$this->setCurrentUser($user);

Expand All @@ -67,6 +67,10 @@ public function testQuery(?string $user, ServerRequest $request, array $expected
}

self::assertEquals($expected, $actual);

if ($additionalAsserts) {
$additionalAsserts(_em()->getConnection());
}
}

public function providerQuery(): array
Expand Down

0 comments on commit 059b686

Please sign in to comment.