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.
Problem/Motivation
One nice feature of WebTestBase is that for each error we have, we automatically trigger an error in the test
Proposed resolution
Let's add this to BrowserTestBase itself.
Remaining tasks
User interface changes
API changes
Data model changes
Comment | File | Size | Author |
---|---|---|---|
#12 | interdiff.txt | 1.75 KB | dawehner |
#12 | 2664150-12.patch | 4.46 KB | dawehner |
#10 | interdiff.txt | 523 bytes | dawehner |
#10 | 2664150-10.patch | 4.17 KB | dawehner |
#6 | 2664150-6.patch | 4.13 KB | dawehner |
Comments
Comment #2
dawehnerComment #4
larowlanYeah spent some time on this on Friday on a client test, will ping you for a chat with some ideas
Comment #5
larowlanYou have an extra if that I think is preventing the session return
Comment #6
dawehnerHa, well, vim is dangerous sometimes.
Comment #8
dawehnerIn order to fix this properly we would need to have a way to distinct between WebTestBase tests and BrowserTestBase tests, in which case we would just throw the exception in the later case.
Comment #9
klausiJust for reference we solved this a bit differently in Rules for now: https://github.com/fago/rules/blob/8.x-3.x/tests/src/Functional/RulesBro...
We have created methods on our browser test base class that perform web requests. At the end of each method we check the response for assertion headers. Primitive, but works.
fago also complained about this and we are seeking other solutions in #2659808: Improve browser tests to check for PHP errors and/or errors in watchdog.
Comment #10
dawehnerHere is a bugfix
Comment #11
larowlan$options doesn't look used?
If simpletest module is enabled on a production site (yep someone might do that) - this could lead to unserializing user provided data. I think we should be checking
drupal_valid_test_ua()
here too - we're already passing in $request (but not using it?) - that way this code can't be run outside of the test-runner?Should we be defensive here and make sure that
count($parameters) === 3
.Personally I'd prefer
list($something, $something_else, $something_else_again) = $parameters
over the magic 0,1,2.Comment #12
dawehnerOh lovely testing system, the area where things are kinda nice.
Comment #13
larowlanThanks mate, looks good to me
Comment #16
alexpottCommitted fde19db and pushed to 8.0.x, 8.1.x, 8.2.x since this only affects test code (and pretty experimental test code at that). Thanks!