-
Notifications
You must be signed in to change notification settings - Fork 61
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
Unit/Integration tests #342
Merged
chillu
merged 15 commits into
silverstripe:master
from
unclecheese:pulls/master/so-testy
Jan 22, 2021
Merged
Unit/Integration tests #342
chillu
merged 15 commits into
silverstripe:master
from
unclecheese:pulls/master/so-testy
Jan 22, 2021
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
unclecheese
force-pushed
the
pulls/master/so-testy
branch
from
December 16, 2020 03:34
0f2d426
to
4bb9751
Compare
chillu
force-pushed
the
pulls/master/so-testy
branch
from
December 18, 2020 02:29
b680f6d
to
4c2139a
Compare
chillu
reviewed
Dec 18, 2020
unclecheese
force-pushed
the
pulls/master/so-testy
branch
from
January 17, 2021 22:51
4c2139a
to
3f5c5d6
Compare
The schema is used for two purposes: 1. Building: It converts config arrays (retrieved from YAML) to instance state, which is required to call `save()` and persist the schema for later use. 2. Fetching: It loads retrieves an existing persisted schema. This does not require any instance state. `bootConfig()` was called in the constructor, and implied that it prepares the instance for operation. In fact, it only merges enough (global and local) config to set up a SchemaContext object. It does not validate the schema, or build out the instance state (types, models, etc).. At this point, the instance can be used for *some* operations such as retrieving the underlying GraphQL schema (via `fetch()`). This benefitted the main `Controller` use because other instance state is expensive to validate and create from config (via `applyConfig()`). In order to *actually* get a consistent schema (reflecting the YAML configuration), you also needed to call `loadFromConfig()`. This change centralises the two step process (bootConfig, loadFromConfig) into a single one with an obvious name: `boot()`. It also removes the need to store the intermediary merged config state on the instance, which is only required for diagnostic purposes and complicates state management. Since the config state getter was removed, it also required removal of getSignature() - see silverstripe#343 Context: silverstripe#335 (comment)
Allowing setters on key and context *after* booting the schema creates complex state management issues for no apparent benefit. The related unit tests were fairly self-referential, it does not appear that the setters are required for automation testing.
SchemaContextTest was reusing IntegrationTestResolver(s), which then interfered with the original use case of those resolvers, by returning __FUNCTION__ from resolve()
chillu
force-pushed
the
pulls/master/so-testy
branch
from
January 20, 2021 02:48
5ce00ef
to
b40f3df
Compare
chillu
approved these changes
Jan 20, 2021
@@ -82,13 +82,14 @@ private static function addInheritance(Schema $schema, string $class, ?ModelType | |||
// Merge with the parent model for inherited fields | |||
if ($parentModel) { | |||
$modelType->mergeWith($parentModel); | |||
//$modelType->removeField(InheritanceChain::getName()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this need to be removed?
Required to stop frameworktest breaking GraphQL v4, for which compat was introduced after the 0.2.0 release. This is likely temporary until we migrate to the shared travis config.
Changing QueryMiddleware to become a generic Middleware was well intentioned: It could be used for other purposes outside of the query context, for example if plugins started supporting middleware. But in order to achieve this, it weakened the (query specific) parameter signature into a generic $params argument, which makes it harder to understand how to write valid middleware for developers. On balance, that's a more important concern than saving a few lines of code in writing a hypothetical second middleware implementation in the module. Also re-added the existing tests from GraphQL v3
The Behat failure here is pre-existing, not related to the pull request - see https://travis-ci.com/github/silverstripe/silverstripe-asset-admin/jobs/473637116 |
Upstream is broken, and it's out of our control to fix (Chrome bug) - see silverstripe/silverstripe-asset-admin#1163
chillu
force-pushed
the
pulls/master/so-testy
branch
from
January 22, 2021 03:17
92203a6
to
7baaff2
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.