MarcusBarnes / mik

The Move to Islandora Kit is an extensible PHP command-line tool for converting source content and metadata into packages suitable for importing into Islandora (or other digital repository and preservations systems).
GNU General Public License v3.0
34 stars 11 forks source link

Work on #426. #427

Closed mjordan closed 7 years ago

mjordan commented 7 years ago

Github issue: (#426)

Related: #385, #424

What does this Pull Request do?

Fixes the following issues with the sample content generator script:

This PR also removes some cruft from the CsvBooks writer, and adds a script, extras/scripts/mik_integration_tests.php, that clones and installs MIK and IIPQA, uses MIK to generate sample input for single file, compound, book, and newspaper content models, runs MIK on this sample input, and then runs IIPQA on MIK's output. This script is related to discussion in #385 about running test content through MIK separate from unit tests.

What's new?

See above. The bug fixes are trivial. The mik_integration_tests.php script is a standalone optional test script that is independent of PHPUnit.

How should this be tested?

This PR should be smoke tested (it's not covered by PHPUnit tests) but since it modifies a writer, the PHPUnit tests should be run anyway.

  1. Check out the issue-426 branch.
  2. WIthin the MIK directory, run phpunit --exclude-group inputvalidators --bootstrap vendor/autoload.php tests. You should get 52 tests, 72 assertions.
  3. Within the extras/scripts directory, run the new mik_integration_tests.php script, specifying a location in your system's /tmp directory such as /tmp/issue426test: e.g., php mik_integration_tests.php /tmp/issue426test. The script will clone and install MIK and IIPQA, then generate data and perform QA checks on the data. Once the script stops running, you should see output like this:
MIK is generating output for content model 'single' into /tmp/mjtest/output/data/single_output
IIPQA checks for 'single' are OK.
MIK is generating output for content model 'compound' into /tmp/mjtest/output/data/compound_output
IIPQA apears to have found a problem with the 'compound' packages.
MIK is generating output for content model 'newspapers' into /tmp/mjtest/output/data/newspapers_output
IIPQA checks for 'newspapers' are OK.
MIK is generating output for content model 'books' into /tmp/mjtest/output/data/books_output
IIPQA checks for 'books' are OK.
Configuration files generated by this script are in the mik directory, and MIK's temporary files have not been deleted.

As you can see, IIPQA has detected a problem with the compound ingest packages generated by MIK. This is expected because the mik_integration_tests.php script is running in mik's master branch. If you want to see what the problem is, open /tmp/issue426test/output/logs/compound/iipqa.log (spoiler alert, it's the missing structure.xml files). In preparation for rerunning the mik_integration_tests.php script in the issue-426 branch:

  1. enter /tmp/issue426test/mik (or the mik directory in your output directory)
  2. run git checkout issue-426
  3. return to the extras/scripts directory and rerun mik_integration_tests.php.

This time, IIPQA should report no problems with the compound ingest packages. mik_integration_tests.php will also skip cloning and installing MIK and IIPQA since they already exist.

Additional notes

We may want to consider, at a later time, adding an option to mik_integration_tests.php that will allow cloning of a specific MIK branch, e.g., `mik_integration_tests.php -b issue-426.

MarcusBarnes commented 7 years ago

Confirming that I got OK (52 tests, 72 assertions) as expected when running the PHPUnit command.

MarcusBarnes commented 7 years ago

Tested and worked as described. Thank you @mjordan.