-
Improvement
-
Resolution: Fixed
-
Minor
-
3.4.5, 3.5.2
Currently we have a very limited Behat step:
Then following "click here" should download between "1000" and "1200" bytes
It was created by sam marshall and added to standard Moodle by Tim Hunt. At the time was the only think they could think of to allow some sort of test of downloads - just a basic test that the download gave something, not an error.
However, it is horribly fragile. See, for example, the issues found in testing of MDL-23545 and MDL-63165.
If you look at the implementation of the current step, it just uses download_file_content on the URL from the link followed, then just tests strlen($result).
However, that means it would not be hard to implement better tests. I am thinking of a step like:
bq. Then following "click here" should download a file that:
|
| Contains | <question type="truefalse"> |
|
| Contains regexp | ~<!-- question: \d+ -->~ |
|
| Is well-formed XML | |
|
| Does not contain PHP errors | |
|
| Has size at least | 1K |
|
| Has size at mose | 1200 |
|
What do people think about that proposed form? (The idea is that it would be quite easy to add more tests later as we find we need them, and the last two there are, as already said, pretty useless, so are only really there for backwards compatibility.)
I probably won't have time to work on this any time soon, so I would be delighed if someone else took it.
- Discovered while testing
-
MDL-63165 Question: xml import of question creates erroneous categories
- Closed
-
MDL-23545 Moodle XML import/export doesn't save category description
- Closed
- has a non-specific relationship to
-
MDL-83034 Find a way to verify the extension of a downloaded file in Behat
- Open
-
MDL-63660 Unit test failure - moodle_content_writer_test::test_export_user_preference_unescaped_unicode with data set "Unicode" ('ةكءيٓپچژکگیٹڈڑہھےâîûğŞAaÇÖáǽ你好!')
- Closed
-
MDL-64066 Quick fix to step causing behat execution to halt forever and other problems
- Closed
-
MDL-82859 core_filetypes::core_filetypes() assumes that any type of file will only have a single mime type
- Closed
-
MDL-83035 Deprecate behat_admin_presets custom steps
- Waiting for push
- has been marked as being related by
-
MDL-67196 Privacy data export request download size phpunit error
- Closed