Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-41345

Phunit test: can not find mimeinfo() when running lib/tests/medialib_test.php

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.6
    • Fix Version/s: None
    • Component/s: Unit tests
    • Labels:
    • Affected Branches:
      MOODLE_26_STABLE

      Description

      jerome@jerome-MacBookPro:~/moodles/integration_master/moodle$ mdk phpunit -u lib/tests/medialib_test.php
      Initialising Moodle PHPUnit test environment...
      PHPUnit ready!
      Executing vendor/bin/phpunit lib/tests/medialib_test.php
      Moodle 2.6dev (Build: 20130815), pgsql, 90a5a4b620f90b65595aa1f2119219998abda767
      PHPUnit 3.7.24 by Sebastian Bergmann.

      Configuration read from /home/jerome/moodles/integration_master/moodle/phpunit.xml

      ......PHP Fatal error: Call to undefined function mimeinfo() in /home/jerome/moodles/integration_master/moodle/lib/medialib.php on line 198

      Fatal error: Call to undefined function mimeinfo() in /home/jerome/moodles/integration_master/moodle/lib/medialib.php on line 198

      Adding require_once() to function get_mimetype() fix it:

      /**
           * Guesses MIME type for a moodle_url based on file extension.
           * @param moodle_url $url URL
           * @return string MIME type
           */
          public static function get_mimetype(moodle_url $url) {
              global $CFG;
              require_once($CFG->dirroot . '/lib/filelib.php');
              return mimeinfo('type', self::get_filename($url));
          }
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              jerome Jérôme Mouneyrac
              Participants:
              Component watchers:
              Andrew Lyons, Dongsheng Cai, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated: