-
Notifications
You must be signed in to change notification settings - Fork 1
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
Testing Tripal Fields #125
Comments
so you're talking about I would think it should take as input an entity/bundle to attach to and the field component itself? I would think the right approach is either to a) define a test class that is a fieldTestClass that extends TripalTestCase or b) provide a class that can be used within said class could live in https://github.com/tripal/TripalTestSuite/tree/master/src . you would also need to provide a mock I think? edit goes without saying but we'd be very happy to include this, i think its great, thank you. |
I was also leaning towards B. I've started it as
Additionally, it would be nice to provide an easily method to fake form_state, items, element, widget (as passed to the form), etc. Would it be best to provide each as a |
Hello all! I can see this being implemented as a I think it should be the same way for fields. Of course since the Service is a separate class, we can always use a I hope this helps a little :) I can't wait to see field testing available! Thanks! |
Hmmmm... interesting! This is my class so far and here are the associated tests. Also, here is how I use it.
This sounds perfect! So in terms of methods, can I still have my constructor? I notice it's missing in MakesHTTPRequests...
This I will need to wrap my head around a little more... How do I return the initialized widget class? or do I instead include a |
@almasaeed2010 is there info on what a concern is i can read? |
Here is an example using the class you provided: We'd create a use FULL_NAME_SPACE\TripalFieldTestHelper;
trait ProvidesFieldTests {
public function prepareField($bundle_name, $machine_names, $entity, $field_info, $instance_info) {
return new TripalFieldTestHelper($bundle_name, $machine_names, $entity, $field_info, $instance_info);
}
} Then add the trait to the main Does that make it any clearer? We can always hop on a call if easier 😄 |
@bradfordcondon I honestly can't find anything online about it but in general |
so to rephrase to be sure i understand, concerns are add-on utuilities for the test class? |
Yes that's right |
I'm working on automated testing for the sbo__relationship field (you can see progress here) and am considering whiting a helper class to make field testing easier. I think ideally it would be done very generically and contributed back to Tripal Test Suite to make testing fields easier for everyone :-)
Questions/Discussion:
I'm currently very uncertain how to contribute back to TripalTestSuite so advice/guidance would be Very Appreciated! For now, I will continue on in my branch with the generic class approach just to keep development of the sbo__relationship widget going but I am very happy to change it based on discussion here :-)
The text was updated successfully, but these errors were encountered: