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

mtrace should not use stdout when in PHPUNIT_TEST

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 2.3
    • 2.3
    • Unit tests
    • MOODLE_23_STABLE
    • MOODLE_23_STABLE
    • Hide
      1. Run cron via CLI and web
      2. VERIFY: Messages still get printed (starting cron... etc etc)
      3. Run phpunit tests. You can use MDL-33326 as the test case, or you could add the test_cron() function in the issue description to lib/filestorage/tests/file_storage_test.php
      Show
      Run cron via CLI and web VERIFY: Messages still get printed (starting cron... etc etc) Run phpunit tests. You can use MDL-33326 as the test case, or you could add the test_cron() function in the issue description to lib/filestorage/tests/file_storage_test.php

      If mtrace outputs using normal output, then we can use the various phpunit output buffering functions to check the output of mtrace.

      Also, right now, by using STDOUT during phpunit tests its very difficult to prevent the output.

      The test I was starting to write:

          public function test_cron() {
              $this->resetAfterTest(true);
       
              $fs = get_file_storage();
       
              // We expect a string for two reasons, 1) because we expect to see this string,
              // 2) because using this prevents the output.
              $this->expectOutputRegex('/Cleaning up/');
              $fs->cron();
          }

            poltawski Dan Poltawski
            poltawski Dan Poltawski
            Petr Skoda Petr Skoda
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

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