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.
Task to convert core/modules/search/lib/Drupal/search/Tests/SearchExpressionInsertExtractTest.php
to phpunit.
Comment | File | Size | Author |
---|---|---|---|
#11 | interdiff.txt | 889 bytes | jhedstrom |
#11 | search-phpunit-2002190-11.patch | 10.36 KB | jhedstrom |
#7 | search_expression-2002190-7.patch | 10.37 KB | dawehner |
#7 | interdiff.txt | 1.95 KB | dawehner |
#5 | drupal-2002190-5.patch | 10.37 KB | dawehner |
Comments
Comment #1
jhedstromAgain fairly simple.
Comment #2
dawehnerIt would be great to convert this to dataProviders
PS: It might make sense to put this static stuff into classes.
Comment #3
dawehner.
Comment #4
ParisLiakos CreditAttribution: ParisLiakos commentedyeah we should first convert procedural code to OOP and its test to PHPUnit first:) not the other way around
Comment #5
dawehnerInstead of relying on pure static methods I think we have clearly an object here: the search expression.
Comment #6
ParisLiakos CreditAttribution: ParisLiakos commentedbesides the assertion message everything looks good. if we want to keep them we should reverse them, so they make some sense when phpunit displays them (only upon failure)
Comment #7
dawehnerThe message should be also inverted, as it is just displayed on failure.
Comment #9
ParisLiakos CreditAttribution: ParisLiakos commented#7: search_expression-2002190-7.patch queued for re-testing.
Comment #11
jhedstromThere was a typo in #7, where both arguments were passed to
trim()
. This version removestrim()
altogether as I didn't see the need for it.Comment #12
dawehnerOh thanks! I fear that I can't RTBC it.
Comment #13
ParisLiakos CreditAttribution: ParisLiakos commentedi love this patch, thanks!
Comment #14
jhedstromRegarding the inverting of the messages, my understanding is the printed message should reflect the expected outcome, not an error message, in which case we'd need to flip these messages back to the original text.
Comment #15
ParisLiakos CreditAttribution: ParisLiakos commentedthis is the case for simpletest not PHPUnit. PHPUnit only displays those messages upon failure.
assertEquals example:
Comment #16
alexpottCommitted 7b0039e and pushed to 8.x. Thanks!
Comment #18
jhedstrom