MDL-67673 phpunit: Introduce a new, lightweight phpunit_dataset
authorEloy Lafuente (stronk7) <stronk7@moodle.org>
Sun, 4 Oct 2020 15:30:44 +0000 (17:30 +0200)
committerEloy Lafuente (stronk7) <stronk7@moodle.org>
Wed, 21 Oct 2020 10:46:05 +0000 (12:46 +0200)
commitbe396eddf0e74562ef6b4153cd796e90e61a7756
treed4e1fbd5dea70140ebbfc433c79b061091adef23
parent4af4d709a424e8b589d04586f868298f09534ffa
MDL-67673 phpunit: Introduce a new, lightweight phpunit_dataset

In charge of taking over the, now removed/archived, phpunit/dbunit
package. It supports loading of CSV/XML files and strings and
PHP arrays, allowing to send the loaded information to database.

Perform some basic controls about the consistency of information,
surely not super-exhaustive but fair enough.

100% covered with unit test.

Planned like an "interim" replacement for phpunit/dbunit uses in
core that, ideally, should be moved to generators stuff at some
point.

Note, expect a few tests in core to fail with this commit, I've
changed some fixtures around. Next commit will fix existing uses.

Originally MDL-64600
19 files changed:
lib/phpunit/classes/phpunit_dataset.php [new file with mode: 0644]
lib/phpunit/lib.php
lib/phpunit/tests/fixtures/sample_dataset.csv
lib/phpunit/tests/fixtures/sample_dataset.txt [new file with mode: 0644]
lib/phpunit/tests/fixtures/sample_dataset.xml
lib/phpunit/tests/fixtures/sample_dataset2.xml [new file with mode: 0644]
lib/phpunit/tests/fixtures/sample_dataset_col_before_row.xml [new file with mode: 0644]
lib/phpunit/tests/fixtures/sample_dataset_insert.xml [new file with mode: 0644]
lib/phpunit/tests/fixtures/sample_dataset_many.xml [new file with mode: 0644]
lib/phpunit/tests/fixtures/sample_dataset_many_with_empty.xml [new file with mode: 0644]
lib/phpunit/tests/fixtures/sample_dataset_number_of_columns.xml [new file with mode: 0644]
lib/phpunit/tests/fixtures/sample_dataset_only_colrow.xml [new file with mode: 0644]
lib/phpunit/tests/fixtures/sample_dataset_repeated.xml [new file with mode: 0644]
lib/phpunit/tests/fixtures/sample_dataset_row_after_col.xml [new file with mode: 0644]
lib/phpunit/tests/fixtures/sample_dataset_wrong_attribute.xml [new file with mode: 0644]
lib/phpunit/tests/fixtures/sample_dataset_wrong_dataset.xml [new file with mode: 0644]
lib/phpunit/tests/fixtures/sample_dataset_wrong_table.xml [new file with mode: 0644]
lib/phpunit/tests/fixtures/sample_dataset_wrong_value.xml [new file with mode: 0644]
lib/phpunit/tests/phpunit_dataset.test.php [new file with mode: 0644]