Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
As far as I can see, all our hooks are currently untested. It would be great to change that, for as many of them as possible.
We should also make sure all the hooks we call are actually documented.
Estimated Value and Story Points
This issue was identified as a Beta Blocker for Drupal 8. We sat down and figured out the value proposition and amount of work (story points) for this issue.
Value and Story points are in the scale of fibonacci. Our minimum is 1, our maximum is 21. The higher, the more value or work a certain issue has.
Value: 2
Story Points: 13
Comment | File | Size | Author |
---|---|---|---|
#16 | add_tests_for_the-2625264-16.patch | 7.99 KB | borisson_ |
| |||
#16 | interdiff.txt | 6.24 KB | borisson_ |
Comments
Comment #2
borisson_So, I spent some time in the airport and on the plane working on this patch after drupalcamp vienna,
There is no test for
hook_search_api_field_type_mapping_alter
. The other hooks documented insearch_api.api.php
have been tested.I also noticed that the documentation for
hook_search_api_data_type_info_alter
was incorrect, I think this can go in with the same patch but I don't mind splitting that up.Comment #3
borisson_Setting to NR - so we can see if the bot agrees with what should be a green patch.
Comment #4
Nick_vhTesting that the hooks are called is fairly easy, but for example, hook search_api_test_hooks_search_api_index_items_alter should be tested in a way that we actually verify that the alter took place in the indexing process :)
I suppose you know that, and setting it back to needs work
Comment #5
borisson_Added a test for
hook_search_api_field_type_mapping_alter
. All hooks in the .api file have tests now.As mentioned in #4, all this does is testing that the hook is actually being called. We need to make the tests more specific to each hook.
Comment #6
borisson_Implemented a more specific test for
search_api_test_hooks_search_api_index_items_alter
.Comment #7
drunken monkeyGreat work, thanks a lot!
Just a few minor issues with your patch:
Why not just pass a path to
drupalGet()
?Anyways,
generateFromRoute()
is marked as internal, so we shouldn't use it.Why is that commented out?
Please see/test/review my attached patch, then I can commit.
Comment #8
borisson_#7.1 Sure, yeah.
#7.2 That was for testing. Shouldn't be commented.
Your patch looks great; commit away.
Comment #9
drunken monkeyOK, commited.
Thanks again!
Comment #12
drunken monkeyReverted, tests failed suddenly after committing this.
Re-posting my patch (with paths instead of
Url
objects, though).Comment #13
borisson_I don't understand how this patch can break any test not in
HooksTest
. It doesn't change any code that's being executed. The only non-test change is the in .api.php and that doesn't get executed.Comment #14
drunken monkeyAs explained elsewhere, the fails in SQLite are unrelated. And the new fails are caused by the removal of
hook_search_api_views_query_alter()
in the meantime (in #2044393: Changes in search query functionality).Thus, I also have no idea how the patch in #12 can still be passing tests. o_O Weird, weird stuff happening with the test bot in the last few days …
Anyways, we'll also need to add hooks for the new tag-based query/result alter hooks introduced in #2044393: Changes in search query functionality, so this needs work anyways. And I guess I'll just also test locally, to make sure the test bot is not just guessing at the results.
Comment #15
borisson_I think the patch in #12 is passing because of #2634114: Patches not applied correctly for contrib modules, PHP >= 5.4?.
I'll add the extra tests.
Comment #16
borisson_I couldn't help myself and I've made some unrelated changes that make the test somewhat lighter and easier. I added in the extra tests.
Comment #17
drunken monkeyThanks a lot, looks good!
Committed.
(Also tested manually locally before.)