-
Notifications
You must be signed in to change notification settings - Fork 51
Automated tests for property fields, widgets and formatters #2133
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
Conversation
…wIDSpace' into tv4g1-2119-propertyFields
…ly doesn't pass though.
… constraints and the amount of additional worth these tests would add.
…-values-publish' into tv4g1-2119-propertyFields
|
I want to bring up a performance issue (as well as a nightmare for the relationship field #2128 ) tripal/tripal/src/Form/TripalEntityForm.php Lines 237 to 252 in a8d662d
I originally inserted this second save, because we need to save the entity in case the title or URL format includes the entity ID value in it, and for a new entity it is not known until the entity is actually saved. The perfomance issue is that the second save takes approximately 4 seconds for me right now, all just to update the entity title, which is a single field in the tripal_entity table.The nightmare part is that the "deleting properties/linking records" part actually happens twice as a result. One option is that I hope that we can justify writing to the DB table directly, as this is 1) a performance killer and 2) a problem for the relationship field as it will have two |
…ame form element.
|
NOTE: I just updated the PR description to better represent what this PR is actually now :-) Additionally, I actually have the widget testing working!!! 🎉 #2133 (comment) Additionally, there have been other PRs fixing bugs in fields including some of those originally described in the issue. |
Co-authored-by: Douglas Senalik <[email protected]>
|
Good catch 🙈 Thanks for the review!!! |
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.
This PR does touch the property fields themselves so it would be good to manually test them through the interface.
So I did import 100 publications (by chance there were 100) because those have lots of properties, then edited one adding more properties and saving, worked as expected.
Two small comments from code review
Great job @laceysanderson 😍 - and the php sniffer addition is much appreciated
Development Task
Note: this was originally a bug fix but the bug is not easily reproducible anymore. Instead this has become focused on automated testing for fields to ensure that they are stable.*
Issue #2119
Description
Specifically, this PR will work to create tests around the PROPERTY FIELD specifically as an example for field testing in general:
The following scenarios are focused on:
The following helper methods have been added to help test other fields:
I will work on documenting this process in the TripalDocs repo in PR tripal/tripal_doc#105
Testing?
Manual Testing
This PR does touch the property fields themselves so it would be good to manually test them through the interface.
Automated Testing
ChadoPropertyTypeCRUDTest
This test replaces the old tripal_chado/tests/src/Kernel/Plugin/ChadoField/FieldType/ChadoPropertyTypeSimpleCRUDTest.php. It is more efficient and comprehensive plus actually tests the contents of the Drupal field tables.
It tests the following scenarios which are described in tripal_chado/tests/src/Kernel/Plugin/ChadoField/FieldType/ChadoPropertyType-TestInfo.yml
For each scenario
ChadoPropertyWidgetFormTest
This widget test is brand new, never before done in Tripal ;-p
It tests the following scenarios which are described in tripal_chado/tests/src/Kernel/Plugin/ChadoField/FieldType/ChadoPropertyWidgetForm-TestInfo.yml
For each scenario
Code review
NOTE: This PR also fixes coding standards in the files I touched and adds coding standards checking to the docker devcontainer.
Specific updates to non-test files are:
$this->t()rather than proceduralt().t()in Exceptions as its not recommended.