Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 1441
Línea 31... Línea 31...
31
 *
31
 *
32
 * @package     core
32
 * @package     core
33
 * @category    test
33
 * @category    test
34
 * @copyright   2020 Andrew Nicols <andrew@nicols.co.uk>
34
 * @copyright   2020 Andrew Nicols <andrew@nicols.co.uk>
35
 * @license     http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
35
 * @license     http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
36
 * @covers      \core\content\exportable_items\exportable_filearea
36
 * @covers      \core\content\export\exportable_items\exportable_filearea
37
 */
37
 */
38
class exportable_filearea_test extends advanced_testcase {
38
final class exportable_filearea_test extends advanced_testcase {
Línea 39... Línea 39...
39
 
39
 
40
    /**
40
    /**
41
     * Ensure that the the exportable_filearea does not fetch files when none exist.
41
     * Ensure that the the exportable_filearea does not fetch files when none exist.
42
     */
42
     */
Línea 232... Línea 232...
232
        $storedfileargs = [];
232
        $storedfileargs = [];
233
        foreach ($expectedfiles as $file) {
233
        foreach ($expectedfiles as $file) {
234
            $filepathinzip = $subdir . '/' . $file->get_filearea() . '/' . $file->get_filepath() . $file->get_filename();
234
            $filepathinzip = $subdir . '/' . $file->get_filearea() . '/' . $file->get_filepath() . $file->get_filename();
235
            $filepathinzip = ltrim(preg_replace('#/+#', '/', $filepathinzip), '/');
235
            $filepathinzip = ltrim(preg_replace('#/+#', '/', $filepathinzip), '/');
236
            $storedfileargs[] = [
236
            $storedfileargs[] = [
237
                $this->equalTo($context),
237
                $context,
238
                $this->equalTo($filepathinzip),
238
                $filepathinzip,
239
                $this->equalTo($file),
239
                $file,
240
            ];
240
            ];
241
        }
241
        }
Línea 242... Línea 242...
242
 
242
 
-
 
243
        $invocations = $this->exactly(count($expectedfiles));
243
        $archive->expects($this->exactly(count($expectedfiles)))
244
        $archive->expects($invocations)
244
            ->method('add_file_from_stored_file')
245
            ->method('add_file_from_stored_file')
-
 
246
            ->willReturnCallback(function (...$args) use ($invocations, $storedfileargs) {
-
 
247
                $this->assertEquals($storedfileargs[self::getInvocationCount($invocations) - 1], $args);
Línea 245... Línea 248...
245
            ->withConsecutive(...$storedfileargs);
248
            });
246
 
249
 
247
        return $exportable->add_to_archive($archive);
250
        return $exportable->add_to_archive($archive);