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

Mock unit tests #48

Merged
merged 3 commits into from
Feb 18, 2023
Merged

Mock unit tests #48

merged 3 commits into from
Feb 18, 2023

Conversation

ShawnCZek
Copy link
Member

This pull request is a little bit more complicated due to the necessary underlying changes. For example, one of the major changes, which is backward compatible but breaks tests, is creating a base class for entity models. This is a common approach in API libraries and helps to share the basic client around. This makes additional requests much easier.

I include the whole change list below to make reviewing this pull request as easy as possible.

Closes #30.


Deprecations

  • Deprecated getConfirmed() and getUnsure() methods of the EventAttendance model in favor of the existing collections
  • Deprecated Player::getCompanyRole() due to another unexpected internal request
  • Deprecated Player::patreon() in favor of the new Player::getPatreon() getter

Features

  • Created a base class for entity models
  • Added types to model attributes
  • Mocked API responses and models in unit tests

Fixes

  • Fixed the start_at type in Event
  • Fixed parameter types for the company key in requests
  • Fixed the ProMods name in Server

Changes

  • Moved the HTTP client to the API client. This helps to mock or override the client/Config
  • Moved the API configuration to the API client

* Add types to model attributes (supporting PHP 7.4)
* Move the HTTP client to the API client
* Move the API configuration to the API client
* Rename the Patreon get method in the Player model
* Deprecate the company role get method in the Player model
* Fix the start_at type in the Event model
* Fix parameter types for the company key in requests
* Fix the ProMods name in the Server model
@ShawnCZek ShawnCZek merged commit a98758d into master Feb 18, 2023
@ShawnCZek ShawnCZek deleted the tests-mocking branch February 18, 2023 09:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mock API responses during tests
2 participants