MDL-77333 mod_resource: fixes generator uploading files + tests
commit6612eab5a49c18386115a78446c5d33511b8691c
authorEloy Lafuente (stronk7) <stronk7@moodle.org>
Sat, 25 Mar 2023 12:43:55 +0000 (25 13:43 +0100)
committerEloy Lafuente (stronk7) <stronk7@moodle.org>
Tue, 28 Mar 2023 17:06:09 +0000 (28 19:06 +0200)
treeb12c4c90e73fa47b532e1eccede38b5cb383cd03
parentf7a8df253b0ff3fc8ad73135b645d4e9317b06cb
MDL-77333 mod_resource: fixes generator uploading files + tests

MDL-76499 revealed a few problems with resource generators:

1. We were not covering with unit tests the upload of files from disk
   (and here it's where the problem was).
2. There was a little of confusion between disk paths (only needed
   to upload files) and file_area paths (the generator only creates
   or uploads files to the root directory of the file area.
3. It was possible to request the upload of a file to the generator
   without that file effectively existing.

This commit fixes those points  and covers 99% of the generator code.
mod/resource/tests/generator/lib.php
mod/resource/tests/generator_test.php