Proyectos de Subversion Moodle

Rev

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

Rev 11 Rev 1441
Línea 33... Línea 33...
33
 * @category  test
33
 * @category  test
34
 * @copyright 2017 Andrew Nicols <andrew@nicols.co.uk>
34
 * @copyright 2017 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
 * @coversDefaultClass \file_system
36
 * @coversDefaultClass \file_system
37
 */
37
 */
38
class file_system_test extends \advanced_testcase {
38
final class file_system_test extends \advanced_testcase {
Línea 39... Línea 39...
39
 
39
 
-
 
40
    public function setUp(): void {
40
    public function setUp(): void {
41
        parent::setUp();
41
        get_file_storage(true);
42
        get_file_storage(true);
Línea 42... Línea 43...
42
    }
43
    }
43
 
44
 
-
 
45
    public function tearDown(): void {
44
    public function tearDown(): void {
46
        get_file_storage(true);
Línea 45... Línea 47...
45
        get_file_storage(true);
47
        parent::tearDown();
46
    }
48
    }
47
 
49
 
Línea 1214... Línea 1216...
1214
            'is_file_readable_locally_by_hash',
1216
            'is_file_readable_locally_by_hash',
1215
            'get_local_path_from_hash',
1217
            'get_local_path_from_hash',
1216
        ]);
1218
        ]);
Línea 1217... Línea 1219...
1217
 
1219
 
-
 
1220
        $fs->method('is_file_readable_locally_by_hash')->willReturn(false);
-
 
1221
        $getinvocations = $this->exactly(2);
-
 
1222
        $fs
-
 
1223
            ->expects($getinvocations)
1218
        $fs->method('is_file_readable_locally_by_hash')->willReturn(false);
1224
            ->method('get_local_path_from_hash')
-
 
1225
            ->willReturnCallback(fn () => match (self::getInvocationCount($getinvocations)) {
-
 
1226
                1 => '/path/to/remote/file',
-
 
1227
                2 => $filepath,
Línea 1219... Línea 1228...
1219
        $fs->method('get_local_path_from_hash')->will($this->onConsecutiveCalls('/path/to/remote/file', $filepath));
1228
            });
Línea 1220... Línea 1229...
1220
 
1229
 
1221
        $file = $this->get_stored_file('example content');
1230
        $file = $this->get_stored_file('example content');
Línea 1227... Línea 1236...
1227
    /**
1236
    /**
1228
     * Data Provider for is_image_from_storedfile tests.
1237
     * Data Provider for is_image_from_storedfile tests.
1229
     *
1238
     *
1230
     * @return array
1239
     * @return array
1231
     */
1240
     */
1232
    public function is_image_from_storedfile_provider() {
1241
    public static function is_image_from_storedfile_provider(): array {
1233
        return array(
1242
        return array(
1234
            'Standard image'            => array('image/png', true),
1243
            'Standard image'            => array('image/png', true),
1235
            'Made up document/image'    => array('document/image', false),
1244
            'Made up document/image'    => array('document/image', false),
1236
        );
1245
        );
1237
    }
1246
    }
Línea 1239... Línea 1248...
1239
    /**
1248
    /**
1240
     * Data provider for get_local_path_from_storedfile tests.
1249
     * Data provider for get_local_path_from_storedfile tests.
1241
     *
1250
     *
1242
     * @return array
1251
     * @return array
1243
     */
1252
     */
1244
    public function get_local_path_from_storedfile_provider() {
1253
    public static function get_local_path_from_storedfile_provider(): array {
1245
        return [
1254
        return [
1246
            'default args (nofetch)' => [
1255
            'default args (nofetch)' => [
1247
                'args' => [],
1256
                'args' => [],
1248
                'fetch' => 0,
1257
                'fetch' => 0,
1249
            ],
1258
            ],