Proyectos de Subversion Moodle

Rev

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

Rev 11 Rev 1441
Línea 34... Línea 34...
34
/**
34
/**
35
 * Test phpunit_dataset features.
35
 * Test phpunit_dataset features.
36
 *
36
 *
37
 * @coversDefaultClass \phpunit_dataset
37
 * @coversDefaultClass \phpunit_dataset
38
 */
38
 */
39
class phpunit_dataset_test extends advanced_testcase {
39
final class phpunit_dataset_test extends advanced_testcase {
Línea 40... Línea 40...
40
 
40
 
41
 
41
 
42
    /**
42
    /**
Línea 78... Línea 78...
78
    }
78
    }
Línea 79... Línea 79...
79
 
79
 
80
    /**
80
    /**
81
     * test_from_file() data provider.
81
     * test_from_file() data provider.
82
     */
82
     */
83
    public function from_file_provider() {
83
    public static function from_file_provider(): array {
84
        // Create an unreadable file with vfsStream.
84
        // Create an unreadable file with vfsStream.
85
        $vfsfile = vfsStream::newFile('unreadable', 0222);
85
        $vfsfile = vfsStream::newFile('unreadable', 0222);
Línea 86... Línea 86...
86
        vfsStream::setup('root')->addChild($vfsfile);
86
        vfsStream::setup('root')->addChild($vfsfile);
Línea 175... Línea 175...
175
    }
175
    }
Línea 176... Línea 176...
176
 
176
 
177
    /**
177
    /**
178
     * test_from_string() data provider.
178
     * test_from_string() data provider.
179
     */
179
     */
Línea 180... Línea 180...
180
    public function from_string_provider() {
180
    public static function from_string_provider(): array {
181
 
181
 
182
        return [
182
        return [
183
            'wrong type' => [
183
            'wrong type' => [
Línea 197... Línea 197...
197
                'tables' => [],
197
                'tables' => [],
198
                'columns' => [],
198
                'columns' => [],
199
                'rows' => [],
199
                'rows' => [],
200
            ],
200
            ],
201
            'csv loads ok' => [
201
            'csv loads ok' => [
202
                'fullpath' => file_get_contents(__DIR__ . '/fixtures/sample_dataset.csv'),
202
                'content' => file_get_contents(__DIR__ . '/fixtures/sample_dataset.csv'),
203
                'type' => 'csv',
203
                'type' => 'csv',
204
                'tablename' => 'user',
204
                'tablename' => 'user',
205
                'exception' => null,
205
                'exception' => null,
206
                'tables' => ['user'],
206
                'tables' => ['user'],
207
                'columns' => ['user' =>
207
                'columns' => ['user' =>
Línea 213... Línea 213...
213
                        ['id' => 7, 'username' => 'pepa.novak', 'email' => 'pepa@example.com'],
213
                        ['id' => 7, 'username' => 'pepa.novak', 'email' => 'pepa@example.com'],
214
                    ]
214
                    ]
215
                ],
215
                ],
216
            ],
216
            ],
217
            'xml loads ok' => [
217
            'xml loads ok' => [
218
                'fullpath' => file_get_contents(__DIR__ . '/fixtures/sample_dataset.xml'),
218
                'content' => file_get_contents(__DIR__ . '/fixtures/sample_dataset.xml'),
219
                'type' => 'xml',
219
                'type' => 'xml',
220
                'tablename' => 'user',
220
                'tablename' => 'user',
221
                'exception' => null,
221
                'exception' => null,
222
                'tables' => ['user'],
222
                'tables' => ['user'],
223
                'columns' => ['user' =>
223
                'columns' => ['user' =>
Línea 265... Línea 265...
265
    }
265
    }
Línea 266... Línea 266...
266
 
266
 
267
    /**
267
    /**
268
     * test_from_array() data provider.
268
     * test_from_array() data provider.
269
     */
269
     */
270
    public function from_array_provider() {
270
    public static function from_array_provider(): array {
271
        return [
271
        return [
272
            'repeated array table many structures' => [
272
            'repeated array table many structures' => [
273
                'structure' => [
273
                'structure' => [
274
                    'user' => [
274
                    'user' => [
Línea 411... Línea 411...
411
    }
411
    }
Línea 412... Línea 412...
412
 
412
 
413
    /**
413
    /**
414
     * test_load_csv() data provider.
414
     * test_load_csv() data provider.
415
     */
415
     */
Línea 416... Línea 416...
416
    public function load_csv_provider() {
416
    public static function load_csv_provider(): array {
417
 
417
 
418
        return [
418
        return [
419
            'repeated csv table many files' => [
419
            'repeated csv table many files' => [
Línea 499... Línea 499...
499
    }
499
    }
Línea 500... Línea 500...
500
 
500
 
501
    /**
501
    /**
502
     * test_load_xml() data provider.
502
     * test_load_xml() data provider.
503
     */
503
     */
Línea 504... Línea 504...
504
    public function load_xml_provider() {
504
    public static function load_xml_provider(): array {
505
 
505
 
506
        return [
506
        return [
507
            'repeated xml table multiple files' => [
507
            'repeated xml table multiple files' => [
Línea 667... Línea 667...
667
    }
667
    }
Línea 668... Línea 668...
668
 
668
 
669
    /**
669
    /**
670
     * test_to_database() data provider.
670
     * test_to_database() data provider.
671
     */
671
     */
Línea 672... Línea 672...
672
    public function to_database_provider() {
672
    public static function to_database_provider(): array {
673
 
673
 
674
        return [
674
        return [
675
            'wrong table requested' => [
675
            'wrong table requested' => [
Línea 822... Línea 822...
822
    }
822
    }
Línea 823... Línea 823...
823
 
823
 
824
    /**
824
    /**
825
     * test_get_rows() data provider.
825
     * test_get_rows() data provider.
826
     */
826
     */
Línea 827... Línea 827...
827
    public function get_rows_provider() {
827
    public static function get_rows_provider(): array {
828
 
828
 
829
        return [
829
        return [
830
            'wrong table requested' => [
830
            'wrong table requested' => [