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

Unit test fails if behat config is missing

    XMLWordPrintable

    Details

    • Affected Branches:
      MOODLE_400_STABLE
    • Fixed Branches:
      MOODLE_400_STABLE
    • Pull Master Branch:
      master-MDL-72527
    • Testing Instructions:
      Hide
      1. Edit config.php and, before the require_once(.... line near the end, add this:

        $CFG->behat_wwwroot = null;
        $CFG->behat_dataroot = null;
        $CFG->behat_prefix = null;
            

      2. Init PHP and run this:

        vendor/bin/phpunit lib/tests/behat_lib_test.php
            

      3. Verify that the 5 tests are skipped and there are no failures.
      4. Edit config.php again and just set the $CFG->behat_wwwroot like:

        $CFG->behat_wwwroot = 'test';
            

      5. Run the same unit tests and verify that the 5 tests are skipped and there are no failures.
      6. Edit config.php again and just set:

        $CFG->behat_dataroot = 'test';
        $CFG->behat_prefix = 'test';
            

      7. Run the same unit tests and verify that now the 5 tests are executed and pass ok.
      Show
      Edit config.php and, before the require_once(.... line near the end, add this: $CFG->behat_wwwroot = null; $CFG->behat_dataroot = null; $CFG->behat_prefix = null; Init PHP and run this: vendor/bin/phpunit lib/tests/behat_lib_test.php Verify that the 5 tests are skipped and there are no failures. Edit config.php again and just set the $CFG->behat_wwwroot like: $CFG->behat_wwwroot = 'test'; Run the same unit tests and verify that the 5 tests are skipped and there are no failures. Edit config.php again and just set: $CFG->behat_dataroot = 'test'; $CFG->behat_prefix = 'test'; Run the same unit tests and verify that now the 5 tests are executed and pass ok.

      Description

      If $CFG->behat_wwwroot, $CFG->behat_dataroot and $CFG->behat_prefix are undefined the core_testsuite will fail with the following error:

       

      1) behat_lib_test::test_behat_is_requested_url with data set #0 ('http://behat.moodle.org', true, array('behat.moodle.org', 80, ''))
      Error: Call to undefined function behat_is_requested_url()

      /var/www/html/lib/tests/behat_lib_test.php:52
      /var/www/html/lib/phpunit/classes/advanced_testcase.php:80

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              matt.clarkson Matt Clarkson
              Reporter:
              matt.clarkson Matt Clarkson
              Peer reviewer:
              Dan Marsden Dan Marsden
              Integrator:
              Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
              Tester:
              Gladys Basiana Gladys Basiana
              Participants:
              Component watchers:
              Andrew Lyons, Dongsheng Cai, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 1 hour, 6 minutes
                  1h 6m