Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add methods Log::requests() and Log::clear() to ease assertions on Log client #25

Merged
merged 5 commits into from
Jul 16, 2021

Conversation

spawnia
Copy link
Owner

@spawnia spawnia commented Jul 16, 2021

  • Added automated tests
  • Documented for all relevant versions
  • Updated the changelog

Changes

The Log client offers a convenient method of reading the requests as structured data:

$log = new \Spawnia\Sailor\Client\Log(__DIR__ . '/sailor-requests.log');
foreach($log->requests() as $request) {
    var_dump($request);
}

array(2) {
  ["query"]=>
  string(7) "{ foo }"
  ["variables"]=>
  array(1) {
    ["bar"]=>
    int(42)
  }
}
array(2) {
  ["query"]=>
  string(7) "mutation { baz }"
  ["variables"]=>
  NULL
}

To clean up the log after performing tests, use Log::clear().

Breaking changes

None.

@spawnia spawnia changed the title Add method Log::requests() to ease assertions on Log client Add methods Log::requests() and Log::clear() to ease assertions on Log client Jul 16, 2021
@spawnia spawnia merged commit aa1f3a1 into master Jul 16, 2021
@spawnia spawnia deleted the log-client-decode branch July 16, 2021 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant