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.
File sites/default/files/simpletest/text-5.txt was not allowed to be uploaded Other upload.test 109 UploadTestCase->testFilesFilter()
The testFilesFilter() fails trying to upload a .txt file when .html is the only allowed extension. The reason is that the file it's uploading is actually larger than 1MB and fails two limits causing the exact error message to not match.
This patch selects a file that is the correct size and breaks error message test into two parts: checking that the upload failed, then that it failed for the correct reason. It also adds an additional check to ensure that the HTML upload actually succeeded.
Comment | File | Size | Author |
---|---|---|---|
#1 | upload_filter_FAIL.patch | 3.81 KB | drewish |
upload_filter_FAIL.patch | 2.62 KB | drewish | |
Comments
Comment #1
drewish CreditAttribution: drewish commentedsince testLimit() has the same type of error message comparison it seemed logical to fix that as well.
Comment #2
webchickWould you be able to explain how to replicate this bug? My whole test suite is passing.
Comment #3
drewish CreditAttribution: drewish commentedi dumped the files directory and reinstalled simpletest and the tests work correctly now. that said i think these changes are improvements in the tests that will make them less brittle. but in light of the fact that they're working for me now i'll change this to an improvement task.
Comment #4
drewish CreditAttribution: drewish commentedBetter title. Still applies cleanly and all upload tests pass.
Comment #5
drewish CreditAttribution: drewish commentedlooks like this got rolled into #142995: Add hook_file and make files into a 1st class Drupal object