In order to be sure that project operates as expected we should cover its functional behavior using tests.

I've started to write them since #2848476: Issues after update to 1.12 and, also, enabled automated testing for the project - https://www.drupal.org/node/2014757/qa.

This topic should be alive until we won't have proper code coverage.

To do

  1. Add tests for #value_callback
  2. Add tests for #process
  3. Add tests for menu callback - entityreference_autocomplete/autocomplete/%/%entityreference_autocomplete_bundles/%
  4. Add tests for #element_validate
  5. Create unit test for entityreference_autocomplete_label_for_reference()
  6. Create unit test for entityreference_autocomplete_resolve_entity_label_column()
  7. Create unit test for entityreference_autocomplete_explode_tags()
  8. Create unit test for entityreference_autocomplete_entity_access()
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

BR0kEN created an issue. See original summary.

BR0kEN’s picture

Status: Active » Needs review
FileSize
9.18 KB

  • BR0kEN committed 0c15bdf on 7.x-1.x
    Issue #2855983 by BR0kEN: Improve/add tests
    
BR0kEN’s picture

Issue summary: View changes
BR0kEN’s picture

  • BR0kEN committed 2876ec3 on 7.x-1.x
    Issue #2855983 by BR0kEN: Improve/add tests
    
slv_’s picture

Status: Needs review » Needs work

Hi there,

This is great, thanks a lot for all this work @BR0kEN, I feel like I owe you a beer now in Dev Days ;). I'm changing as in need of work as there are some things I'm not quite comfortable with, as they are.

I've rolled back all the changes pushed to master since the 7.x-1.12 release (http://cgit.drupalcode.org/entityreference_autocomplete/commit/?id=d14fd4d), but I pushed them all into a separate branch first (http://cgit.drupalcode.org/entityreference_autocomplete/log/?h=post-1.12), post-1.12.

Then I'll apply just the fix needed for what was broke in 7.x-1.12, in order to get a new release out asap. After that, we can work to incorporate some of the things from post-1.12 into the main branch, but I prefer to do it slowly and without changing certain parts of the module that have been altered in those commits, and that I don't see particularly fitting.

Also, as mentioned in https://www.drupal.org/node/2842655, I'd rather not have anything pushed straight to master, because then it'll be more difficult for me to keep track of it, review, etc. I understand there's a desire to have certain things in stable releases, but there's no rush on having those things. Let's make use of issues for new features or API changes. Aside of actual module changes, I believe most of the testing module and tests will be mostly fine to merge, with some minor changes on the parts that work with the function changes that were applied on the module. In any case, need to review those in more detail, which I'll do after the new stable release is out.

Thanks!