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

file_storage_test.php fails if more than one empty archetype

    XMLWordPrintable

    Details

      Description

      See test_create_file_from_reference()

      When another external plugin creates a role with an empty archetype, this test fails with the output below:

      Debugging: Did you remember to make the first column something unique in your call to get_records? Duplicate value '' found in column 'archetype'.
      * line 791 of /lib/dml/pgsql_native_moodle_database.php: call to debugging()
      * line 1305 of /lib/dml/moodle_database.php: call to pgsql_native_moodle_database->get_records_sql()
      * line 1256 of /lib/dml/moodle_database.php: call to moodle_database->get_records_select()
      * line 1345 of /lib/dml/moodle_database.php: call to moodle_database->get_records()
      * line 330 of /lib/filestorage/tests/file_storage_test.php: call to moodle_database->get_records_menu()
      * line ? of unknownfile: call to core_files_file_storage_testcase->test_create_file_from_reference()
      * line 988 of /vendor/phpunit/phpunit/PHPUnit/Framework/TestCase.php: call to ReflectionMethod->invokeArgs()
      * line 838 of /vendor/phpunit/phpunit/PHPUnit/Framework/TestCase.php: call to PHPUnit_Framework_TestCase->runTest()
      * line 80 of /lib/phpunit/classes/advanced_testcase.php: call to PHPUnit_Framework_TestCase->runBare()
      * line 648 of /vendor/phpunit/phpunit/PHPUnit/Framework/TestResult.php: call to advanced_testcase->runBare()
      * line 783 of /vendor/phpunit/phpunit/PHPUnit/Framework/TestCase.php: call to PHPUnit_Framework_TestResult->run()
      * line 779 of /vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php: call to PHPUnit_Framework_TestCase->run()
      * line 749 of /vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php: call to PHPUnit_Framework_TestSuite->runTest()
      * line 350 of /vendor/phpunit/phpunit/PHPUnit/TextUI/TestRunner.php: call to PHPUnit_Framework_TestSuite->run()
      * line 176 of /vendor/phpunit/phpunit/PHPUnit/TextUI/Command.php: call to PHPUnit_TextUI_TestRunner->doRun()
      * line 129 of /vendor/phpunit/phpunit/PHPUnit/TextUI/Command.php: call to PHPUnit_TextUI_Command->run()
      * line 63 of /vendor/phpunit/phpunit/composer/bin/phpunit: call to PHPUnit_TextUI_Command::main()
      E........................................................
       
      Time: 9.6 seconds, Memory: 76.25Mb
       
      There was 1 error:
       
      1) core_files_file_storage_testcase::test_create_file_from_reference
      Unexpected debugging() call detected.
       
      /code/m2x/lib/phpunit/classes/advanced_testcase.php:88
       
      To re-run:
       vendor/bin/phpunit --colors core_files_file_storage_testcase lib/filestorage/tests/file_storage_test.php
       
      
      

      The same happens for repository/tests/repositorylib_test.php

      See my patch - it makes the test a bit more robust

      Love,
      Eugene.

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                11/Jan/16