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

Errors when running stateactions_test by itself

XMLWordPrintable

    • MOODLE_400_STABLE
    • MOODLE_400_STABLE
    • MDL-75759-master
    • Hide
      Prerequisites
      1. Xdebug PHP extension enabled with "xdebug.mode=coverage" config value set. e.g. on Ubuntu:
        • Install and enable xdebug

          sudo apt install phpX.Y-xdebug
          sudo phpenmod xdebug
          

        • Edit /etc/php/X.Y/cli/php.ini and add the following

          xdebug.mode=coverage
          

        • Confirm xdebug is loaded by checking for xdebug entries when running php -i | grep xdebug
      Test
      1. Initiate PHPUnit
        • e.g. via MDK:

          mdk phpunit

      2. Run the stateactions test:

        php -dpcov.enabled=1 -dpcov.initial.files=1024 -dpcov.directory=`pwd` -dmemory_limit=4096M vendor/bin/phpunit --coverage-html coverage course/format/tests/stateactions_test.php
        

        • Confirm that all tests are passing
        • Confirm that there are no warnings about invalid @covers annotation.
      3. Run the stateupdates test:

        php -dpcov.enabled=1 -dpcov.initial.files=1024 -dpcov.directory=`pwd` -dmemory_limit=4096M vendor/bin/phpunit --coverage-html coverage course/format/tests/stateupdates_test.php
        

        • Confirm that all tests are passing
        • Confirm that there are no warnings about invalid @covers annotation.
      Show
      Prerequisites Xdebug PHP extension enabled with " xdebug.mode=coverage " config value set. e.g. on Ubuntu: Install and enable xdebug sudo apt install phpX.Y-xdebug sudo phpenmod xdebug Edit /etc/php/X.Y/cli/php.ini and add the following xdebug.mode=coverage Confirm xdebug is loaded by checking for xdebug entries when running php -i | grep xdebug Test Initiate PHPUnit e.g. via MDK: mdk phpunit Run the stateactions test: php -dpcov.enabled=1 -dpcov.initial.files=1024 -dpcov.directory=`pwd` -dmemory_limit=4096M vendor/bin/phpunit --coverage-html coverage course/format/tests/stateactions_test.php Confirm that all tests are passing Confirm that there are no warnings about invalid @covers annotation. Run the stateupdates test: php -dpcov.enabled=1 -dpcov.initial.files=1024 -dpcov.directory=`pwd` -dmemory_limit=4096M vendor/bin/phpunit --coverage-html coverage course/format/tests/stateupdates_test.php Confirm that all tests are passing Confirm that there are no warnings about invalid @covers annotation.

      To reproduce:

      1. Initialise PHPUnit

        php admin/tool/phpunit/cli/init.php

      2. Run the stateactions_test by itself:

        vendor/bin/phpunit course/format/tests/stateactions_test.php

      3. Expected: It will run okay and everything is passing
      4. Actual: The following errors are encountered

        1) core_courseformat\stateactions_test::test_get_state with data set "admin weeks course_state" ('weeks', 'admin', 'course_state', array(array(), null, null), array(array('course'), array('section0', 'section1', 'section2', 'section3'), array('cm0', 'cm1', 'cm2', 'cm3')), false)
        Error: Call to undefined function core_courseformat\output\local\state\external_format_string()
         
        /Users/jun/Work/moodles/stable_400/moodle/course/format/classes/output/local/state/cm.php:84
        /Users/jun/Work/moodles/stable_400/moodle/course/format/classes/stateupdates.php:184
        /Users/jun/Work/moodles/stable_400/moodle/course/format/classes/stateupdates.php:152
        /Users/jun/Work/moodles/stable_400/moodle/course/format/classes/stateactions.php:446
        /Users/jun/Work/moodles/stable_400/moodle/course/format/classes/stateactions.php:481
        /Users/jun/Work/moodles/stable_400/moodle/course/format/tests/stateactions_test.php:233
        /Users/jun/Work/moodles/stable_400/moodle/lib/phpunit/classes/advanced_testcase.php:80
        

      Additionally, if you run with coverage, you'll see the following warnings:

      144) core_courseformat\stateactions_test::test_get_state with data set "student social cm_state using an invalid cm" ('social', 'student', 'cm_state', array(array('invalidcm'), null, null), array(), true)
      "@covers \core_course\stateactions::course_state" is invalid
      

            jpataleta Jun Pataleta
            jpataleta Jun Pataleta
            David Woloszyn David Woloszyn
            Simey Lameze Simey Lameze
            Angelia Dela Cruz Angelia Dela Cruz
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 7 hours, 26 minutes
                7h 26m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.