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

Port OgComplexWidgetTest #140

Open
wants to merge 31 commits into
base: 8.x-1.x
Choose a base branch
from
Open

Conversation

pfrenssen
Copy link
Collaborator

Some bugs are popping up when adding groups to the group audience field using the complex widget. One of these that was recently fixed is #138.

Let's port the original OgComplexWidgetTest so that we can discover any remaining problems, and ensure it keeps working in the future.

@pfrenssen
Copy link
Collaborator Author

Started porting. I'm currently stuck on the audience field not being shown in the node edit form by default. I'm trying to make it visible but I'm getting schema errors when I do so:

Drupal\Core\Config\Schema\SchemaIncompleteException: Schema errors for core.entity_form_display.node.post.default with the following errors:
core.entity_form_display.node.post.default:content.og_group_ref.settings.match_operator missing schema
core.entity_form_display.node.post.default:content.og_group_ref.settings.size missing schema
core.entity_form_display.node.post.default:content.og_group_ref.settings.placeholder missing schema
in Drupal\Core\Config\Testing\ConfigSchemaChecker->onConfigSave() (line 98 of core/lib/Drupal/Core/Config/Testing/ConfigSchemaChecker.php).

@amitaibu
Copy link
Owner

I'm currently stuck on the audience field not being shown in the node edit form by default

Yes, we should take care of it in Og::createField()

Thanks for working on it :)

@pfrenssen
Copy link
Collaborator Author

OK so the test is correct, the schema is simply missing.

@pfrenssen
Copy link
Collaborator Author

@amitaibu good to know, I was wondering about this. When I continue tomorrow I will create a ticket for that and refer to it in the code.

@pfrenssen
Copy link
Collaborator Author

The test is not running, it should be added to Travis.

These changes are inspired by the excellent Travis integration of the Rules module.
@pfrenssen
Copy link
Collaborator Author

Oops I sent Travis into an endless loop :-/

@pfrenssen
Copy link
Collaborator Author

I merged in #147 since that is a bug that was discovered while working on this and I need the fix to continue here.

…ty values through. Started on a test for this field.
@pfrenssen
Copy link
Collaborator Author

I've been doing manual testing and noticed some problems with the 'Other groups' field:

  • If the 'Other Groups' field has a value but 'Groups Audience' doesn't, then an entity with ID NULL is being used for the Groups Audience field, throwing a fatal error.

  • The form key for the 'Other Groups' field was wrong, it was looking in $form['other_groups'] instead of in $form['og_group_ref']['other_groups'].

  • For some reason the standard ValidReferenceConstraintValidator is running again rather than ValidOgMembershipReferenceConstraintValidator, resulting in this error:

    TypeError: Argument 1 passed to Drupal\Core\Field\Plugin\Field\FieldWidget\EntityReferenceAutocompleteWidget::errorElement() must be of the type array, null given, called in core/lib/Drupal/Core/Field/WidgetBase.php on line 444 in Drupal\Core\Field\Plugin\Field\FieldWidget\EntityReferenceAutocompleteWidget->errorElement() (line 122 of core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/EntityReferenceAutocompleteWidget.php).

Committed work in progress, I have to work on something else for the time being.

@pfrenssen
Copy link
Collaborator Author

Completed the testHiddenGroupIds() test. It tests that if a user edits a node that references a group the user does not have access to, the group reference is not lost when the user submits the form.

This currently fails, so this functionality has apparently regressed.

@amitaibu
Copy link
Owner

This currently fails, so this functionality has apparently regressed.

Indeed we didn't tackle it yet. I think it's fine not keep it out for now, so this PR doesn't become too scope intensive.

@pfrenssen
Copy link
Collaborator Author

@amitaibu I intend to fix the bugs that I find and split them off to separate tickets so they can be reviewed separately if that is OK for you? That will reduce the scope of this over time, so in the end it will be trivial to review.

@amitaibu
Copy link
Owner

👍

@amitaibu
Copy link
Owner

Is this ready for review?

@pfrenssen
Copy link
Collaborator Author

No not yet, there is still a lot to do here.

@pfrenssen
Copy link
Collaborator Author

This is currently postponed on the big refactoring work that is happening on the OgComplex widget in #161. Once that is done we can work on the testFieldModes() test, and progress from there.

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.

3 participants