Uploaded image for project: 'Islandora'
  1. Islandora
  2. ISLANDORA-1858

Islandora Tests Cannot Be Run Through Web Interface

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Labels:
      None

      Description

      It looks like test cannot be run from within the web interface anymore. There have been a couple posts on the list about this issue:
      https://groups.google.com/forum/#!searchin/islandora/The$20expected$20ingest$20method$20is$20"ingestDatastream"$2C$20got$20"modifyDatastream".|sort:relevance/islandora/Etu7DVBNK_o/3iBUU3aj1H4J
      https://groups.google.com/forum/#!searchin/islandora/The$20expected$20ingest$20method$20is$20"ingestDatastream"$2C$20got$20"modifyDatastream".|sort:relevance/islandora/vYwbScV13cs/m0-MopkCBwAJ

      I've got the tests setup now and they will run though the drush interface, but not through the drupal web interface. This is somewhat deceiving as we have this nice form alter that shows you the status of the filter drupal file. Make it seem like test should run though the web interface.

      I think that either test should be made to work through the web interface, or this form alter should be changed to tell users that they cannot be run through the web interface.

      After a lot of digging and thinking our development environment was broken I found that the cause of the failed test is this check:
      https://github.com/Islandora/islandora/blob/7.x/includes/derivatives.inc#L19

      Since tests are run in a batch in the web interface, adding the derivative operations into the batch breaks the assumption in the derivative hooks are going to run immediately which makes this test case fail:
      https://github.com/Islandora/islandora/blob/7.x/tests/derivatives.test#L59-L87

      Some options for fixes:

      1. An ugly way to fix this is to test if we are in a test and if so don't batch the derivatives. I don't like the idea of adding tooling for tests to the main module, but it does fix the issue nicely.
        $test_info = $GLOBALS['drupal_test_info'];
        if (empty($batch_array) || !empty($test_info['test_run_id']))
      2. Another option would be to remove this test case altogether, but it is nice to see that these hooks are firing correctly.
      3. A third option would be to change the alter of the web interface to warn people not to run the tests in that manner. I would argue that this isn't a very good option.

      Like to hear if anyone has some input on this one.

        Attachments

          Activity

            People

            • Assignee:
              jonathan.green Jonathan Green
              Reporter:
              jonathan.green Jonathan Green
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: